Category:Console Command
Console commands are used to control and inspect Kore while it's running.
There are many ways how console commands can be invoked:
- manually typing in the console
- calling via doCommand, macro's do, cmdOnLogin and other plugins
- calling via
Commands::run("<console command with arguments>")
- that can be used inside Kore, in plugins and in eval
Regardless of way used, the syntax and command set is the same.
Some console commands are equivalent to the manual actions you can do in the original Ragnarok Online Client (e.g. client commands, chatting, dealing, party and guild management, etc); some are used for controlling more high-level Kore's AI; some are used for inspect your character, environment, AI etc.
Aliases (shortcuts) for already existing commands can be defined with alias.
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 lambdasub { ... }
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::register("echo", "echo command", sub { Commands::unregister($commands) });
Pages in category "Console Command"
The following 165 pages are in this category, out of 165 total.