getLibPropertyNames: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 6: Line 6:


{{note|
{{note|
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 to the MapTool code.  '''getLibPropertyNames''' 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 {{func|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 to macros.  '''getLibPropertyNames''' 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 {{func|getAllPropertyNames}}.
}}
}}



Revision as of 14:45, 18 February 2019

getLibPropertyNames() Function

Introduced in version 1.5.0
Returns a String List or JSON Array containing the names of the Token Properties on a Library Token. The type of the value returned depends on the delimiter parameter.


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 to macros. getLibPropertyNames 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().

Usage

getLibPropertyNames()
getLibPropertyNames(delim)
getLibPropertyNames(id, delim)

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. This parameter may be * or this to indicate the current Lib token that this macro is executing on.

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

Example

[h: names = getLibPropertyNames()]
[foreach(name, names, "<br>"): name]
[h: names = getLibPropertyNames("Lib:some_lib_token")]
[foreach(name, names, "<br>"): name]