Difference between revisions of "EventUserDefined"

From NWN Lexicon
Jump to: navigation, search
m (Wikified article formatting)
Line 1: Line 1:
=EventUserDefined(int)=
 
 
 
Returns an event of the type nUserDefinedEventNumber.
 
Returns an event of the type nUserDefinedEventNumber.
  
Line 9: Line 7:
 
</nwscript>
 
</nwscript>
  
====Parameters====
+
===Parameters===
 
+
; nUserDefinedEventNumber
''nUserDefinedEventNumber''
+
: A number used to identify the type of event to signal.
 
 
<br />
 
  
====Description====
+
===Description===
 +
EventUserDefined() is used with the [[SignalEvent]]() function to cause the [[OnUserDefined]] event to trigger and run the script assigned. Within the OnUserDefined script, nUserDefinedEventNumber can be retrieved using the [[GetUserDefinedEventNumber]]() function.
  
EventUserDefined is used with the SignalEvent() function to cause the OnUserDefined event to trigger and run the script assigned. Within the OnUserDefined script, nUserDefinedEventNumber can be retrieved using the GetUserDefinedEventNumber() function. <br /><br /> nUserDefinedEventNumber can be one of the standard event numbers (see the object's default OnSpawn script) or a custom number. <br /><br />
+
nUserDefinedEventNumber can be one of the standard event numbers (see the object's default [[OnSpawn]] script) or a custom number.  
  
<br /><br />
+
===Remarks===
 +
EventUserDefined only creates the event. SignalEvent() must still be called to cause the event to be triggered.
  
====Remarks====
+
The importance of UserEvents is in the ability to execute custom code to deal with unique situations without modifying the default scripts NWN assigns to the events.
 
 
EventUserDefined only creates the event. SignalEvent() must still be called to cause the event to be triggered. <br /><br /> The importance of UserEvents is in the ability to execute custom code to deal with unique situations without modifying the default scripts NWN assigns to the events. <br /><br />
 
 
 
<br />
 
 
 
====Version====
 
  
 +
===Version===
 
1.22
 
1.22
  
====Example====
+
===Example===
 
 
 
<nwscript>
 
<nwscript>
 
// Example 1 - The following code creates a custom user event
 
// Example 1 - The following code creates a custom user event
 
// of 1234 as eSpecialEvent, then triggers the OnUserDefined
 
// of 1234 as eSpecialEvent, then triggers the OnUserDefined
 
// event of oNPC and passes eSpecialEvent to it.
 
// event of oNPC and passes eSpecialEvent to it.
 +
object oNPC;
 +
event eSpecialEvent;
  
  object oNPC;
+
eSpecialEvent = EventUserDefined(1234);
  event eSpecialEvent;
+
SignalEvent(oNPC, eSpecialEvent);
 
 
  eSpecialEvent = EventUserDefined(1234);
 
  SignalEvent(oNPC,eSpecialEvent);
 
 
 
 
 
 
</nwscript>
 
</nwscript>
  
====See Also====
+
===See Also===
 
 
 
{| class="seealso"
 
{| class="seealso"
 
| width="1px" align="right" valign="top" | <font color="gray">functions: </font>
 
| width="1px" align="right" valign="top" | <font color="gray">functions: </font>
|
+
| [[SignalEvent|SignalEvent]]
[[ SignalEvent | SignalEvent ]]
 
|-
 
 
|-
 
|-
 
| width="1px" align="right" valign="top" | <font color="gray">events: </font>
 
| width="1px" align="right" valign="top" | <font color="gray">events: </font>
|
+
| [[OnUserDefined|OnUserDefined Event]]
[[ OnUserDefined | OnUserDefined Event ]]
+
|}<br />
|}
 
 
 
<br />
 
 
----
 
----
 
<font color="gray">  author: Brett Lathrope, editor: Jeremy Spilinek</font><br />  <br />
 
<font color="gray">  author: Brett Lathrope, editor: Jeremy Spilinek</font><br />  <br />
 
[[Category:Functions]]
 
[[Category:Functions]]
[[Category:Action_on_Object_Functions]]
+
[[Category:Action_on_Object_Functions]]{{DISPLAYTITLE:EventUserDefined(int)}}

Revision as of 23:51, 10 April 2018

Returns an event of the type nUserDefinedEventNumber.

event EventUserDefined(
    int nUserDefinedEventNumber
);

Parameters

nUserDefinedEventNumber
A number used to identify the type of event to signal.

Description

EventUserDefined() is used with the SignalEvent() function to cause the OnUserDefined event to trigger and run the script assigned. Within the OnUserDefined script, nUserDefinedEventNumber can be retrieved using the GetUserDefinedEventNumber() function.

nUserDefinedEventNumber can be one of the standard event numbers (see the object's default OnSpawn script) or a custom number.

Remarks

EventUserDefined only creates the event. SignalEvent() must still be called to cause the event to be triggered.

The importance of UserEvents is in the ability to execute custom code to deal with unique situations without modifying the default scripts NWN assigns to the events.

Version

1.22

Example

// Example 1 - The following code creates a custom user event
// of 1234 as eSpecialEvent, then triggers the OnUserDefined
// event of oNPC and passes eSpecialEvent to it.
object oNPC;
event eSpecialEvent;
 
eSpecialEvent = EventUserDefined(1234);
SignalEvent(oNPC, eSpecialEvent);

See Also

functions:  SignalEvent
events:  OnUserDefined Event


 author: Brett Lathrope, editor: Jeremy Spilinek