Differences

This shows you the differences between the selected revision and the current
version of the page.


wmebook:ch2 2008/07/21 19:45 wmebook:ch2 2008/07/21 19:47 current
Line 382: Line 382:
Those loops are very nice for some background processes you need to carry on for the whole game. For example you can check if the background music is playing and if it stops, you can play another song from the play list or in the demo project those processes handle caption displaying. Those loops are very nice for some background processes you need to carry on for the whole game. For example you can check if the background music is playing and if it stops, you can play another song from the play list or in the demo project those processes handle caption displaying.
 +
Line 446: Line 447:
</code> </code>
-//**Syntax rule no. 5**+//**Syntax rule no. 6**
function name must contain only alphanumeric characters and there shouldn't be any whitespace characters.// function name must contain only alphanumeric characters and there shouldn't be any whitespace characters.//
Everything should be very clear at this point. If it’s not, please review the previous chapters before you can understand what’s going on. The only important thing is that we passed to **if** command, instead of our good old direct comparison, a //function//, which returns true or false. **if** command evaluates the function (which in this case returns //false//) and then executes the //else// block. Everything should be very clear at this point. If it’s not, please review the previous chapters before you can understand what’s going on. The only important thing is that we passed to **if** command, instead of our good old direct comparison, a //function//, which returns true or false. **if** command evaluates the function (which in this case returns //false//) and then executes the //else// block.
 +
====== 2.5. Includes ====== ====== 2.5. Includes ======
Line 463: Line 465:
**Important:** **Important:**
Never initialize your variables in the include files. They will get reinitialized with every inclusion of your script. Never initialize your variables in the include files. They will get reinitialized with every inclusion of your script.
- 
-<code script> 
-for (var a=0; a<10;a=a+1) Game.Msg("Hell"); 
-Game.Msg("1"); 
-for (a=0; a<10;a=a+1) Game.Msg("Hell"); // note that I had to put the var away as it was already declared before. 
-Game.Msg("2"); 
-for (a=0; a<10;a=a+1) Game.Msg("Hell"); // note that I had to put the var away as it was already declared before. 
-Game.Msg("3"); 
-</code> 
 
wmebook/ch2.1216662341.txt.gz · Last modified: 2008/07/21 19:45 by metamorphium
Recent changes RSS feed Creative Commons License Driven by DokuWiki