getPropertyNames

From RPTools Wiki
Revision as of 17:18, 18 February 2019 by Phergus (talk | contribs) (Updated note to reflect that properties persist in tokens and not campaigns. Added links and references to relevant pages. Noted that names returned are in lower case.)
Jump to navigation Jump to search

getPropertyNames() Function

Introduced in version 1.3b48
Returns a String List or JSON Array containing the names of the Token Properties on a Token. The type of the value returned depends on the delimiter parameter. All names returned will be in lower case. Use getPropertyNamesRaw() to get the names as they are shown in Introduction_to_Properties.


When a token is added to a campaign it inherits the currently defined properties of the current campaign. These properties are persistent in the token even if the properties are subsequently removed from the campaign. Properties that have been removed from the campaign are no longer editable via the Edit Token dialog but they are still present on the token and may be read and set with getProperty() and setProperty() respectively. To get all properties defined on a token, including those removed from the campaign, use getPropertyNames(). To see only the currently defined properties for the campaign, use getAllPropertyNames().

Usage

getPropertyNames()
getPropertyNames(delim)
getPropertyNames(delim, id)

Parameters

  • delim - The delimiter used to separate the values in the String List, defaults to ",". Returns a JSON Array if set to "json".
  • id - The token id of the token which has its property names returned, defaults to the Current Token.

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

Example

To display the names of all of the properties on the current token use.
[h: names = getPropertyNames()]
[foreach(name, names, "<br>"): name]


Version Changes

  • 1.3b49 - Added json delimiter option.
  • 1.3b51 - Added id parameter option.