Functions for attributes
Functions for checking and setting attributes on objects.
DecreaseHealth
Section titled “DecreaseHealth”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
Section titled “DecreaseMoney”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
Section titled “DecreaseObjectCounter”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
Section titled “DecreaseScore”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
Section titled “GetAttribute”GetAttribute (object, string attribute name)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
Section titled “GetAttributeNames”GetAttributeNames (object, boolean include inherited attributes)Returns a stringlist of all attribute names of the specified object, optionally including attributes set by an included type.
GetBoolean
Section titled “GetBoolean”GetBoolean (object, string attribute name)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
Section titled “GetDouble”GetDouble (object, string attribute name)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
Section titled “GetInt”GetInt (object, string attribute name)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
Section titled “GetString”GetString (object, string attribute name)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
Section titled “HasAttribute”HasAttribute (object, string attribute name)Returns true if the object has the specified attribute.
HasBoolean
Section titled “HasBoolean”HasBoolean (object, string attribute name)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
Section titled “HasDelegateImplementation”HasDelegateImplementation (object, string attribute name)Returns a boolean - true if the specified attribute is a delegate implementation.
See Using delegates
HasDouble
Section titled “HasDouble”HasDouble (object, string attribute name)Returns a boolean - true if the object has a double attribute of the specified name.
See also GetDouble and ToDouble
HasInt
Section titled “HasInt”HasInt (object, string attribute name)Returns a boolean - true if the object has an integer attribute of the specified name.
See also GetInt, IsInt and ToInt
HasObject
Section titled “HasObject”HasObject (object, string attribute name)Returns a boolean - true if the specified attribute is a reference to another object.
See also GetObject
HasScript
Section titled “HasScript”HasScript (object, string attribute name)Returns a boolean - true if the specified attribute is a script.
HasString
Section titled “HasString”HasString (object, string attribute name)Returns a boolean - true if the specified attribute is a string.
See also ToString and GetString
IncreaseHealth
Section titled “IncreaseHealth”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
Section titled “IncreaseMoney”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
Section titled “IncreaseObjectCounter”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
Section titled “IncreaseScore”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
Section titled “SetObjectFlagOff”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 = falseSee also SetObjectFlagOn
SetObjectFlagOn
Section titled “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 = trueSee also SetObjectFlagOff