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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top