GetPluginVariable
Script function

world.GetPluginVariable

DOC_scripting Read about scripting

Type

Method

Summary

Gets the contents of a variable belonging to a plugin

Prototype

VARIANT GetPluginVariable(BSTR PluginID, BSTR VariableName);

DOC_data_types View list of data type meanings


Description

Gets the contents of the named variable for the nominated plugin. Each plugin has a unique ID - specify that ID to identify the plugin in question.

If the named variable does not exist, EMPTY is returned.

If the name given is invalid, NULL is returned.

If the nominated plugin does not exist, NULL is returned.

(Use "IsEmpty" and "IsNull" to test for these possibilities).

If you want to find the value of a variable in the current plugin, use "GetVariable".

If you are writing a plugin and want to find a "global" MUSHclient variable value, use an empty plugin ID, eg.

world.Note world.GetPluginVariable ("", "target")



VBscript example

dim MyName

MyName = world.GetPluginVariable ("a42fbf74f394d8129df956ae", "MyName")

if isempty (MyName) then
  world.note "My name is not defined"
end if

if isnull (MyName) then
  world.note "Invalid variable name"
end if

world.note MyName



Jscript example

var MyName;

MyName = world.GetPluginVariable ("a42fbf74f394d8129df956ae", "MyName");

if (MyName == null)
  world.note("MyName is not defined");
else
  world.note(MyName);



PerlScript example

$MyName = $world->GetPluginVariable ("a42fbf74f394d8129df956ae", "MyName");

if (!defined ($MyName)) 
  {
  $world->note ("MyName is not defined");
  }
else 
  {
  $world->note ($MyName);
  }



Python example

MyName = world.GetPluginVariable ("a42fbf74f394d8129df956ae", "MyName")

if not MyName:
  world.note("MyName is not defined")
else:
  world.note(MyName)



Lua example

MyName = GetPluginVariable ("a42fbf74f394d8129df956ae", "MyName")

if MyName == nil then
  Note("MyName is not defined")
else
  note(MyName)
end



Lua notes

Lua returns nil where applicable instead of an "empty variant" or "null variant".



Return value

The contents of the specified variable for the specified plugin.
An EMPTY variant, if the variable does not exist.
A NULL variant if the variable name is invalid, or the plugin is not installed.




See Also ...

Topics

DOC_aliases Aliases
DOC_Arrays Arrays
DOC_plugins Plugins
DOC_scripting Scripting
DOC_timers Timers
DOC_triggers Triggers
DOC_variables Variables

Functions

FNC_BroadcastPlugin BroadcastPlugin (Broadcasts a message to all installed plugins)
FNC_CallPlugin CallPlugin (Calls a routine in a plugin)
FNC_EnablePlugin EnablePlugin (Enables or disables the specified plugin)
FNC_GetPluginID GetPluginID (Returns the 24-character ID of the current plugin)
FNC_GetPluginInfo GetPluginInfo (Gets details about a specified plugin)
FNC_GetPluginList GetPluginList (Gets a list of installed plugins.)
FNC_GetPluginName GetPluginName (Returns the name of the current plugin)
FNC_GetPluginTimerInfo GetPluginTimerInfo (Gets details about a named timer for a specified plugin)
FNC_GetPluginTimerList GetPluginTimerList (Gets the list of timers in a specified plugin)
FNC_GetPluginVariableList GetPluginVariableList (Gets the list of variables in a specified plugin)
FNC_GetVariable GetVariable (Gets the contents of a variable)
FNC_GetVariableList GetVariableList (Gets the list of variables)
FNC_IsPluginInstalled IsPluginInstalled (Checks to see if a particular plugin is installed)
FNC_LoadPlugin LoadPlugin (Loads a plugin from disk)
FNC_PluginSupports PluginSupports (Checks if a plugin supports a particular routine)
FNC_ReloadPlugin ReloadPlugin (Reloads an installed plugin)
FNC_SaveState SaveState (Saves the state of the current plugin)
FNC_SetVariable SetVariable (Sets the value of a variable)

(Help topic: function=GetPluginVariable)

DOC_contents Documentation contents page