Skip to content

Functions for attributes

Functions for checking and setting attributes on objects.

DecreaseHealth (integer amount)

Decreases the current player’s health attribute by the specified amount. Raises an error if health is not configured - tick “Health” on the game’s Features tab first.

DecreaseMoney (integer amount)

Decreases the player’s money attribute by the specified amount. Raises an error if money is not configured - tick “Money” on the game’s Features tab first.

DecreaseObjectCounter (object, string counter name)

Decreases the named integer attribute on the object by 1. If the object doesn’t already have that attribute, it is treated as starting at 0 (so the result is -1).

See also IncreaseObjectCounter.

DecreaseScore (integer amount)

Decreases the game’s score attribute by the specified amount. Raises an error if score is not configured - tick “Score” on the game’s Features tab first.

GetAttribute (object, string attribute name)

hard-coded

Returns the value of the specified object attribute. The return type will be the attribute type. Returns null if the attribute does not exist.

GetAttributeNames (object, boolean include inherited attributes)

hard-coded

Returns a stringlist of all attribute names of the specified object, optionally including attributes set by an included type.

GetBoolean (object, string attribute name)

hard-coded

Returns a boolean - true if the object has that boolean attribute set to true, or false if the attribute is set to false, null or some other non-boolean value.

See also HasBoolean

GetDouble (object, string attribute name)

hard-coded

Returns a double if the object has that double attribute. If the attribute is missing, null, or some other type, it returns 0 - not null, so testing the result against null will never match. Use HasDouble to tell “missing” apart from a genuine zero.

See also HasDouble and ToDouble

GetInt (object, string attribute name)

hard-coded

Returns an int if the object has that integer attribute. If the attribute is missing, null, or some other type, it returns 0 - not null, so testing the result against null will never match. Use HasInt to tell “missing” apart from a genuine zero.

See also HasInt, IsInt and ToInt

GetString (object, string attribute name)

hard-coded

Returns the string value of the specified object attribute. Returns null if the attribute does not exist, or is not a string.

See also ToString and HasString

HasAttribute (object, string attribute name)

hard-coded

Returns true if the object has the specified attribute.

HasBoolean (object, string attribute name)

hard-coded

Returns a boolean - true if the object has a boolean attribute of the specified name.

Whether the value of that attribute is true or false is unimportant - this function always returns true if a value has been defined.

See also GetBoolean

HasDelegateImplementation (object, string attribute name)

hard-coded

Returns a boolean - true if the specified attribute is a delegate implementation.

See Using delegates

HasDouble (object, string attribute name)

hard-coded

Returns a boolean - true if the object has a double attribute of the specified name.

See also GetDouble and ToDouble

HasInt (object, string attribute name)

hard-coded

Returns a boolean - true if the object has an integer attribute of the specified name.

See also GetInt, IsInt and ToInt

HasObject (object, string attribute name)

hard-coded

Returns a boolean - true if the specified attribute is a reference to another object.

See also GetObject

HasScript (object, string attribute name)

hard-coded

Returns a boolean - true if the specified attribute is a script.

HasString (object, string attribute name)

hard-coded

Returns a boolean - true if the specified attribute is a string.

See also ToString and GetString

IncreaseHealth (integer amount)

Increases the current player’s health attribute by the specified amount. Raises an error if health is not configured - tick “Health” on the game’s Features tab first.

IncreaseMoney (integer amount)

Increases the player’s money attribute by the specified amount. Raises an error if money is not configured - tick “Money” on the game’s Features tab first.

IncreaseObjectCounter (object, string counter name)

Increases the named integer attribute on the object by 1. If the object doesn’t already have that attribute, it is treated as starting at 0 (so the result is 1).

See also DecreaseObjectCounter.

IncreaseScore (integer amount)

Increases the game’s score attribute by the specified amount. Raises an error if score is not configured - tick “Score” on the game’s Features tab first.

SetObjectFlagOff (object, string flag name)

Turns the object flag off - an object flag is simply a boolean attribute, so:

SetObjectFlagOff(myobject, "myflag")

is equivalent to

myobject.myflag = false

See also SetObjectFlagOn

SetObjectFlagOn (object, string flag name)

Turns the object flag on - an object flag is simply a boolean attribute, so:

SetObjectFlagOn(myobject, "myflag")

is equivalent to

myobject.myflag = true

See also SetObjectFlagOff