1. When you're doing something repetitively (such as walking and turning drunkenly), use the "every" construct instead of "wait". For instance, instead of:
to Go
fd 1
rt random 11 - 5
wait 0.1
end
to Go
every 0.1
[ fd 1
rt random 11- 5
]
end
2. However, "wait" is still useful for when you're doing one thing after another, without repetition, and need some time between actions. For instance:
to Go
ask turtle 0
[ set label "Hi there..." ]
wait 1
ask turtles
[ set label "" ]
ask turtle 8
[ set label "Yo." ]
wait 1.5
...
...
end
3. "count" will be useful in several areas. For instance, you can count the number of turtles at any time, just using "count turtles". This number can be useful for decision-making, such as terminating a game when the number of good guys finally hits zero:
to Go
every 0.05
[ do-this
then-do-that
if something-bad-occurs
[ explode
die
]
]
if count turtles = 0
[ stop ]
end
In the code above, the "stop" command will actually unpress the your forever button, and the animation will stop.
4. To show the user how many turtles there are left, you can create a Monitor, and put "count turtles" into the Reporter section of the dialog box. If you do, then also set the "decimal places" value to 0 because you rarely have any fractional turtles to report.