setProperty: Difference between revisions
Jump to navigation
Jump to search
Verisimilar (talk | contribs) m (Updated with recent version changes.) |
Verisimilar (talk | contribs) (Added examples.) |
||
Line 1: | Line 1: | ||
{{MacroFunction | {{MacroFunction | ||
|name=setProperty | |name=setProperty | ||
Line 14: | Line 13: | ||
</source> | </source> | ||
'''Parameters''' | '''Parameters''' | ||
{{param|property| | {{param|property|A string containing the name of the property that has its value set.}} | ||
{{param|value|The value that the property is set to.}} | {{param|value|The value that the property is set to.}} | ||
{{param|id|The token {{code|id}} of the token which has its property set, defaults to the [[Current Token]]. {{TrustedParameter}} }} | {{param|id|The token {{code|id}} of the token which has its property set, defaults to the [[Current Token]]. {{TrustedParameter}} }} | ||
|examples= | |||
Sets a property named {{code|Health}} to the value of {{code|10}} on the [[Current Token]]. | |||
<source lang="mtmacro" line> | |||
[h: setProperty("Health", 10)] | |||
</source> | |||
Sets a property named {{code|Fatigue}} to the value of {{code|5}} on the selected token. | |||
<source lang="mtmacro" line> | |||
[h: setProperty("Fatigue", 5, getSelected())] | |||
</source> | |||
Sets a property named {{code|Strength}} to the value of {{code|20}} on the selected token using variables. | |||
<source lang="mtmacro" line> | |||
[h: Property = "Strength"] | |||
[h: Value = 20] | |||
[h: ID = getSelected()] | |||
[h: setProperty(Property, Value, ID)] | |||
</source> | |||
|also= | |also= |
Revision as of 23:51, 28 May 2009
setProperty() Function
• Introduced in version 1.3b48
Sets the value of a Token Property on a Token.
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 tokenid
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.