Scripting hints: Difference between revisions

Jump to navigation Jump to search
m
*>Monkey 05 06
 
Line 58: Line 58:
   }
   }


In both cases (AGS and the pseudo-C-style programming) ''i'' would have a resulting value of 6 and the loop would run exactly one time. This bit of trickery is possible thanks to Game.DoOnceOnly accepting unique ID strings. If you needed to perform more than one do-while within a single second you would have to do something else, perhaps just appending a variable to the end of that, but you should get the idea now. Also just for clarification you could always just create a temporary variable like "bool doOnce = true;" and then set it to false within the loop. This way is just more fun!
In both cases (AGS and the pseudo-C-style programming) ''I'' would have a resulting value of 6 and the loop would run exactly one time. This bit of trickery is possible thanks to Game.DoOnceOnly accepting unique ID strings. If you needed to perform more than one do-while within a single second you would have to do something else, perhaps just appending a variable to the end of that, but you should get the idea now. Also just for clarification you could always just create a temporary variable like "bool doOnce = true;" and then set it to false within the loop. This way is just more fun!

Navigation menu