These expressions can set and retrieve variables, control chat output, and more.
This adds the "Expression" meta condition and the "Expression Action" and "Chat Expression" meta actions.
The "/vt mexec [expression]" command is used for testing these expressions
Meta Functions
Expand to view details and available examples.
[Expand]
testvar[1]
Description: Tests if a meta variable is defined. Returns true if it is, or false otherwise.
Parameter count: 1
Param 0 (String): The variable name to test
Example:
testvar[variableName]
[Expand]
getvar[1]
Description: Returns the value of a meta variable, or false if it is not defined.
Parameter count: 1
Param 0 (String): The variable name to get
Example:
getvar[exampleVar]
[Expand]
setvar[2]
Description: Sets the value of a meta variable.
Parameter count: 2
Param 0 (String): The variable name to set
Example: variables can be strings or integers
setvar[exampleVar, variable]
setvar[exampleVar, 1]
[Expand]
touchvar[1]
Description: Sets the value of a meta variable to false if the variable was previously undefined. Returns true if the variable was previously defined, or false otherwise.
Parameter count: 1
Param 0 (String): The variable name to touch
Example:
touchvar[exampleVar]
[Expand]
clearallvars[]
Description: Undefines all meta variables.
Parameter count: 0
[Expand]
clearvar[1]
Description: Undefines a single meta variable. Returns true if the variable was previously defined, otherwise false.
Parameter count: 1
Param 0 (String): The variable name to clear
Example:
clearvar[exampleVar]
[Expand]
getcharintprop[1]
Description: Returns a character intvalue property, or false if the property is not defined.
Parameter count: 1
Param 0 (Number): IntValueKey property id.
[Expand]
getchardoubleprop[1]
Description: Returns a character doublevalue property, or false if the property is not defined.
Parameter count: 1
Param 0 (Number): DoubleValueKey property id.
[Expand]
getcharquadprop[1]
Description: Returns a character quadvalue property, or false if the property is not defined. Because expression variables are doubles, precision will be lost if the value is greater than 2^53-1 (~9 quadrillion)
Parameter count: 1
Param 0 (Number): QuadValueKey property id
[Expand]
getcharboolprop[1]
Description: Returns a character boolvalue property, or false if the property is not defined.
Parameter count: 1
Param 0 (Number): BoolValueKey property id
[Expand]
getcharstringprop[1]
Description: Returns a character stringvalue property, or false if the property is not defined.
Parameter count: 1
Param 0 (Number): StringValueKey property id.
[Expand]
getplayerlandcell[0]
Description: Returns the landcell the player is currently standing in as a number, including the landblock portion
Parameter count: 0
[Expand]
getplayercoordinates[0]
Description: Returns the global 3d coordinates for the player's current location, based on the game physics prediction model. Returns a coordinates object.
Parameter count: 0
[Expand]
coordinategetns[1]
Description: Returns the north/south portion of a coordinates object as a number.
Parameter count: 1
Param 0 (Coordinates): The coordinates object.
[Expand]
coordinategetwe[1]
Description: Returns the west/east portion of a coordinates object as a number.
Parameter count: 1
Param 0 (Coordinates): The coordinates object.
[Expand]
coordinategetz[1]
Description: Returns the z (vertical) portion of a coordinates object as a number.
Parameter count: 1
Param 0 (Coordinates): The coordinates object.
[Expand]
coordinatetostring[1]
Description: Returns the the string representation of a coordinates object.
Parameter count: 1
Param 0 (Coordinates): The coordinates object.
[Expand]
coordinateparse[1]
Description: Builds a coordinates object from a string. It should be of the form '00.0N, 00.0W'. Z coordinates are not specified. Returns false in case of parse failure.
Parameter count: 1
Param 0 (String): The coordinates string.
[Expand]
coordinatedistancewithz[2]
Description: Returns the 3d distance between two coordinates. The result is a number specified in meters.
Parameter count: 2
Param 0 (Coordinates): The first coordinates object.
Param 1 (Coordinates): The second coordinates object.
[Expand]
coordinatedistanceflat[2]
Description: Returns the 2d distance between two coordinates. The result is a number specified in meters. Z coordinates are ignored.
Parameter count: 2
Param 0 (Coordinates): The first coordinates object.
Param 1 (Coordinates): The second coordinates object.
[Expand]
wobjectgetphysicscoordinates[1]
Description: Queries the game's physics prediction model for the coordinates of a given object. Returns a coordinates object.
Parameter count: 1
Param 0 (WorldObject): The world object to examine.
[Expand]
wobjectgetname[1]
Description: Returns the name string for a given world object.
Parameter count: 1
Param 0 (WorldObject): The world object to examine.
[Expand]
wobjectgetobjectclass[1]
Description: Returns the objectclass for a given world object, as a number.
Parameter count: 1
Param 0 (WorldObject): The world object to examine.
[Expand]
wobjectgettemplatetype[1]
Description: Returns the game template type for a given world object, as a number.
Parameter count: 1
Param 0 (WorldObject): The world object to examine.
[Expand]
wobjectgetisdooropen[1]
Description: Returns the a boolean indicating if a door object is open.
Parameter count: 1
Param 0 (WorldObject): The door world object to examine.
[Expand]
wobjectfindnearestmonster[0]
Description: Returns a world object for the nearest monster, or false if no monsters are visible. Ignores blacklisted monsters.
Parameter count: 0
[Expand]
wobjectfindnearestdoor[0]
Description: Returns a world object for the nearest door, or false if no doors are visible.
Parameter count: 0
[Expand]
wobjectfindnearestbyobjectclass[1]
Description: Returns a world object for the nearest object of a given class number, or false if no matching objects are visible.
Parameter count: 1
Param 0 (Number): The objectclass number to look for.
[Expand]
wobjectfindininventorybytemplatetype[1]
Description: Returns a world object for the first inventory object of a given template type number, or false if no matching objects are visible.
Parameter count: 1
Param 0 (Number): The template type number to look for.
[Expand]
wobjectfindininventorybyname[1]
Description: Returns a world object for the first inventory object of a given name, or false if no matching objects are visible.
Parameter count: 1
Param 0 (String): The item name to look for.
[Expand]
wobjectgetselection[0]
Description: Returns a world object for the selected object, or false if nothing is selected.
Parameter count: 0
[Expand]
wobjectgetplayer[0]
Description: Returns a world object for the player.
Parameter count: 0
[Expand]
actiontryselect[1]
Description: Attempts to select a world object.
Parameter count: 1
Param 0 (WorldObject): The world object to attempt to select.
[Expand]
actiontryuseitem[1]
Description: Attempts to use a world object by itself (like a potion or door).
Parameter count: 1
Param 0 (WorldObject): The world object to attempt to use.
[Expand]
actiontryapplyitem[1]
Description: Attempts to use a world object on another world object. Returns false if failed and true if the attempt could possibly succeed.
Parameter count: 1
Param 0 (WorldObject): The world object to use first.
Param 1 (WorldObject): The world object to be used on.
[Expand]
isfalse[1]
Description: Takes any type and returns true if and only if it is a number with value 0 (false). Returns false otherwise.
Parameter count: 1
Param 0 (Any): The object to examine
[Expand]
istrue[1]
Description: Takes any type and returns true if and only if it is a number with a value other than 0 (true). Returns false otherwise.
Parameter count: 1
Param 0 (Any): The object to examine
[Expand]
iif[3]
Description: Examines the first parameter. If it is true, the second parameter is returned. Otherwise, the third parameter is returned. (If the first parameter is not a number, the third parameter is returned.)
Parameter count: 3
Param 0 (Any): The object to examine
Param 1 (Any): What to return if the first parameter is true.
Param 2 (Any): What to return if the first parameter is not true
[Expand]
randint[2]
Description: Returns a random integer between min and max
Parameter count: 2
Param 0 (Number): Minimum
Param 1 (Number): Maximum
[Expand]
cstr[1]
Description: Converts a number to a string.
Parameter count: 1
Param 0 (Number): The number to convert
[Expand]
strlen[1]
Description: Returns the number of characters in a string, as a number.
Parameter count: 1
Param 0 (String): The string to examine
[Expand]
getobjectinternaltype[1]
Description: Returns the internal typeid for a given object as a number. Values are: 0=none, 1=number, 3=string, 7=object.
Parameter count: 1
Param 0 (Any): The object to examine
[Expand]
stopwatchcreate[0]
Description: Creates and returns a stopwatch object. Counting is not started.
Parameter count: 0
[Expand]
stopwatchstart[1]
Description: Starts counting on a stopwatch. Returns the stopwatch
Parameter count: 1
Param 0 (Stopwatch): The stopwatch to start
[Expand]
stopwatchstop[1]
Description: Starts counting on a stopwatch. Returns the stopwatch.
Parameter count: 1
Param 0 (Stopwatch): The stopwatch to stop
[Expand]
stopwatchelapsedseconds[1]
Description: Measures the number of seconds elapsed on a stopwatch.
Parameter count: 1
Param 0 (Stopwatch): The stopwatch to query