Difference between revisions of "Event Handler"

From Legends of Aria Admin and Modding Wiki
Jump to: navigation, search
Line 10: Line 10:
  
 
<code>mEvent</code> can be one of the following events:
 
<code>mEvent</code> can be one of the following events:
  EventType.LoadedFromBackup
+
  EventType. + LoadedFromBackup, .Destroyed, .CreatedObject, .ModuleAttached
EventType.Destroyed
+
  .Timer, .Message, .EnterView, .LeaveView, .RequestPickUp, .RequestDrop
  EventType.CreatedObject
+
  .RequestEquip, .ContainerItemAdded, .ContainerItemRemoved, .ItemEquipped
  EventType.ModuleAttached
+
  .ItemUnequipped, .StartMoving, .Arrived, .Use, .PlayerSpeech
  EventType.Timer
+
  .ClientUserCommand, .ClientObjectCommand, .ClientTargetAnyObjResponse
  EventType.Message
+
  .ClientTargetGameObjResponse, .ClientTargetLocResponse, .ContextMenuResponse
  EventType.EnterView
+
  .DynamicWindowResponse, .UserLogout,  .GlobalVarUpdateResult
  EventType.LeaveView
+
 
  EventType.RequestPickUp
+
Example:
  EventType.RequestDrop
+
<syntaxhighlight lang="lua">
  EventType.RequestEquip
+
RegisterEventHandler(EventType.Timer, "MyCoolestTimer", HandleTick)
  EventType.ContainerItemAdded
+
</syntaxhighlight>
  EventType.ContainerItemRemoved
+
 
  EventType.ItemEquipped
+
 
  EventType.ItemUnequipped
 
  EventType.StartMoving
 
  EventType.Arrived
 
  EventType.Use
 
  EventType.PlayerSpeech
 
  EventType.ClientUserCommand
 
  EventType.ClientObjectCommand
 
  EventType.ClientTargetAnyObjResponse
 
  EventType.ClientTargetGameObjResponse
 
  EventType.ClientTargetLocResponse
 
  EventType.ContextMenuResponse
 
  EventType.DynamicWindowResponse
 
  EventType.UserLogout
 
EventType.GlobalVarUpdateResult
 
  
 
[[Category:Drafts]]
 
[[Category:Drafts]]

Revision as of 16:36, 1 November 2016

DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT

An Event Handler is a function registered in a special way to be called when certain things (events) happen.

Official Events Documentation: [Events]

  • Registering a function as Event Handler in its general abstract form is:
RegisterEventHandler( (EventType)mEvent, (string)mEventIdentifier, (function)mEventHandler) 

mEvent can be one of the following events:

EventType. + LoadedFromBackup, .Destroyed,  .CreatedObject,  .ModuleAttached,  
.Timer,  .Message,  .EnterView,  .LeaveView,  .RequestPickUp,  .RequestDrop,  
.RequestEquip,  .ContainerItemAdded,  .ContainerItemRemoved,  .ItemEquipped,  
.ItemUnequipped,  .StartMoving,  .Arrived,  .Use,  .PlayerSpeech,  
.ClientUserCommand,  .ClientObjectCommand,  .ClientTargetAnyObjResponse,  
.ClientTargetGameObjResponse,  .ClientTargetLocResponse,  .ContextMenuResponse,  
.DynamicWindowResponse,  .UserLogout,  .GlobalVarUpdateResult

Example:

RegisterEventHandler(EventType.Timer, "MyCoolestTimer", HandleTick)