HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Waits and Battle.net?

02-16-2004, 05:07 AM#1
Narwanza
While making custom spells for the heros on my TD I have run into a problem that is really annoying. Say I wanted to create special effects in a line that correspond with a wave going along. Well, in order to get the right effect I have to put some wait in there even if it is a 0.000... wait. The problem is, that over battle.net, everything is slow because of internet lag time. Is there anyway I can work around this. I know TOB did it becuase their crimson wake works smoothly over battle.net, whereas my rendition of it is slowed horribly over battle.net. Please help if you can.
02-16-2004, 08:43 AM#2
Cubasis
Hmm...

Well, i'll share a old revelation....
You can't "wait" less than 0.25 seconds .... Everything less than 0.25 seconds in a wait-action waits for cirka 0.25 seconds... That's especially annoying when creating intence cinematics. A few notice this as the humans sense of time sucks, 0.25 and 0.1 both pass too quickly to notice (that's what tests are for).

(Note: DataAngel found out that waiting exactly 0.00 time seems to wait less time than 0.25, although it's duration is kinda unprecise)

However... The only way you can wait less than this.... is to use a Periodic Timer .... And to use a periodic timer, you preferably also need to be working in jass (to be able to easily create periodic triggers on the spot to do what you want) AND...be storing stuff in variables/cache. So this can be a payne... But with periodics, you can wait everywhere from 0.0000000001, too 0.24991 seconds (well, almost).

Those are you options..... or.... just rethink your triggers, i bet you can recreate it to be smarter and with more performance.

However, i do not know the environment of your problem, so i could not know.

Cubasis
02-16-2004, 09:00 AM#3
Earth-Fury
polled wait. throgh lag it wont harm the effect too much. it may be a sec late starting up (as in ToB) but polled wait should work fine
02-16-2004, 03:25 PM#4
Narwanza
Polled wait will not work, and since I am acquainted with JASS I will use a periodic timer I think. Thanks Cubasis40.

[edit] I was looking at the API for timers and got kind of lost. I realize how to create a timer and how to start it, but how do I tell it to "wait" inside the trigger without having to create a new trigger with the event, TimerX expires?
02-16-2004, 03:55 PM#5
weaaddar
Periodic fooy.

Heres how I wait a specified amount of time
local timer t=CreateTimer()
... (actions before the wait)
call StartTimer(t,duration,false, function func_thathasactions)
... (rest of your actions that don't care about the duration of this wait)
call TriggerSleepAction(duration) //wait long enough for the duration to pass
call DestroyTimer(t) //now its safe to destroy it.
endfunction
Unfortuantly you'll need to pass with globals or threadspecific vars (see the vault) to this timer child function. Periodics is plain sloppy.
02-16-2004, 05:18 PM#6
Narwanza
I'm sorry if I am just sounding stupid, but I want it to run a loop with a wait in it. I want the wait to be under .25 seconds though or else my effect is screwed. So would I just implement that into the loop and then every time it ran the loop it would wait the duration. Say even if the duration was .01? I think I will only need it to be at .1, but it can't be at .25.
02-17-2004, 09:00 PM#7
Narwanza
Would your way work on battle.net weaaddar? Both of you have told me how to get a smaller wait, but that is not the problem, the problem is that when the map is played over bnet it slows the wait way down.