Warcraft 3 documentation
vJASS & Zinc Documentation
For the latest documentation about how it works vJASS and Zinc language layers for Warcraft III, please follow these links:
Jasshelper documentation - Zinc documentation - WC3 Optimizer documentation
This topic is the discussión abut the function TriggerSleepAction. You can see all the information about this function keyword HERE.

[functions] TriggerSleepAction No New Posts Jassdoc

Started by
City17

0 Members and 1 Guest are viewing this topic.

[functions] TriggerSleepAction
on: February 26, 2022, 06:44:07 PM

pauses the current execution thread, sleeps for timeout of real-time seconds and resumes execution where this function was called. You may only use this inside trigger actions!

The timeout timer has a granularity of 10Hz, this means you can only sleep in 100ms intervals at best (1000ms/10 = 100ms). Timeout of 0 also sleeps for 100ms. Timeouts -120 < x < 0 are the same as 0. Timeouts <=-120 abort further execution.

Quote from: WorldEdit help text
The duration of this wait is specified in real-time seconds.
Therefore the game speed does not affect this timeout. Reforged (v1.32.10): Pausing the game also pauses the ticking of the timeout.

The behavior is similar to coroutines in Lua, this principle is called cooperative multitasking where you hand off control of the execution thread and it is returned to you at a later time.

See: PolledWait for sleeps in game-time seconds.

Example (Lua):
Code: Lua
  1. local secretWord = "please"
  2. DisplayTextToPlayer(Player(0), 0, 0, "Current time is: ".. os.date())
  3. TriggerSleepAction(10) -- sleeps for 10 seconds
  4. DisplayTextToPlayer(Player(0), 0, 0, "After sleep the time is: ".. os.date() .." and the secret word is: ".. secretWord)
« Last Edit: February 27, 2022, 02:03:38 PM by moyack »



 

Started by moyack

Replies: 3
Views: 4140
Jassdoc

Started by Jedi

Replies: 5
Views: 14732
General Jass Discussion

Started by moyack

Replies: 40
Views: 58276
Jass Theory & Questions

Started by moyack

Replies: 0
Views: 598
Jassdoc

Started by moyack

Replies: 0
Views: 594
Jassdoc
Vivir aprendiendo.co - A place for learning stuff, in Spanish   Chaos Realm - The world of Game modders and wc3 addicts   Diplo, a gaming community   Power of Corruption, an altered melee featuring Naga and Demon. Play it now!!!   WC3JASS.com - The JASS Vault + vJASS and Zinc   Jetcraft - A Starcraft II mod   WormTastic Clan (wTc)   Warcraft RESOURCES Reforged: Modelos, mapas, proyectos y mas...