Difference between revisions of "NDGIA"

From Legends of Aria Admin and Modding Wiki
Jump to: navigation, search
(Created page with "<center><p style="width: 60%">ABCDEFGHIJKLM...")
 
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
<center><p style="width: 60%">[[NDGIA|A]][[NDGIB|B]][[NDGIC|C]][[NDGID|D]][[NDGIE|E]][[NDGIF|F]][[NDGIG|G]][[NDGIH|H]][[NDGII|I]][[NDGIJ|J]][[NDGIK|K]][[NDGIL|L]][[NDGIM|M]][[NDGIN|N]][[NDGIO|O]][[NDGIP|P]][[NDGIQ|Q]][[NDGIR|R]][[NDGIS|S]][[NDGIT|T]][[NDGIU|U]][[NDGIV|V]][[NDGIW|W]][[NDGIX|X]][[NDGIY|Y]][[NDGIZ|Z]]</p></center>
+
<p style="width:60%;margin: 0 auto">[[NewDawnHome|[Main]]] [[NDServerIndexScriptsMain|[Lua Examples]]]</p>
 +
 
 +
<center><p style="width: 60%">[[NDGIA|A]] [[NDGIB|B]] [[NDGIC|C]] [[NDGID|D]] [[NDGIE|E]] [[NDGIF|F]] [[NDGIG|G]] [[NDGIH|H]] [[NDGII|I]] [[NDGIJ|J]] [[NDGIK|K]] [[NDGIL|L]] [[NDGIM|M]] [[NDGIN|N]] [[NDGIO|O]] [[NDGIP|P]] [[NDGIQ|Q]] [[NDGIR|R]] [[NDGIS|S]] [[NDGIT|T]] [[NDGIU|U]] [[NDGIV|V]] [[NDGIW|W]] [[NDGIX|X]] [[NDGIY|Y]] [[NDGIZ|Z]]</p></center>
 
<p style="color: #DDDD88;font-size: 22px;width:60%;margin: 0 auto">Global Functions & Examples</p>
 
<p style="color: #DDDD88;font-size: 22px;width:60%;margin: 0 auto">Global Functions & Examples</p>
 
<center>
 
<center>
 
{| class="wikitable" | style="width: 60%"
 
{| class="wikitable" | style="width: 60%"
 
|-
 
|-
|style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">AddView(EventId,Searcher,Frequency)</p>EventId - Event identifier for events<br>Searcher - Object searcher that defines the view<br>Frequency - Update frequency check in seconds. || The Frequency argument may be omitted, the View will default to 0.25 seconds. The minimum value of Frequency is 0.1 seconds.
+
|style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">AddView(eventid,searcher,frequency)</p>eventid - Event identifier for events<br>searcher - Object searcher that defines the view<br>frequency - Update frequency check in seconds. || The frequency argument may be omitted, the View will default to 0.25 seconds for the frequency. The minimum value of frequency is 0.1 seconds.
 
|}
 
|}
 
</center>
 
</center>
<p style="width: 60%;margin: 0 auto">Example of adding a module without a initializer table</p>
+
<p style="width: 60%;margin: 0 auto">Example of adding a view to a object</p>
 
<div style="width:60%;margin: 0 auto">
 
<div style="width:60%;margin: 0 auto">
   Code Block
+
   --this will add a view that will interact with players within 30 units
   Code Block
+
   --It will check and update every 0.5 seconds
   Code Block
+
   AddView("UniqueViewHandler",SearchPlayerInRange(30,true),0.5)
 
</div>
 
</div>
<p style="width: 60%;margin: 0 auto">Example of adding a module with a initializer table</p>
+
<p style="width: 60%;margin: 0 auto">Example of handling a object entering a view</p>
 
<div style="width:60%;margin: 0 auto">
 
<div style="width:60%;margin: 0 auto">
   Code Block
+
   --- OnEnterView - this function is triggered by the EventHandler EnterView
   Code Block
+
   --@ param: enteringObject - this is the object in the world that moves within the 30 unit view
   Code Block
+
   function OnEnterView(enteringObject)
 +
      If(enteringObject:IsPlayer()) then
 +
          enteringObject:SystemMessage("you have entered " .. this:GetName() .. " view.")
 +
      end
 +
  end
 +
 
 +
  --Register the event handler for the "UniqueViewHandler" when a player enters the view
 +
  RegisterEventHandler(EventType.EnterView, "UniqueViewHandler", OnEnterView)
 
</div>
 
</div>
<p style="width: 60%;margin: 0 auto">Example of Handling the initializer table on an object</p>
+
<p style="width: 60%;margin: 0 auto">Example of handling a object leaving a view</p>
 
<div style="width:60%;margin: 0 auto">
 
<div style="width:60%;margin: 0 auto">
   Code Block
+
   --- OnLeaveView - this function is triggered by the EventHandler LeaveView
   Code Block
+
   --@ param: enteringObject - this is the object in the world that moves within the 30 unit view
   Code Block
+
   function OnLeaveView (leavingObject)
 +
      If(leavingObject:IsPlayer()) then
 +
          leavingObject:SystemMessage("you have left " .. this:GetName() .. " view.")
 +
      end
 +
  end
 +
 
 +
  --Register the event handler for the "UniqueViewHandler" when a player leaves the view
 +
  RegisterEventHandler(EventType.EnterView, "UniqueViewHandler", OnLeaveView)
 
</div>
 
</div>

Latest revision as of 19:53, 11 November 2019

[Main] [Lua Examples]

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Global Functions & Examples

AddView(eventid,searcher,frequency)

eventid - Event identifier for events
searcher - Object searcher that defines the view
frequency - Update frequency check in seconds.
The frequency argument may be omitted, the View will default to 0.25 seconds for the frequency. The minimum value of frequency is 0.1 seconds.

Example of adding a view to a object

 --this will add a view that will interact with players within 30 units
 --It will check and update every 0.5 seconds
 AddView("UniqueViewHandler",SearchPlayerInRange(30,true),0.5)

Example of handling a object entering a view

 --- OnEnterView - this function is triggered by the EventHandler EnterView
 --@ param: enteringObject - this is the object in the world that moves within the 30 unit view
 function OnEnterView(enteringObject)
     If(enteringObject:IsPlayer()) then
         enteringObject:SystemMessage("you have entered " .. this:GetName() .. " view.")
     end
 end
 
 --Register the event handler for the "UniqueViewHandler" when a player enters the view
 RegisterEventHandler(EventType.EnterView, "UniqueViewHandler", OnEnterView)

Example of handling a object leaving a view

 --- OnLeaveView - this function is triggered by the EventHandler LeaveView
 --@ param: enteringObject - this is the object in the world that moves within the 30 unit view
 function OnLeaveView (leavingObject)
     If(leavingObject:IsPlayer()) then
         leavingObject:SystemMessage("you have left " .. this:GetName() .. " view.")
     end
 end
 
 --Register the event handler for the "UniqueViewHandler" when a player leaves the view
 RegisterEventHandler(EventType.EnterView, "UniqueViewHandler", OnLeaveView)