Two questions

WayTooShort

New Member
Reaction score
4
1. Is it possible for two handles to have same ID? If so, what is the chance of this happening? If it's not possible, can the map run out of unused IDs?

2. Is there a way using timers (or something alike) in the place of waits? Something that is much more accurate than the TriggerSleepAction, but also works without having to continue the actions in an another function (like in TimerStart) so that the same locals can be used after the pause?
 

emjlr3

Change can be a good thing
Reaction score
395
  • i don't think they can, but I have heard of handles being lost, or overwritten, or corrupted in someway, which was part of the timer bug that was circumvented with timerutils. I have never heard of a map running out of handle ids. And I have heard of some massive maps before
  • I remember something along these lines from a while back, but can't quite put my finger on it - I heard about it over at WC3C some time ago - it worked with timers though, just had similar syntax to sleeps. Overall though timers work fine, especially now with vJASS allowing private scope members.

sleeps are fairly accurate, just not under .25s or so. it really depends on your needs.

do you need to wait about 60s, or do you need to periodically do something every .05s?
 

chobibo

Level 1 Crypt Lord
Reaction score
48
@emjlr3
Sup dude, haven't seen(read) you for a long time.
---- END ----

On-topic:

1. i don't think they can, but I have heard of handles being lost, or overwritten, or corrupted in someway, which was part of the timer bug that was circumvented with timerutils. I have never heard of a map running out of handle ids. And I have heard of some massive maps before

Triggers with TriggerActions that has a TriggerSleepAction(TSA) followed by another TSA followed by a DestroyTrigger, will cause the handle stack to get corrupted.

TSAs still countdown while the game is paused, thus the need for the PolledWait function. Use TSAs carefully, you don't need to avoid them.
 

WayTooShort

New Member
Reaction score
4
Thanks for the answers.

The reason I can't use TriggerSleepAction is that I have a spell which actions are timed on the caster's casting animation, and it needs to be extremely precise to not look stupid (tried and failed with TSA).. It has 7 different intervals, some of them are shorter than 0.2 and some are a bit longer. I was just wondering if there is an easy way to do this accurately, without having to use 7 different functions and a hashtable?
 

Solmyr

Ultra Cool Member
Reaction score
30
I believe that emjlr3 was talking about this. It's like an immense textmacro abuse, but you may find it useful, as long as "accurate waits" are what you want.

EDIT: Be sure to read it thoroughly as those textmacros are ugly.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
1. Is it possible for two handles to have same ID? If so, what is the chance of this happening? If it's not possible, can the map run out of unused IDs?
Someone with more in-depth knowledge of WC3 ought to confirm (Bribe? J4L? Vexorian?) but I believe this can happen if the handle stack gets corrupted (for one example of how, see chobibo's post). AFAIK, this will never happen on its own, only if there is a problematic script.

2. Is there a way using timers (or something alike) in the place of waits? Something that is much more accurate than the TriggerSleepAction, but also works without having to continue the actions in an another function (like in TimerStart) so that the same locals can be used after the pause?
Not really. Using a timer system (there are several available) so you can attach your data to it will make things easier.
 

Jedi

New Member
Reaction score
63
Triggers with TriggerActions that has a TriggerSleepAction(TSA) followed by another TSA followed by a DestroyTrigger, will cause the handle stack to get corrupted.

TSAs still countdown while the game is paused, thus the need for the PolledWait function. Use TSAs carefully, you don't need to avoid them.

I will test what you said first.

Second is a greaaaaaat lie.TriggerSleepAction only counts when game is paused by triggers, or while a player disconnecting.It stops with normal pause(open menu in single player or pause game with f10 while playing multiplayer)
 

tooltiperror

Super Moderator
Reaction score
231
Uh, reference post?

When using [LJASS]TriggerSleepAction[/LJASS]...
  1. If the game is paused through the "Pause Game" menu item, the countdown will pause.
  2. If a player is lagging in Multiplayer and the game is paused, the countdown will continue.
  3. Executing [LJASS]PauseGame(true)[/LJASS] will pause the countdown.

Some other fun trivia:
  1. The "inaccurate below 27 seconds" argument is completely invalid. No one is sure the exact point it becomes inaccurate.
  2. Calling it TriggerSleepAction is unfashionable. Call it TSA to be cool.
  3. Using TriggerSleepAction in a boolexpr kills that thread (citation needed)
  4. Using [LJASS]PolledWait[/LJASS] is also risky like TSA because it occasionally calls TSA.
 

emjlr3

Change can be a good thing
Reaction score
395
(PW)but is reliant on a timer elapsing, which doesn't carry the TSA pause based issues

for more, look at my Spell Contest 4 submission, which abuses a timer to manipulate animations correctly
 

chobibo

Level 1 Crypt Lord
Reaction score
48
I will test what you said first.

Second is a greaaaaaat lie.TriggerSleepAction only counts when game is paused by triggers, or while a player disconnecting.It stops with normal pause(open menu in single player or pause game with f10 while playing multiplayer)

[del]Test map please.[/del]
I tested it myself, I stand corrected. Oh, and I'm sorry if you think I was lying, I was mistaken.

EDIT 2: I found the Destroy Trigger bug (the one that corrupts the handle stack), here's the link to a script that reproduces it. I made a mistake, destroying the trigger needs to be first, the correct sequence is: destroy trigger -> tsa 0 -> tsa 0.
 

tooltiperror

Super Moderator
Reaction score
231
[LJASS]PolledWait[/LJASS] doesn't use TSA? Oh.

JASS:
function PolledWait takes real duration returns nothing
    local timer t
    local real  timeRemaining

    if (duration > 0) then
        set t = CreateTimer()
        call TimerStart(t, duration, false, null)
        loop
            set timeRemaining = TimerGetRemaining(t)
            exitwhen timeRemaining <= 0

            // If we have a bit of time left, skip past 10% of the remaining
            // duration instead of checking every interval, to minimize the
            // polling on long waits.
            if (timeRemaining > bj_POLLED_WAIT_SKIP_THRESHOLD) then
                call TriggerSleepAction(0.1 * timeRemaining)
            else
                call TriggerSleepAction(bj_POLLED_WAIT_INTERVAL)
            endif
        endloop
        call DestroyTimer(t)
    endif
endfunction
 

Sevion

The DIY Ninja
Reaction score
413
Simply, why don't we just use a damn timer.

Sure there'll be a lot of functions and you'll need a timer per instance, but it's better than having TSA/PolledWait and its inaccuracies.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top