×
Меню
Индекс

MSFD While conditions

While conditions
While ( condition )
; things to do
EndWhile
 
The while command differs from the if command in that it is repeated within one frame until the condition is fulfilled. This is best explained with an example:
Short desiredAmnt
 
SetStrength 0
while( GetStrength < desiredAmnt ) ; non-literal value to match
  modStrength 1
endwhile
 
This will set strength to the value in variable desiredAmnt after one frame. The following script however would need an undetermined amount of frames to do this, because the if condition is only called once each frame:
 
if(getStrength < desiredAmnt) ; non-literal value to match
  modStrength 1
endif
 
On the other hand the first example can potentially cause "freezing" (if the value would be very high) while the second won't.
Note that this is a workaround for some functions to the problem of functions not accepting non-literal values (variables) as arguments.