Querying commands
Querying Commands
These commmands are used to get information about the position of the turtle:
Returns the current x-coordinate of the turtle = XCOR
Returns the current y-coordinates of the turtle = YCOR
Returns the current z-coordinates of the turtle = ZCOR
Returns the position of the turtle, as x, y, and z coordinates (in that order) = POS
Returns the current turtle postition to the given coordinates = DISTANCETOXYZ (no.1, no.2, no.3)
Where no.1 is the x-coordinate you want the distance to, no.2 is the y-coordinate you want the distance to, and no.3 is the z coordinate you want the distance to. Make sure to have a space between all three variables, and not to include the brackets.
Returns the current turtle position to the given list = DISTANCETO [(list)]
The list has to contain three numbers, and x y and z component. For example; DISTANCETO [1 2 3], make sure there is a space between each number or an errror will occur.
Returns the current heading or orientation of the turtle = HEADING
This returns four numbers the first 3 are a 3D vector represting the rotation axis, and the fourth being the angle to rotate on the axis in radians.
To set the heading or orientation of the turtle = SETHEADING [(no.1) (no.2) (no.3) (no.4)]
Where (no.1) is the x-coordinate, (no.2) is the y-coordinate, (no.3) is the z-coordinate, and (no.4) is the rotation of the turtle in radians.
To rotate the turtle towards the point (x, y, z) =TOWARDS [(no.1) (no.2) (no.3)]
Where (no.1) is the x-coordinate, (no.2) is the y coordinate, and (no.3) is the z coordinate.
To work out the distance between two coordinates = DISTANCEBETWEEN [(no.1) (no.2) (no.3)] [(no.4) (no.5) (no.6)]
Where (no.1) is the x-coordinate of the first point, (no.2) is the y-coordinate at the first point, (no.3) is the z coordinate at the first point, (no.4) is the x-coordinate at the second point, (no.5) is the y coordinate at the second point, and (no.6) is the z-coordinate at the second point. Make sure there is a space between each coordinate and the two lists.
Always make sure there is a space between the command word and the variable/s.
- 2905 reads