EventScripts version: 2.0
Table of Contents
This module lets you execute things later within the primary gamethread. It provides access to queues and delayed command management such that you can interact safely with the server from external threads.
import es import gamethread def myfunc(text): es.msg(text) def player_say(event_var): # this causes myfunc() to be called in 0.1 seconds gamethread.delayed(0.1, myfunc, "Hello world")
No public classes.
gamethread.delayed(seconds, cmd, args=(), kw=None)
Delay a Python function for seconds seconds.
gamethread.delayedname(seconds, name, cmd, args=(), kw=None)
Delay a Python function for seconds seconds. By naming the delayed function, you can cancel it by that name later with gamethread.cancelDelayed()
Cancel a pending delayed Python function that was started with gamethread.delayedname()
Prints to stdout a list of all pending delayed commands.
gamethread.queue(function, a=(), kw=None)
Queue a Python command to run at the very next opportunity during the server's main thread (typically during a GameFrame). Useful for other threads to execute commands on the next gameframe since the Source engine is not thread-safe.