- Joined
- Oct 31, 2008
- Messages
- 229
Heres my first jass function and doesn't leak. Deep within me i always loved jass but preferes GUI instead for some reason
JASS:
function Forloopnew takes real A, real B, real Step returns nothing
//This function, is a normal "for-loop" function, not the stuff blizzard provides with WE.
//Takes real A, real B and step and you may ad a function in it
//(be sure to add the script twice. And yes. I know there is a better way
//but is not bd for first time dnt you think?
//It can work with reals, have negative ending values
//skips infinite loops and all that.
local real i = A
if Step > 0 then
loop
exitwhen i > B
call DisplayTextToPlayer (Player(0),0,0,R2S(i))//Or whatever you wan't
set i = i + Step
endloop
endif
if Step < 0 then
loop
exitwhen i < B
call DisplayTextToPlayer (Player(0),0,0,R2S(i))//Excactly as above
set i = i + Step
endloop
endif
if Step == 0 then
call DisplayTextToPlayer (Player(0),0,0,"Internal looprun step == 0")
endif
//Mine first jass script (lol)
endfunction