getPropertyNames: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Added version.)
Line 1: Line 1:
{{MacroFunction
{{MacroFunction
|name=getPropertyNames
|name=getPropertyNames
|version=1.3b48
|description=
|description=
Returns a list containing the names of the names of the [[Token:property|properties]] on the [[Token:Current Token|Current Token]].  
Returns a list containing the names of the names of the [[Token:property|properties]] on the [[Token:Current Token|Current Token]].  
Line 10: Line 11:
|usage=
|usage=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: names = getPropertyNames()]
getPropertyNames()
[h: names = getPropertyNames(delim)]
</source>
<source lang="mtmacro" line>
getPropertyNames(delim)
</source>
</source>
{{code|delim}} is the delimiter used to separate the values in the  [[Macros:string list|string list]] which defaults to {{code|","}} if not specified.
{{code|delim}} is the delimiter used to separate the values in the  [[Macros:string list|string list]] which defaults to {{code|","}} if not specified.
Line 23: Line 26:


|changes=
|changes=
* '''1.3b49''' - Added {{code|json}} delimiter option.
{{change|1.3b49|Added {{code|json}} delimiter option.}}
}}
}}
===Notes===
===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|getAllPropertyNames()]].
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|getAllPropertyNames()]].
[[Category:Token Function]]
[[Category:Token Function]]

Revision as of 11:57, 10 March 2009

getPropertyNames() Function

Introduced in version 1.3b48
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

getPropertyNames()
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().