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 Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. 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,181
    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,667
    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:
    454
    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.