PolledWait or TriggerSleepAction?

luorax

Invasion in Duskwood
Reaction score
67
As the title says, i have a question: Which is better? And why?
-Calling PolledWait( x.x ) or,
-Calling TriggerSleepAction( x.x )?

Thanks in advance.
 

AoW_Hun7312

I'm a magic man, I've got magic hands.
Reaction score
76
I suggest you avoid both and use timers instead, as they're more accurate.

EDIT: FML.
 

Jedi

New Member
Reaction score
63
TriggerSleepAction and PolledWait both can't be less than 0.10

TriggerSleepAction doesn't pause when a player about to disconnet(waiting for player message)

Use PolledWait because of the above reason.
 

Ashlebede

New Member
Reaction score
43
PolledWait is, indeed, actual game-time. TriggerSleepAction uses only your computer and may be asynchronous and doesn't pause when the game is paused. The best solution, however, is timers.

Minimum for TriggerSleepAction is around .27 secs. No idea for polled wait, but it seems to be the same.
 

luorax

Invasion in Duskwood
Reaction score
67
I just replaced my about 200 lines with TriggerSleepAction >.<

Then i wait some more answers before edit it again, i don't want to edit it after every post (and because it's quite far from release... :D)

EDIT: For periodic events, periodic triggers (For example my hp/mana regen aura trigger... I had to make one to work with my combat-text system) etc i use timers, of course. But my "Arena System" (It's a mortal kombat map, and having a simple "sub-zero" a "sub-zero wins" a "sub-zero wins. flawless victory", and 2 "sub-zero wins. Flawless victory, fatality/brutality (And maybe an animality and babalitiy..) takes much-much space.. so i uses simple sounds, and test the unit's status, and play correct sounds) contains a lot of waits.
 

Laiev

Hey Listen!!
Reaction score
188
use periodic triggers/timer... is much better then any other wait

also you decide when stop the timer and if u will stop it :p
 

tooltiperror

Super Moderator
Reaction score
231
Minimum for TriggerSleepAction is around .27 secs. No idea for polled wait, but it seems to be the same.

That's a myth.

And don't be that afraid of PolledWait. You don't have to use Timers all the time. For example, if you make an -RD Mode in your map precision won't matter if you want to rest a few seconds between picking players.
 

tooltiperror

Super Moderator
Reaction score
231
Well, according to Aceheart and Ghan, it's not, so I recommend not believing it :)
 

luorax

Invasion in Duskwood
Reaction score
67
Well, thank the answers.
I think, I'll use the PolledWait. And of course for periodic event timers.
 

Ashlebede

New Member
Reaction score
43
That's a myth.

And don't be that afraid of PolledWait. You don't have to use Timers all the time. For example, if you make an -RD Mode in your map precision won't matter if you want to rest a few seconds between picking players.

Why would the minimum wait for a [ljass]PolledWait()[/ljass] be any shorter? It even uses [ljass]TriggerSleepAction()[/ljass] in its source code...

JASS:
//===========================================================================
// We can&#039;t do game-time waits, so this simulates one by starting a timer
// and polling until the timer expires.
function PolledWait takes real duration returns nothing
    local timer t
    local real  timeRemaining

    if (duration &gt; 0) then
        set t = CreateTimer()
        call TimerStart(t, duration, false, null)
        loop
            set timeRemaining = TimerGetRemaining(t)
            exitwhen timeRemaining &lt;= 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 &gt; 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


See? A loop with [ljass]TriggerSleepAction()[/ljass]'s in it (.1 seconds each, so that's about .25). How is that any shorter than just using a [ljass]TriggerSleepAction()[/ljass]?

Edit : And what the hell is -rd mode?
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
JASS:
//===========================================================================
// We can&#039;t do game-time waits, so this simulates one by starting a timer
// and polling until the timer expires.
function PolledWait takes real duration returns nothing
    local timer t
    local real  timeRemaining

    if (duration &gt; 0) then
        set t = CreateTimer()
        call TimerStart(t, duration, false, null)
        loop
            set timeRemaining = TimerGetRemaining(t)
            exitwhen timeRemaining &lt;= 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 &gt; 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


See? A loop with [ljass]TriggerSleepAction()[/ljass]'s in it (.1 seconds each, so that's about .25).

It's only 0.10 seconds if the original wait has 1 second remaining. It's being multiplied by the timeRemaining, in order to get 10% of the original time, not to wait 0.10 seconds in any form.

While there is no real limit for the TriggerSleepAction, it is very unreliable for small wait periods. People report the time limit being '0.27' because '0.10' to '0.30' are close to the lowest values they can get in tests.

In actuality, for any wait period it is very inaccurate, and will often be too long. PolledWait was created for accurate time in cinematics, not to try to be used for low period waits. It's

If you want extreme accuracy, use a timer.
 

Ashlebede

New Member
Reaction score
43
It's only 0.10 seconds if the original wait has 1 second remaining. It's being multiplied by the timeRemaining, in order to get 10% of the original time, not to wait 0.10 seconds in any form.

While there is no real limit for the TriggerSleepAction, it is very unreliable for small wait periods. People report the time limit being '0.27' because '0.10' to '0.30' are close to the lowest values they can get in tests.

In actuality, for any wait period it is very inaccurate, and will often be too long. PolledWait was created for accurate time in cinematics, not to try to be used for low period waits. It's

If you want extreme accuracy, use a timer.

That's what I meant ; both should have the same time "minimum", since they are both based on the [ljass]TriggerSleepAction()[/ljass]. So why did tooltip say that the fact that [ljass]PolledWait()[/ljass] has the same "minimum" waiting time as [ljass]TriggerSleepAction()[/ljass] was a myth?
 

tooltiperror

Super Moderator
Reaction score
231
You keep showing that you are horrible at reading posts correctly.

I said that TriggerSleepAction only being reliable at times over .27 is a myth.
 

Ashlebede

New Member
Reaction score
43
Then it seems I didn't understand what you meant because you didn't understand what I meant. ^_^

What I meant by "Minimum" was the (let's say approximate) minimum pause time of a [ljass]TriggerSleepAction()[/ljass], even with a [ljass].00001[/ljass] parameter.
 

tooltiperror

Super Moderator
Reaction score
231
I'm saying that if you use [LJASS]TriggerSleepAction(.02)[/LJASS] it may wait for .02 seconds. However, it is just as reliable at any time. The chance of [LJASS]TriggerSleepAction(5.00)[/LJASS] waiting for five seconds and [LJASS]TriggerSleepAction(.26)[/LJASS] waiting for .26 seconds is the same. You just don't seem to understand this.
 

Laiev

Hey Listen!!
Reaction score
188
The game randomly selects a bunch of heros, which are "put into" two taverns. In turns, the teams will select characters.

E.g.

First it's Team1 turn to pick 1 hero. Blue will have 20 seconds to select his hero.
Then pink and grey will have 20 secs to pick a hero. And so on.
Team1 1 - Team2 2 - Team1 2 - Team2 2 - Team1 2 - Team2 1
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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 The Helper:
    I think we need to add something to the bottom of the front page that shows the Headline News forum that has a link to go to the News Forum Index so people can see there is more news. Do you guys see what I am saying, lets say you read all the articles on the front page and you get to the end and it just ends, no kind of link for MOAR!
  • The Helper The Helper:
    Happy Wednesday!
    +1

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top