Turtle Graphics Scripting Examples

No java support

    Examples

 

 

 

 

 

 

 

 

 

 

 

 


The following are some scripting commands that can be and in some cases should be used if you are scripting the turtle applet from a html page. These commands should be preceded with the name given to the applet by the html page and a period and then the command.. eg. document.Turtle.doShow(0);

Command Use Function Arguments
isReady() Necessary, returns "YES" or "NO" Requests applet if it is ready to receive another command.   The script should send another command only if "YES" is returned.   See source of this page for example.  Presently, the isReady() returns 'YES' if there is less than 500000 commands in the input queue. None
getNumberOfCommands() Optional, returns the number of commands in the turtle's input queue. Askes the applet how many commands the turtle has in its input queue.  Presently the turtle can have 550000 commands in the queue.   None
doStore(0) Necessary with argument of 0 Tells applet to store commands in its memory or not 0=don't store 1=store
doRate(value) Advised with argument between 6 and 10 Tells applet how many milliseconds to pause between moves.   The value should not be greater than the value used in the html animation delay. Value representing milliseconds
doShow(0) Advised with argument of 0 Tells applet to display variable data or not 0=don't display 1=display
doCommand(command) Necessary with command as argument.  Returns "" if ok, "Error string if syntax error or "STOP" if commands are being sent to fast. See the isReady() command above. Inputs the command. eg. document.Turtle.doCommand( "draw(5,7)"); Look at the source of this page to see examples Command string
doClear() Optional Clears screen of previous graphics None
getWidth() Optional Gets width of the applet None, returns a double (decimal number)
getHeight() Optional Gets height of the applet None, returns a double (decimal number)

Back to TurtleDirectons

Link to Turtle

Link to Poseidon Software and Invention Home Page

Date last updated 10/11/98

Copyright 1998 Poseidon Software and Invention