WDL ScriptHook: Events

From Nomad DB
Revision as of 21:51, 14 April 2021 by Administrator (talk | contribs) (Created page with "{{Page_WDL}} Scripts can listen to Events. You should be familiar with the concept of Script Tables in order to fol...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Scripts can listen to Events. You should be familiar with the concept of Script Tables in order to follow this guide.

ScriptHook Events

ScriptHook provides a couple of Events that can be used within Scripts. These event listeners are functions in the Script Table. The most important ones are the OnLoad and OnUnload events. For rendering onto the Screen, OnRender can be used.

local script = Script()
function script:OnLoad()
	print("OnLoad")
end

function script:OnUnload()
	print("OnUnload")
end

function script:OnUnload(time, dt)
	-- time = Game Time
	-- dt = Delta Tiem
end

function script:OnRender()
    print("OnRender")
end

Game Events

Related Pages