Thread: Stop infinity!
View Single Post
avoiding inifinte loops
Old
chuck
Guest
 
Status:
Posts: n/a
Default avoiding inifinte loops - 02-15-2007, 09:37 AM

Events are often a good alternative to loops that run continuosly. Take a look at some of the events in the flightSimulator on Alice's Examp[les tab.

For instance:

While World.WindMillIsOn is true
Begin: Nothing
During: windmill.Blades roll at speed left speed = 0.25 revolutions per second
End: Nothing

The programmer set up a Boolean property named World.WindMillIsOn and this eevent effectively loops the instruction as long as the variable is true.

Another event could set set up to change the value of the property based on a key press or mouse click.

"While the world is running" is another alternative to inifinte loops. You can create this event by right clicking on a "When the world starts" event.

I hope this helps.

Chuck Herbert
   
Reply With Quote