Welcome to PenUltima Online. Click to login or register.

POL System Events

Description:

This document describes all the "System Events" (Sysevents) that the POL core uses. These are enabled in Control Scripts using the EnableEvents() function. Only these events listed here should be used in the EnableEvents() function. You may not define User Events with any of these values (or any of the reserved values in sysEvent.inc). To use a user event in your script, you must not use EnableEvents(), just send it using SendEvent() (or process_obj.sendevent()) and look for it normally in the receiving script. Some of the Sysevents below are ranged, meaning you may specify a world distance in EnableEvents() beyond which the script will not receive the event. Use DisableEvents() to disable any of the Sysevents.

Last Modified: 08/31/2015
SYSEVENT_SPEECH
Explanation
This event comes in two types: Normal and Unicode. The latter is sent when the source is a client speaking in Unicode speech.
ID#: 0x00000001
Struct Members:
Name Type
type SYSEVENT_SPEECH (0x00000001)
source Character Reference
text string normal text (junk if unicode)
texttype type of speech: "yell", "whisper", "emote", or "default"
uc_text (Unicode only) a "Unicode array" of 2-byte "Big Endian" integers corresponding to the unicode characters sent. will be an 'error' type if the Unicode input is "bad". will be uninitialized if no Unicode text is available (ie, when a non-Unicode client types the command)
langcode (Unicode only) string 3-character, uppercase language code, i.e. "ENU", "DEU", etc.
tokens (Unicode only) if speech has (speech.mul) Tokens, gives array of spoken TokenIDs
When sent:
When a player speaks in range of an item listening point, or NPC that has enabled the event. Note Ghost speech is a seperate event.
Ranged?
Yes
SYSEVENT_ENGAGED
Explanation
Combat Engaged event.
ID#: 0x00000002
Struct Members:
Name Type
type SYSEVENT_ENGAGED (0x00000002)
source Character Reference
When sent:
When an attack is initiated against an NPC. (set opponent, or Target with the Harmful flag set)
Ranged?
No
SYSEVENT_DISENGAGED
Explanation
Combat Disengaged event.
ID#: 0x00000004
Struct Members:
Name Type
type SYSEVENT_DISENGAGED (0x00000004)
source Character Reference
When sent:
When an attack is stopped against an NPC. (set opponent null, attacker dies)
Ranged?
No
SYSEVENT_DAMAGED
Explanation
The NPC was damaged.
ID#: 0x00000008
Struct Members:
Name Type
type SYSEVENT_DAMAGED (0x00000008)
source Character Reference, or 0 if no character source
damage integer damage amount
When sent:
The NPC recevied damage.
Ranged?
No
SYSEVENT_ENTEREDAREA
Explanation
A character entered inside a range around the NPC. Note, ignores Z distance.
ID#: 0x00000010
Struct Members:
Name Type
type SYSEVENT_ENTEREDAREA (0x00000010)
source Character Reference
When sent:
The mobile walked into the range, a new NPC was created inside the range, or a character un-hid inside the range.
Ranged?
Yes
SYSEVENT_LEFTAREA
Explanation
A character left the range around the NPC. Note, ignores Z distance.
ID#: 0x00000020
Struct Members:
Name Type
type SYSEVENT_LEFTAREA (0x00000020)
source Character Reference
When sent:
The mobile walked out of the range. Not sent if mobile hides, dies, or deleted.
Ranged?
Yes
SYSEVENT_OPPONENT_MOVED
Explanation
The NPC's opponent moved.
ID#: 0x00000040
Struct Members:
Name Type
type SYSEVENT_OPPONENT_MOVED (0x00000040)
source Character Reference
When sent:
The NPC's current opponent moved. Inhibits the Enter/Leave events for the NPC's opponent.
Ranged?
No
SYSEVENT_HOSTILE_MOVED
Explanation
Not Implimented.
ID#: 0x00000080
When sent:
Not Implimented
Ranged?
No
SYSEVENT_MERCHANT_BOUGHT
Explanation
Only sent to the merchant NPC that bought the items.
ID#: 0x00000100
Struct Members:
Name Type
type SYSEVENT_MERCHANT_BOUGHT (0x00000100)
source Character Reference
amount if ScriptedMerchantHandlers is 0 in servspecopt.cfg, amount of gold items sold for
shoppinglist if ScriptedMerchantHandlers is 1 in servspecopt.cfg, array{ struct.item, struct.amount }
When sent:
After an NPC merchant buys items from a player.
Ranged?
No
SYSEVENT_MERCHANT_SOLD
Explanation
Only sent to the merchant NPC that sold the items.
ID#: 0x00000200
Struct Members:
Name Type
type SYSEVENT_MERCHANT_SOLD (0x00000200)
source Character Reference
amount if ScriptedMerchantHandlers is 0 in servspecopt.cfg, amount of gold items sold for
shoppinglist if ScriptedMerchantHandlers is 1 in servspecopt.cfg, array{ struct.item, struct.amount }
When sent:
After an NPC merchant sells items to a player.
Ranged?
No
SYSEVENT_ITEM_GIVEN
Explanation
Item dropped on an NPC generates this event. Also sets the following cprops on the item: "GivenBy": PC's serial, "GivenTo":NPC's serial, "GivenTime":gameclock value when item was given.
Important: The item is moved to a storage area until the script handling the event moves it to a real container. If the item is not before by the time the event object goes out of scope (including passed to a subroutine! use 'byref' to prevent the event from being destroyed before it can be passed to the handling subroutine), the item will automatically be moved back to its old container, and the aformentioned cprops are erased.
ID#: 0x00000400
Struct Members:
Name Type
type SYSEVENT_ITEM_GIVEN (0x00000400)
source Character Reference
item Item Reference
When sent:
A player drops an item on an NPC.
Ranged?
No
SYSEVENT_DOUBLECLICKED
Explanation
Allows the NPC to receive double-click events (i.e. for mounting horses, pack llamas, etc.)
ID#: 0x00000800
Struct Members:
Name Type
type SYSEVENT_DOUBLECLICKED (0x00000800)
source Character Reference
When sent:
A player double-clicked on an NPC.
Ranged?
No
SYSEVENT_GHOST_SPEECH
Explanation
Dead players generate this event when speaking, not SYSEVENT_SPEECH. Otherwise, see SYSEVENT_SPEECH for the struct members.
ID#: 0x00001000
When sent:
A dead player speaks.
Ranged?
Yes
SYSEVENT_GONE_CRIMINAL
Explanation
The GONE_CRIMINAL event lets the system tell the NPC when a mobile has become a criminal (from a previously non-criminal state) by firing this event and placing a character reference to the new criminal in the source field of the event. If used in conjunction with the ENTERED_AREA system event, then guards should be able to do their guarding work without needing to do polling scans of the area around them periodically. On ENTERED_AREA events, you check to see if the person entering the area is a criminal or not. On GONE_CRIMINAL events, you know that the person who was already in the area has become a criminal from previously being innocent.
ID#: 0x00002000
Struct Members:
Name Type
type SYSEVENT_GONE_CRIMINAL (0x00002000)
source Character Reference
When sent:
A player inrange has become a criminal.
Ranged?
Yes
SYSEVENT_TOKEN_SPEECH
Explanation
Used for token speech if SeperateSpeechTokens is enabled in servspecopt.cfg.
ID#: 0x00004000
When sent:
Like SYSEVENT_SPEECH but only when tokens are present.
Ranged?
Yes
SYSEVENT_TOKEN_GHOST_SPEECH
Explanation
Used for token speech if SeperateSpeechTokens is enabled in servspecopt.cfg.
ID#: 0x00008000
When sent:
Like SYSEVENT_GHOST_SPEECH but only when tokens are present.
Ranged?
Yes
AUX_Connection_Receive_Event
Explanation
This event is the method by which the AUX connection script received data from an external application. (Data may be sent with aux_connection.send())
Note: ONLY received in AUX connection handler scripts.
ID#: n/a
Struct Members:
Name Type
type string "recv"
value unpacked scripting object
When sent:
When an external application connected to an AUX handler script sends packed data, wait_for_event() will return this struct.
Ranged?
Yes