1. Triumph has risen from these uncharted shores. The 34th Modeling Contest Results are out!
    Dismiss Notice
  2. Awaken what lies in the heart of your swarm. The 17th Techtree Contest has arrived!
    Dismiss Notice
  3. The Hive Workshop is launching its first HD modelling contest. How HD should it be?
    Dismiss Notice
  4. Check out the Staff Job Openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Lua] Perfect PolledWait (GUI-friendly)

Discussion in 'Submissions' started by Bribe, Jul 7, 2019.

  1. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,212
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    That's actually a really good idea. I'll upload a demo map later which introduces a udg_ThreadIndex global variable so users can store such data into an array. I'll recycle the index like with vJass structs.
     
  2. El Saif

    El Saif

    Joined:
    Dec 25, 2014
    Messages:
    100
    Resources:
    0
    Resources:
    0
    I tried to copy both this and TimerUtils but always got missing endblock error, why is that?
     
  3. Daffa

    Daffa

    Joined:
    Jan 30, 2013
    Messages:
    8,001
    Resources:
    31
    Packs:
    1
    Maps:
    9
    Spells:
    18
    Tutorials:
    3
    Resources:
    31
    Is your map set to LUA?
     
  4. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,212
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    Echoing this - the map definitely is still thinking your script uses JASS. The endblock error is not encountered in a Lua-scripted map.
     
  5. Troll-Brain

    Troll-Brain

    Joined:
    Apr 27, 2008
    Messages:
    2,412
    Resources:
    1
    JASS:
    1
    Resources:
    1
    Code (Text):
        local oldTSA = TriggerSleepAction
        function TriggerSleepAction(duration) PolledWait(duration) end
    Unless i missunderstand or miss something you're breaking the main feature of TSA, which is to continue to expire while game is paused, unlike timers
     
  6. HerlySQR

    HerlySQR

    Joined:
    Jun 26, 2020
    Messages:
    829
    Resources:
    0
    Resources:
    0
    Question, I heard the normal wait have a risk of desync, does this code solve that?
     
  7. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,212
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    I'm pretty sure that some of my Lua scripts ree not multiplayer-friendly because the handles have different values across different players.
     
  8. HerlySQR

    HerlySQR

    Joined:
    Jun 26, 2020
    Messages:
    829
    Resources:
    0
    Resources:
    0
    Ok, that's bad
     
  9. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    2,880
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    I don't see GetHandleId in this at all though.
     
  10. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,212
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    It's in the TimerUtils script where I use the object itself as an index in a Lua table and I was told that that could be asynchronous.
     
  11. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    2,880
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    That should be fine as long as you aren't iterating over the table or anything.
     
  12. HerlySQR

    HerlySQR

    Joined:
    Jun 26, 2020
    Messages:
    829
    Resources:
    0
    Resources:
    0
    At the end, yes or not are a risk of desync?
     
  13. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,212
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    TriggerHappy doesn't seem to think so, but I've never tested it
     
  14. HerlySQR

    HerlySQR

    Joined:
    Jun 26, 2020
    Messages:
    829
    Resources:
    0
    Resources:
    0
    I was wating the @TriggerHappy's answer to be sure, but I think I have to write this to call him.
     
    Last edited: Feb 11, 2021
  15. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    2,880
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    I don't see anything wrong with it.
     
  16. HerlySQR

    HerlySQR

    Joined:
    Jun 26, 2020
    Messages:
    829
    Resources:
    0
    Resources:
    0
    So it is ok?
     
  17. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    2,880
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    You will have to test it.
     
  18. HerlySQR

    HerlySQR

    Joined:
    Jun 26, 2020
    Messages:
    829
    Resources:
    0
    Resources:
    0
    But is a probability, how much have I to test to be sure?