This shows you the differences between two versions of the page.
|
commands [2009/04/12 14:54] ortzinator |
commands [2009/04/12 14:57] (current) ortzinator |
||
|---|---|---|---|
| Line 34: | Line 34: | ||
| Commands must follow these rules to work properly: | Commands must follow these rules to work properly: | ||
| - | - The class must implement the ICommand interface. At the moment this interface just lets the plugin loader know that it’s a command. | + | - The class must implement the ''ICommand'' interface. At the moment this interface just lets the plugin loader know that it’s a command. |
| - | - The class must also have the Plugin attribute. Plugin takes an optional string parameter to specify the name of the plugin (in this case the name of the command you type to execute the command, ie “/say”) otherwise the plugin’s name is the name of the class. | + | - The class must also have the ''Plugin'' attribute. ''Plugin'' takes an optional string parameter to specify the name of the plugin (in this case the name of the command you type to execute the command, ie “/say”) otherwise the plugin’s name is the name of the class. |
| - | - The command class must have at least one public Execute method. This method is what OrtzIRC calls when you type in a command. | + | - The command class must have at least one public ''Execute'' method. This method is what OrtzIRC calls when you type in a command. |
| - | - The type of the first parameter in each of the Execute methods must be one of the following: | + | - The type of the first parameter in each of the ''Execute'' methods must be one of the following: |
| - | * Channel | + | * ''Channel'' |
| - | * Server | + | * ''Server'' |
| - | * PrivateMessageSession | + | * ''PrivateMessageSession'' |
| - This parameter represents the context in which the command was executed, in other words, the window. (A channel window, PM window…) | - This parameter represents the context in which the command was executed, in other words, the window. (A channel window, PM window…) | ||
| - | - The type of each of the remaining parameters must be either string or ChannelInfo. The ChannelInfo object is simply to let the command know that the user specified a channel name, ie “#luahelp”. | + | - The type of each of the remaining parameters must be either string or ''ChannelInfo''. The ''ChannelInfo'' object is simply to let the command know that the user specified a channel name, ie “#luahelp”. |
| - | - If you want autocomplete support the Execute methods must each have proper XML docs. (This has not yet been implemented, I will discuss it in more detail when it is) | + | - If you want autocomplete support the ''Execute'' methods must each have proper XML docs. (This has not yet been implemented, I will discuss it in more detail when it is) |
| If these rules are not followed, the command will either not be loaded or not called when the user attempts to execute it. When a user types in a command, the plugin system looks through the commands it has loaded and looks for one that meets all these requirements and whose parameters match the parameters given by the user. | If these rules are not followed, the command will either not be loaded or not called when the user attempts to execute it. When a user types in a command, the plugin system looks through the commands it has loaded and looks for one that meets all these requirements and whose parameters match the parameters given by the user. | ||