setProperty

From RPTools Wiki
Revision as of 19:27, 21 December 2009 by Cclouser (talk | contribs)
Jump to navigation Jump to search

setProperty() Function

Introduced in version 1.3b48
Sets the value of a Token Property on the Current Token (unless trusted, in which case a Token id can be supplied to indicate which token is to be affected. Note that if there is not already an existing property by the name listed in the macro, setProperty will create a new Token Property with that name. Any created Property will not be visible in the Properties tab of the Edit Token window but can still be used like normal. It's value can be retrieved with the getProperty command.

Usage

setProperty(property, value)
setProperty(property, value, id)

Parameters

  • property - A string containing the name of the property that has its value set.
  • value - The value that the property is set to.
  • id - The token id of the token which has its property set, defaults to the Current Token.

     Note: This parameter can only be used in a Trusted Macro

Examples

Sets a property named Health to the value of 10 on the Current Token.
[h: setProperty("Health", 10)]

Sets a property named Fatigue to the value of 5 on the selected token.

[h: setProperty("Fatigue", 5, getSelected())]

Sets a property named Strength to the value of 20 on the selected token using variables.

[h: Property = "Strength"]
[h: Value = 20]
[h: ID = getSelected()]
[h: setProperty(Property, Value, ID)]

See Also

Version Changes

  • 1.3b51 - Added id parameter option.