Name CallPlugin
Type Method
Summary Calls a routine in a plugin
Prototype long CallPlugin(BSTR PluginID, BSTR Routine, BSTR Argument);
Description Calls a nominated routine in a nominated plugin, supplying a string argument.

The intention here is to allow plugins to interact with each other, to a certain extent.

For instance, you might write a plugin that logs text to a log file, and want to share it between other plugins. Hence you might log a message like this:

world.CallPlugin "80cc18937a2aca27079567f0", "LogIt", "Data to be logged"

The above example would locate plugin with the ID 80cc18937a2aca27079567f0 (if installed) and then call the routine "LogIt" in that plugin, with the argument "Data to be logged". In this example, the LogIt routine would look like this:

Sub LogIt (sText)
world.WriteLog sText
End Sub


You should exercise caution when using this technique. It will be annoying for plugin users if plugins become overly dependent on each other, particularly if they cannot find the one that is required.

Also, be careful you do not set up circular dependencies (eg. A needs B, and B needs A).

You can use "world.PluginSupports" to see if a particular routine is implemented in a plugin. For example:

If World.PluginSupports ("80cc18937a2aca27079567f0", "LogIt") <> eOK then
World.Note "Required 'LogIt' routine is not available"
End If



Note: Available in MUSHclient version 3.23 onwards.
VBscript example
world.CallPlugin "80cc18937a2aca27079567f0", "LogIt", "Data to be logged"
Jscript example
world.CallPlugin ("80cc18937a2aca27079567f0", "LogIt", "Data to be logged");
PerlScript example
$world->CallPlugin ("80cc18937a2aca27079567f0", "LogIt", "Data to be logged");
Returns eNoSuchPlugin: Plugin not installed
eNoSuchRoutine: Specified routine cannot be found in that plugin
eErrorCallingPluginRoutine: Error when calling routine (eg. syntax error)
eOK: Called OK

See also ...