Whilevarn: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
Fox (talk | contribs)
I will put in a more usual example
Fox (talk | contribs)
No edit summary
Line 10: Line 10:
   whilevarvarn TEMP NUMSECTORS
   whilevarvarn TEMP NUMSECTORS
   {
   {
     setsector[TEMPSECTORS].floorpal 0
     setsector[TEMPSECTORS].floorpal 1
     addvar TEMP 1
     addvar TEMP 1
   }
   }

Revision as of 13:13, 8 August 2009

whilevarn <gamevar> <value> { code to execute }

Executes the code in the curly braces as long as <gamevar> does not equal <value>. This is a simple while loop.

Caution: Poor execution or endless loops will cause your game to close without error or simply stall and crash!

This example will set up the palette of the floor from all sectors on the map:

onevent EVENT_LOADACTOR
  whilevarvarn TEMP NUMSECTORS
  {
    setsector[TEMPSECTORS].floorpal 1
    addvar TEMP 1
  }
endevent