Here is the code for the turtleselection project.
The code to implement the first method of turtle selection is contained in done. This is the code that is called when the button is clicked. The three turtles are each asked in turn what the color under it is. If they all have the correct color then the message 'You Won!' is printed.
The rest of the file is used by the second method, clicking on each turtle in turn. Each turtle was programmed to call the procedure named after itself when it is clicked. To program a turtle right click on the turtle to bring up it's program window. This will not work here in the plugin you need to do this in MicroWorlds.
to startup make "lock [] make "combination [star flower fish] setTurtles end to done flower, if colorunder = 36 [fish, if colorunder = 96 [star, if colorunder = 16 [show [You won! ] setTurtles stop]]] show [Not correct, try again] setTurtles end ;; ;; The instruction entered into the programming box for each turtle ;; is 'turtlename'Clicked. ;; to starClicked if member? "star :lock [show [You entered the star already.] stop] make "lock fput "star :lock text3, insert (se "star char 32) if (count :lock) = 3 [checkResults] end to flowerClicked if member? "flower :lock [show [You entered the flower already.] stop] make "lock fput "flower :lock text3, insert (se "flower char 32) if (count :lock) = 3 [checkResults] end to fishClicked if member? "fish :lock [show [You entered the fish already.] stop] make "lock fput "fish :lock text3, insert (se "fish char 32) if (count :lock) = 3 [checkResults] end to checkResults ifelse equal? :lock :combination [show [You won!]] [show [Sorry, you lose]] make "lock [] text3, ct setTurtles end to setTurtles star, setpos [99 109] flower, setpos [150 106] fish, setpos [46 101] end