[Home] [Downloads] [Search] [Help/forum]

MUSHclient scripting

Description of MUSHclient world function: world.GetPluginVariable


Name GetPluginVariable
Type Method
Summary Gets the contents of a variable belonging to a plugin
Prototype VARIANT GetPluginVariable(BSTR PluginID, BSTR VariableName);

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")


Note: Available in version 3.23 onwards.


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".
Returns 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.
Introduced in version 3.23

See also ...

Function Description
GetPluginVariableList Gets the list of variables in a specified plugin
GetVariable Gets the contents of a variable
GetVariableList Gets the list of variables
SetVariable Sets the value of a variable

Search for script function

Enter a word or phrase in the box below to narrow the list down to those that match.

The function name, prototype, summary, and description are searched.

Search for:   

Leave blank to show all functions.


Return codes

Many functions return a "code" which indicates the success or otherwise of the function.

You can view a list of the return codes


Function prototypes

The "prototype" part of each function description lists exactly how the function is called (what arguments, if any, to pass to it).

You can view a list of the data types used in function prototypes


View all functions

[Back]

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]