User Tools

Site Tools


addons:events

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
addons:events [2017/04/21 19:17]
atom0s
addons:events [2017/04/21 19:54]
atom0s
Line 39: Line 39:
 ---- ----
  
 +===== Built-In Events =====
 +
 +Below, you will find documentation for the built-in events that the Ashita addons library exposes to all addons. Please be aware of the returns and such of each event as incorrect returns can cause log spam of warnings/​errors as well as potential client crashes! Be sure to test your addons thoroughly before having others use them!
 +
 +----
 ==== Event: load ===== ==== Event: load =====
  
Line 56: Line 61:
  
 ---- ----
- 
 ==== Event: unload ==== ==== Event: unload ====
  
Line 72: Line 76:
 **Returns** \\ **Returns** \\
     * None     * None
 +
 +----
 +==== Event: command =====
 +
 +Called when a command has been entered in the game.
 +
 +<code lua>
 +ashita.register_event('​command',​ function(cmd,​ nType)
 +    print('​Command event fired!'​);​
 +    return false;
 +end);
 +</​code>​
 +
 +**Parameters** \\
 +    * **cmd** - (string) The command that was entered.
 +    * **nType** - (number) The type of command that was entered.
 +
 +**Returns** \\
 +    * **bool** - True if the addon handled the command, false otherwise to allow further addons to process the command.
 +
 +----
 +==== Event: incoming_packet =====
 +
 +Called when the game client is receiving an incoming packet.
 +
 +<code lua>
 +ashita.register_event('​incoming_packet',​ function(id,​ size, packet, packet_modified,​ blocked)
 +    print('​Incoming packet event fired!'​);​
 +    return false;
 +end);
 +</​code>​
 +
 +**Parameters** \\
 +    * **id** - (number) The packet id being processed.
 +    * **size** - (number) The size of the packet being processed.
 +    * **packet** - (string) The raw packet data.
 +    * **packet_modified** - (string) The raw packet data that has been modified by other addons and plugins.
 +    * **blocked** - (bool) True if the packet has been blocked by another addon or plugin, false otherwise.
 +
 +**Returns** \\
 +    * **bool** - True if the packet should be dropped/​blocked,​ false otherwise.
 +    * or
 +    * **table** - A table containing new packet data that should be used to modify the packet.
 +
 +----
 +==== Event: outgoing_packet =====
 +
 +Called when the game client is sending an outgoing packet.
 +
 +<code lua>
 +ashita.register_event('​outgoing_packet',​ function(id,​ size, packet, packet_modified,​ blocked)
 +    print('​Outgoing packet event fired!'​);​
 +    return false;
 +end);
 +</​code>​
 +
 +**Parameters** \\
 +    * **id** - (number) The packet id being processed.
 +    * **size** - (number) The size of the packet being processed.
 +    * **packet** - (string) The raw packet data.
 +    * **packet_modified** - (string) The raw packet data that has been modified by other addons and plugins.
 +    * **blocked** - (bool) True if the packet has been blocked by another addon or plugin, false otherwise.
 +
 +**Returns** \\
 +    * **bool** - True if the packet should be dropped/​blocked,​ false otherwise.
 +    * or
 +    * **table** - A table containing new packet data that should be used to modify the packet.
 +
 +----
 +==== Event: incoming_text =====
 +
 +Called when the game client is adding text to the chat log.
 +
 +<code lua>
 +ashita.register_event('​incoming_text',​ function(mode,​ message, modifiedmode,​ modifiedmessage,​ blocked)
 +    print('​Incoming text event fired!'​);​
 +    return false;
 +end);
 +</​code>​
 +
 +**Parameters** \\
 +    * **mode** - (number) The chat mode of the message. (Controls the color of the overall message.)
 +    * **message** - (string) The message being added to the chat log.
 +    * **modifiedmode** - (number) The modified mode, if another addon or plugin has modified it.
 +    * **modifiedmessage** - (string) The modified message, if another addon or plugin has modified it.
 +    * **blocked** - (bool) True if the message has been blocked by another addon or plugin, false otherwise.
 +
 +**Returns** \\
 +    * **bool** - True if the message should be blocked, false otherwise.
 +    * or
 +    * **number** - The modified message mode to use instead of the current one.
 +    * or
 +    * **string** - The modified message to use instead of the current one.
 +    * or
 +    * **string, number** - The modified message and mode to use instead of the current ones.
 +
 +----
 +==== Event: outgoing_text =====
 +
 +Called when the game client is sending text to the server.\\
 +//(This gets called when a command, chat, etc. is not handled by the client and is being sent to the server.)//
 +
 +<code lua>
 +ashita.register_event('​outgoing_text',​ function(mode,​ message, modifiedmode,​ modifiedmessage,​ blocked)
 +    print('​Outgoing text event fired!'​);​
 +    return false;
 +end);
 +</​code>​
 +
 +**Parameters** \\
 +    * **mode** - (number) The chat mode of the message. (Controls the color of the overall message.)
 +    * **message** - (string) The message being added to the chat log.
 +    * **modifiedmode** - (number) The modified mode, if another addon or plugin has modified it.
 +    * **modifiedmessage** - (string) The modified message, if another addon or plugin has modified it.
 +    * **blocked** - (bool) True if the message has been blocked by another addon or plugin, false otherwise.
 +
 +**Returns** \\
 +    * **bool** - True if the message should be blocked, false otherwise.
 +    * or
 +    * **number** - The modified message mode to use instead of the current one.
 +    * or
 +    * **string** - The modified message to use instead of the current one.
 +    * or
 +    * **string, number** - The modified message and mode to use instead of the current ones.
 +
 +----
 +==== Event: prerender ====
 +
 +Called when the client is about to start rendering. (Called just after D3D8 BeginScene.)
 +
 +<code lua>
 +ashita.register_event('​prerender',​ function()
 +    print('​Prerender event fired!'​);​
 +end);
 +</​code>​
 +
 +**Parameters** \\
 +    * None
 +
 +**Returns** \\
 +    * None
 +
 +----
 +==== Event: render ====
 +
 +Called when the client has finished its rendering and other tools can now render. (Called during D3D8 EndScene.)
 +
 +<code lua>
 +ashita.register_event('​render',​ function()
 +    print('​Render event fired!'​);​
 +end);
 +</​code>​
 +
 +**Parameters** \\
 +    * None
 +
 +**Returns** \\
 +    * None
 +
 +----
 +==== Event: timerpulse ====
 +
 +Called when the client is rendering the scene, used for Addons Lua timers library.\\
 +//(Addons should not register to this event themselves, it is used for the timers library.)//
 +
 +<code lua>
 +ashita.register_event('​timerpulse',​ function()
 +    print('​Timer pulse event fired!'​);​
 +end);
 +</​code>​
 +
 +**Parameters** \\
 +    * None
 +
 +**Returns** \\
 +    * None
 +
  
 ---- ----
addons/events.txt · Last modified: 2017/04/22 00:10 (external edit)