1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The raddest synthwave tracks were chosen - Check out our Music Contest #12 - Results and congratulate the winners!
    Dismiss Notice
  4. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  5. Travel to distant realms and encounter scenes unknown to the common folk. The Greatest of Adventures is upon us with the 8th Cinematic Contest. Join in on a fun ride.
    Dismiss Notice
  6. The 18th Icon Contest is ON! Choose any ingame unit and give him/her Hero abilities. Good luck to all.
    Dismiss Notice
  7. Contestants are to create a scene set in the Stone Age. Come and see what you can come up with. We wish you the best of luck!
    Dismiss Notice
  8. Colour outside the lines! Techtree Contest #13 is a go. The contest is optionally paired.
    Dismiss Notice
  9. Greetings cerebrates, our Swarm needs new spawners that will have numerous children. Join the HIVE's 31st Modeling Contest - Spawners and Spawned! The contest is optionally paired.
    Dismiss Notice
  10. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[JASS] call TriggerSleepAction (?)

Discussion in 'Triggers & Scripts' started by Legal_Ease, Apr 25, 2016.

  1. Legal_Ease

    Legal_Ease

    Joined:
    Feb 8, 2013
    Messages:
    1,455
    Resources:
    28
    Icons:
    11
    Packs:
    1
    Skins:
    2
    Maps:
    10
    Template:
    1
    Tutorials:
    3
    Resources:
    28
    I need this:

    • Custom script: call TriggerSleepAction (217.00)


    ...to wait 2 minutes and 17 seconds.

    Is this the proper syntax?

    I am concerned that the decimal is wrong. and it will play at 217 seconds, which is close, but not what I want.

    Also, is there a better way to loop a theme music sound? If so, then I don't need to call sleep.
     
  2. pred1980

    pred1980

    Joined:
    Mar 19, 2010
    Messages:
    844
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Use Timers!
     
  3. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,165
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    It's proper syntax, but it is exactly the same was Wait action in GUI, so GUI could be used.
    Also, you might have wanted to write 137, as a minute has 60 seconds. ;p
     
  4. Legal_Ease

    Legal_Ease

    Joined:
    Feb 8, 2013
    Messages:
    1,455
    Resources:
    28
    Icons:
    11
    Packs:
    1
    Skins:
    2
    Maps:
    10
    Template:
    1
    Tutorials:
    3
    Resources:
    28
  5. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,659
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    If you want to wait 2 minutes and 17 seconds it would be
    TriggerSleepAction(137)


    You should be using a timer like Ice said though.
     
  6. Arad MNK

    Arad MNK

    Joined:
    Dec 11, 2014
    Messages:
    1,889
    Resources:
    3
    Maps:
    2
    Spells:
    1
    Resources:
    3
    Waits are horrible. Best advice I can give you.
    Waits are so inaccurate, they wait like 0.27 more than the given value.
    Timers, on the other hand, are very accurate.

    You might want to learn how to use
    TimerStart(CreateTimer(), false, 5., function MyFunc) // AFAIR these were the parameters
     
  7. Meatmuffin

    Meatmuffin

    Joined:
    Jul 25, 2014
    Messages:
    455
    Resources:
    9
    Maps:
    2
    Spells:
    7
    Resources:
    9
    Switch timeout with boolean and it's fine.
     
  8. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,653
    Resources:
    3
    Spells:
    3
    Resources:
    3
    I dont really think you are understanding what you are doing.

    Bribe will never (ever) recommend someone to use TriggerSleepAction() if it is not about clearing local data.
    What he does is simply ending the current function and creating a new one that runs by a timer...
    So this cannot be used in a lot of circumstances and will not allow you to use local variables properly.

    So to sum it up:
    1, Bribe did not recommend you to use TriggerSleepAction().
    2, It is better to use timers.
    3, Waits are still horrible, but you can use them because you wouldnt really care about the inaccuracy... except if you want that map to work in multiplayer, then
    4, You have to use timers instead.
     
  9. Legal_Ease

    Legal_Ease

    Joined:
    Feb 8, 2013
    Messages:
    1,455
    Resources:
    28
    Icons:
    11
    Packs:
    1
    Skins:
    2
    Maps:
    10
    Template:
    1
    Tutorials:
    3
    Resources:
    28
    Hey, thanks for the summary. Well put. I think I get it now. I am using them in a single player map to play music every 2 minutes. Accuracy doesn't seem like an issue, but I will try to avoid them as often as possible. Bribe's tutorial is about
    Code (vJASS):
    //! runtextmacro SleepAction("0.0", "1")
    I didn't notice the difference at first, but now I get it.