You can write a function to make things less tedious to write:
'This function takes the XY coordinates of the top-left 'corner of the panel, and its width and height in pixels, 'and returns whether or not it's being touched currently DEF TOUCHING(X,Y,W,H) VAR TX,TY,TM TOUCH OUT TX,TY,TM RETURN TM && TX>=X && TX<X+W && TY>=Y && TY<Y+H END 'If touching a 30x30 pixel panel at coordinates (50,100)... IF TOUCHING(50,100,30,30) THEN ... ENDIFAs a side note, when combining conditions like `X>100` and `X<200`, it's better to use `&&` and `||` instead of `AND` and `OR`. This is because `AND` and `OR` are actually bitwise operators, whereas `&&` and `||` are logical operators, and there are subtle differences between them. For example, they are different when either side is a number that isn't 0 or 1.
- With the logical operators, they treat 0 as false, and any other number as true. For example, `7 && 10` is 1, because both 7 and 10 are not 0.
- With the bitwise operators, they compare each bit of the left number against each bit of the right number, and the result is all of the bit comparisons together. For example, `7 AND 10` is 2, because in binary, 7 is 0111 and 10 is 1010, and the result is 0010 or 2 because that's the only bit set in both numbers.
IF BUTTON() AND #A THEN ... ENDIF