getPropertyNames

From RPTools Wiki
Jump to navigation Jump to search

getPropertyNames() Function

Returns a list containing the names of the names of the properties on the Current Token.

The type of the value returned depends on the delimiter parameter.

  • If the delimiter is not specified then a string list is returned with the default value of "," is used.
  • If the delimiter json then a json array is returned.
  • Otherwise a string list is returned with the delimiter passed in.

Usage

[h: names = getPropertyNames()]
[h: names = getPropertyNames(delim)]

delim is the delimiter used to separate the values in the string list which defaults to "," if not specified.

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.

Notes

When token properties are created during campaign, they are persistent in the MapTool campaign, regardless of whether they are editable in the Edit Token window. In other words, even though a property is removed from the campaign properties, it remains available in the MapTool code. getPropertyNames() will return all token properties that exist or have ever existed in the particular campaign, even if users cannot directly edit those properties (i.e., they do not appear in the token's properties when you double click on a token). To get only properties that are currently visible and editable, use getAllPropertyNames().