HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

neat lil loop trick

06-02-2004, 08:04 PM#1
-={tWiStÄr}=-
well im making a ton of trigger spells for my map and ive found a simple little trick to kinda make a periodic event through actions. you may have already known this but here it is
Code:
local integer i = 0
    loop
         exitwhen i > {time in seconds miliseconds whatever}
         {actions}
...
...
...
         TriggerSleepAction({1 unit of time your using})
         set i = i+1
    endloop 
its main purpose is too help you not have to use a trigger. i used it too check a condition every milisecond about and if it was true i would set "i" to the exitwhen condition. I dunno you may have known this it just helped me so much.
06-02-2004, 08:21 PM#2
johnfn
Hmm, thats a pretty good idea instead of using multiple triggers. One thing you might not want to do is have other actions in the loop because it might slow the loop down a small amount and thus rendering your timer loop ineffective.
06-02-2004, 09:17 PM#3
-={tWiStÄr}=-
ya but if you dont put other actions in its just a wait trigger. its for doing something over and over again with a lil time in between. i think it does slow it down alittle bit but what im using it for is a visual effect not timed so it doesnt have to be PERFECT.
06-02-2004, 09:25 PM#4
johnfn
Quote:
Originally Posted by -={tWiStÄr}=-
ya but if you dont put other actions in its just a wait trigger. its for doing something over and over again with a lil time in between. i think it does slow it down alittle bit but what im using it for is a visual effect not timed so it doesnt have to be PERFECT.
Ah, I see, sort of. This would work for slowing down your special effect...

...
Isn't the JASS for wait actually TriggerSleepAction ( # ) ?
06-02-2004, 09:34 PM#5
-={tWiStÄr}=-
Quote:
Originally Posted by johnfn
Ah, I see, sort of. This would work for slowing down your special effect...

...
Isn't the JASS for wait actually TriggerSleepAction ( # ) ?
lol.. yes it is... sorry bout that i havent done jass in a while. learning java so ill fix that.