Adding Custom Commands
Plugins can add new commands.
Registering of new commands (can be used outside of subs in a plugin):
my $commands_handle = Commands::register(
['command_name', 'command description', <code_reference>],
...
)
Where:
$commands_handle is a scalar variable to hold obscure content used for unregistering
command_name is a command
command description is a description for user
code_reference is a Perl coderef for a command handler, can be for example a reference to the existing sub \&sub_name or lambda sub { ... }
Command handler is called with two arguments: command name and the rest of the string (command arguments).
Unregistering of commands (should be used in plugin's reload/unload handlers):
Commands::unregister($commands_handle)
Example
# very simple plugin which adds echo command which just prints its arguments to the console
package echo;
use strict;
my $commands = Commands::register(['echo', 'print to the console', sub { Log::message "$_[1]\n" }]);
Plugins
I get it in
http://www.openkore.com/index.php/Categ ... le_Command
but iam not really anderstand what it is, or where i have to put this code.
Should i put in config, or, mons_control, or items_control, or what?
consol command is a new ones for me.