Difference between revisions of "WD2 ScriptHook: Events"

From Nomad DB
Line 1: Line 1:
 
[[WD2 ScriptHook: Script|Scripts]] can listen to Events. You should be familiar with the concept of [[WD2 ScriptHook: Script Table|Script Tables]] in order to follow this guide.
 
[[WD2 ScriptHook: Script|Scripts]] can listen to Events. You should be familiar with the concept of [[WD2 ScriptHook: Script Table|Script Tables]] in order to follow this guide.
 +
 +
* [[WD2 ScriptHook: Events|ScriptHook Events]]
 +
* [[WD2 Lua Events|Game Event]]
  
 
== ScriptHook Events ==
 
== ScriptHook Events ==
Line 14: Line 17:
 
end
 
end
 
</syntaxhighlight>
 
</syntaxhighlight>
 
== Game Events ==
 
To-Do
 
  
 
== Related Pages ==
 
== Related Pages ==

Revision as of 15:06, 15 April 2020

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.

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

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

Related Pages