Points and Rectangles
SenseTalk understands the concepts of geometric points and rectangles.
Points and Rectangles in SenseTalk
Any list of two numbers, or a text string consisting of two numbers separated by a comma, can be treated as a point. The first number represents the X coordinate of the point, and the second number the Y coordinate:
put [150,47] into pointA
put "250,98" into pointB
A rectangle can be represented by any list of two points, by a list of four numbers or by a text string consisting of four numbers separated by commas (representing two points). The two points indicate two opposite corners of the rectangle (either the top-left and bottom-right corners, or the bottom-left and top-right corners, listed in either order).
put [pointA,pointB] into myRect
put "15,28,19,72" into bounds
The Is Within
operator can be used to test whether a point lies within a rectangle or one rectangle is completely within another:
if [18,35] is within bounds then scoreHit