Difference between revisions of "GetUserDefinedEventNumber"

From NWN Lexicon
Jump to: navigation, search
m (Wikified article formatting)
 
Line 1: Line 1:
 
+
Determines the specific event number used to create a user-defined event.
 
 
 
 
 
 
=GetUserDefinedEventNumber()=
 
 
 
Determines the specific user-defined number that has been sent to it.
 
  
 
<nwscript>
 
<nwscript>
Line 11: Line 5:
 
</nwscript>
 
</nwscript>
  
====Description====
+
===Description===
 
 
 
This is for use in a user-defined script, it gets the event number.
 
This is for use in a user-defined script, it gets the event number.
  
<br /><br />
+
===Remarks===
 +
When you signal the user defined event to be triggered, you do so using a call like:
  
====Remarks====
+
<nwscript>
 
+
event eMyEvent = EventUserDefined(3333);
When you signal the user defined event to be triggered, you do so using a call like: <br /><br /> event eMyEvent=EventUserDefined(3333); <br /> SignalEvent(OBJECT_SELF, eMyEvent); <br /><br /> In the above case, you could then use GetUserDefinedEventNumber inside the user-defined event script, and it would return 3333.
+
SignalEvent(OBJECT_SELF, eMyEvent);
 
+
</nwscript>
<br />
 
  
====Version====
+
In the above case, you could then use GetUserDefinedEventNumber() inside the user-defined event script, and it would return 3333.
  
 +
===Version===
 
1.61
 
1.61
  
====Example====
+
===Example===
 
 
 
<nwscript>
 
<nwscript>
 
//Example structure of a user defined event script.
 
//Example structure of a user defined event script.
Line 34: Line 27:
 
void main()
 
void main()
 
{
 
{
int nEvent=GetUserDefinedEventNumber();
+
    int nEvent=GetUserDefinedEventNumber();
  
switch (nEvent)
+
    switch (nEvent)
  {
+
    {
  case 3333:
+
        case 3333:
      SpeakString("I'm in event 3333");
+
            SpeakString("I'm in event 3333");
      break;
+
            break;
  case 3334:
+
        case 3334:
      SpeakString("This is event 3334");
+
            SpeakString("This is event 3334");
      break;
+
            break;
  default:
+
        default:
      SpeakString("I don't know what to do with this event number");
+
            SpeakString("I don't know what to do with this event number");
  }
+
    }
 
}
 
}
 
</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>
|
+
| [[EventUserDefined|EventUserDefined]]
[[EventUserDefined | EventUserDefined ]]
 
 
|-
 
|-
|}
+
|}<br />
 
 
<br />
 
 
----
 
----
<font color="gray">  author: Jody Fletcher, editor: Lilac Soul</font><br />  <br />
+
<font color="gray">  author: Jody Fletcher, editor: Lilac Soul</font>
 
[[Category:Functions]]
 
[[Category:Functions]]
[[Category:Miscellaneous_Functions]]
+
[[Category:Miscellaneous_Functions]]{{DISPLAYTITLE:GetUserDefinedEventNumber()}}

Latest revision as of 23:56, 10 April 2018

Determines the specific event number used to create a user-defined event.

Description

This is for use in a user-defined script, it gets the event number.

Remarks

When you signal the user defined event to be triggered, you do so using a call like:

event eMyEvent = EventUserDefined(3333);
SignalEvent(OBJECT_SELF, eMyEvent);

In the above case, you could then use GetUserDefinedEventNumber() inside the user-defined event script, and it would return 3333.

Version

1.61

Example

//Example structure of a user defined event script.
 
void main()
{
    int nEvent=GetUserDefinedEventNumber();
 
    switch (nEvent)
    {
        case 3333:
            SpeakString("I'm in event 3333");
            break;
        case 3334:
            SpeakString("This is event 3334");
            break;
        default:
            SpeakString("I don't know what to do with this event number");
    }
}

See Also

functions:  EventUserDefined


 author: Jody Fletcher, editor: Lilac Soul