getProperty: Difference between revisions
m (Conversion script moved page GetProperty to getProperty: Converting page titles to lowercase) |
m (Text replacement - "<source" to "<syntaxhighlight") |
||
Line 7: | Line 7: | ||
If the [[Token Property]] is empty ({{code|NULL}}) or not defined, an empty string ({{code|""}}) is returned. | If the [[Token Property]] is empty ({{code|NULL}}) or not defined, an empty string ({{code|""}}) is returned. | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
getProperty(property) | getProperty(property) | ||
getProperty(property, id) | getProperty(property, id) | ||
Line 21: | Line 21: | ||
|example= | |example= | ||
Getting a property using the literal property name. | Getting a property using the literal property name. | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
The value of property 'Strength' is [r: getProperty("Strength")]. | The value of property 'Strength' is [r: getProperty("Strength")]. | ||
</source> | </source> | ||
Line 29: | Line 29: | ||
Getting a property using a variable. | Getting a property using a variable. | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h:desiredProperty = "Constitution"] | [h:desiredProperty = "Constitution"] | ||
The value of property 'Constitution' is [r: getProperty(desiredProperty)]. | The value of property 'Constitution' is [r: getProperty(desiredProperty)]. |
Revision as of 18:39, 14 March 2023
This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.
This article needs: Examples of usage.
getProperty() Function
NULL
) or not defined, an empty string (""
) is returned.Usage
<syntaxhighlight lang="mtmacro" line> getProperty(property) getProperty(property, id) getProperty(property, id, mapname) </source>
Parameter
property
- The property that has its value returned. For referencing the literal name of the property (for instance, if you wish to get the property Constitution configured in Campaign Properties), enclose the property name in quotes. If using a variable whose value is the name of the property, do not enclose the variable name in quotes.id
- The tokenid
or name of the token that has its property value returned, defaults to the Current Token.Note: This parameter can only be used in a Trusted Macro.
mapname
- The name of the map to find the token. Defaults to the current map.
Example
<syntaxhighlight lang="mtmacro" line> The value of property 'Strength' is [r: getProperty("Strength")]. </source>
This will output the following if Strength has the value 18:
The value of property 'Strength' is 18.
Getting a property using a variable. <syntaxhighlight lang="mtmacro" line> [h:desiredProperty = "Constitution"] The value of property 'Constitution' is [r: getProperty(desiredProperty)]. </source> This will output the following if Constitution has the value 12:
The value of property 'Constitution' is 12.See Also
Version Changes
- 1.3b51 - Added
id
parameter option. - 1.3b51 - Changed to return the default value if the property has no value.
- 1.5.4 - Added
mapname
parameter option.