6
« Last post by =Mindee= on December 21, 2025, 10:53:24 am »
Methods Part 4
script.RunEvent('eventName', delay)
- Runs event/method after delay.
For example if you have function "def doStuff():", you can use this to run it after delay like that: script.RunEvent('doStuff', 1000)
Delay is in milliseconds. 1000 = 1 second.
script.RunEvent('doStuff', 0) is same as just calling doStuff().
script.RunEventEx('eventName', variable, delay)
- Runs event/method after delay with variable included.
For example if you have function "def doStuff(itemId):", you can use this to run it after delay like that: script.RunEventEx('doStuff', 1234, 1000)
Delay is in milliseconds. 1000 = 1 second.
script.RunEventEx('doStuff', 1234, 0) is same as just calling doStuff(1234).
Variable can be any type.
script.RunRepeatingEvent('eventName', interval)
- Runs event/method every interval until you cancel it or disable the script.
For example if you have function "def doStuff():", you can use this to run it in intervals like that: script.RunRepeatingEvent('doStuff', 1000)
Interval is in milliseconds. 1000 = 1 second.
script.RunRepeatingEventEx('eventName', variable, startDelay, interval)
- Runs event/method after startDelay with variable included and then repeats it every interval until you cancel it or disable the script.
For example if you have function "def doStuff(itemId):", you can use this to run it every interval like that: script.RunRepeatingEventEx('doStuff', 1234, 1000)
Delay is in milliseconds. 1000 = 1 second.
Variable can be any type.
script.RunEventAt(tab_id, event_name, delay)
- Runs event by name on specified tab with delay. 0 delay = instant.
- Script on specified tab must contain the event in the script box and script must be enabled on that tab.
- Returns "OK" on execution or an error text.
Example:
Tab1:
def onScriptActivation():
script.RunEventAt(2, 'sayHello', 0)
Tab2:
def sayHello():
script.Say('Hello world!')
script.CancelEvent("eventName")
- Cancels scheduled event by name.
- Returns "[not_found]", "[failed]" or "[ok]" result.
script.CancelAllEvents()
- Cancels all scheduled and running events.
- Returns number of events cancelled.