Hello, I'm new here.
How can I check value in two dimensional array like: (this obviously don't work for me)
(if: $levelMap[$posX][$posY+1] is > 0)
Go South
The $levelMap is 10 : 10 array:
(set: $levelMap to (a:
[0,0,0,0,0,0,0,0,0,0],
[0,1,1,1,1,1,1,1,1,0],
[0,1,0,0,0,0,0,0,1,0],
[0,1,0,1,1,1,1,0,1,0],
[0,1,0,1,1,1,1,1,1,0],
[0,1,0,0,0,0,0,0,1,0],
[0,1,1,1,1,1,1,1,1,0],
[0,1,0,0,0,0,0,1,1,0],
[0,1,1,1,1,1,1,1,1,0],
[0,0,0,0,0,0,0,0,0,0]))
Comments
The third paragraph of Harlowe's Array Data documentation explains you can use brackets (parentheses) to access element using expressions.
notes:
a. some care needs to be taken when mixing Javascript syntax with Harlowe's because they are not fully compatible languages. eg. you are mixing Javascript array declaration with Harlowe's
b. You shouldn't mix the is operator (which is equivalent to Javascript's === operator) with the greater-than > or less-than < operators, the Boolean Data documentation lists the correct operators to use.
c. Your (if:) macro example is missing it's associated hook.