13.1. Loading Plugins from the Command Line

It is also possible to load plugins directly from the command line, for those more comfortable with it and with Perl.

To load a plugin, the $world->loadplugin function is used. It must be called with one argument, which can be either the full path to the file that defines the plugin, or just the plugin name. But for this to work, the file must be installed in one of the directories that KildClient looks for plugins. By default, two locations are searched for: one is the plugins directory under KildClient's directory in your HOME path (that is, ~/.kildclient/plugins in UNIX systems). The other is the plugins directory under the directory where KildClient stores some of its files (generally it is something like /usr/local/share/kildclient/plugins).

For example, here is how to load the keypad plugin (which is a standard plugin distributed with KildClient):

Example 13.1. Loading a plugin
$world->loadplugin('keypad')

As an additional example, the code below loads a plugin specifying its full filename:

Example 13.2. Loading a plugin specifying the full filename
$world->loadplugin('/home/joe/kildclient-plugins/attackplugin.pl')

Either way, you should see a message saying that the plugin has been loaded. It is now already working. If the plugin was already loaded, loading will fail.

To always load the plugin when you connect to the World, either use the World Editor as described above, or add the line that loads it to your script file. See Section 4.5.1, “Scripting”.

13.1.1. Enabling and Disabling Plugins

If you want to turn off a plugin temporarily, you can disable it. Later, when you want it to work again, just reenable it.

To disable a plugin, use the $world->displugin function, passing as argument the name of the plugin. What this function does is disable the plugin's triggers, aliases, macros and timers. You can still call the plugin functions directly.

To enable a plugin again, use the $world->enaplugin function, passing as argument the name of the plugin.