Difference between revisions of "WDL ScriptHook: Events"

From Nomad DB
(Created page with "{{Page_WDL}} Scripts can listen to Events. You should be familiar with the concept of Script Tables in order to fol...")
 
 
(3 intermediate revisions by the same user not shown)
Line 16: Line 16:
 
function script:OnUnload()
 
function script:OnUnload()
 
print("OnUnload")
 
print("OnUnload")
end
 
 
function script:OnUnload(time, dt)
 
-- time = Game Time
 
-- dt = Delta Tiem
 
 
end
 
end
  
Line 31: Line 26:
  
 
*[[Event: Script:OnUpdate|OnUpdate]]
 
*[[Event: Script:OnUpdate|OnUpdate]]
 +
*[[Event: Script:OnInputKey|OnInputKey]]
 +
*[[Event: Script:OnInputMouseButton|OnInputMouseButton]]
 +
*[[Event: Script:OnRenderImGui|OnRenderImGui]]
  
 
==Related Pages==
 
==Related Pages==
Line 36: Line 34:
 
*[[WDL ScriptHook: Script Table]]
 
*[[WDL ScriptHook: Script Table]]
 
*[[WDL ScriptHook: Rendering]]
 
*[[WDL ScriptHook: Rendering]]
 +
*[[Lua: ImGui]]
  
 
[[Category:WDL ScriptHook]]
 
[[Category:WDL ScriptHook]]

Latest revision as of 20:43, 19 December 2021

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:OnRender()
    print("OnRender")
end

Game Events

Related Pages