getAllPropertyNames: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Verisimilar (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
= | {{MacroFunction | ||
|name=getAllPropertyNames | |||
|description=Gets a list containing the the [[Token:token property|token property]] names that are defined in the [[Campaign:campaign properties|campaign properties]]. The type of the value returned depends on the delimiter parameter. | |||
Gets a list containing the the [[Token:token property|token property]] names that are defined in the [[Campaign:campaign properties|campaign properties]]. The type of the value returned depends on the delimiter parameter. | |||
* If the delimiter is not specified then a [[Macros:string list|string list]] is returned with the default value of ',' is used. | * If the delimiter is not specified then a [[Macros:string list|string list]] is returned with the default value of ',' is used. | ||
* If the delimiter ''"json"'' then a [[Macros:json array|json array]] is returned. '''(as of MapTool 1.3b49)''' | * If the delimiter ''"json"'' then a [[Macros:json array|json array]] is returned. '''(as of MapTool 1.3b49)''' | ||
* Otherwise a [[Macros:string list|string list]] is returned with the delimiter passed in. | * Otherwise a [[Macros:string list|string list]] is returned with the delimiter passed in. | ||
|usage= | |||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
[h: player = getAllPropertyNames()] | [h: player = getAllPropertyNames()] | ||
Line 16: | Line 15: | ||
If type is specified then the [[Macros:string list|string list]] contains the [[Token:token property|property]] names for that [[Token:token property type|token property type]], otherwise it will contain the [[Token:token property|token property]] names for all [[Token:token property type|token property type]]s. If delim is specified then it is used to separate the values in the [[Macros:string list|string list]], if it is not specified then it defaults to ','. | If type is specified then the [[Macros:string list|string list]] contains the [[Token:token property|property]] names for that [[Token:token property type|token property type]], otherwise it will contain the [[Token:token property|token property]] names for all [[Token:token property type|token property type]]s. If delim is specified then it is used to separate the values in the [[Macros:string list|string list]], if it is not specified then it defaults to ','. | ||
|examples= | |||
You can use the following code to print out all of the properties in the [[Campaign:campaign properties|campaign properties]] list.. | You can use the following code to print out all of the properties in the [[Campaign:campaign properties|campaign properties]] list.. | ||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
Line 30: | Line 29: | ||
[foreach(name, props, "<br>"): name] | [foreach(name, props, "<br>"): name] | ||
</source> | </source> | ||
}} | |||
[[Category:Token Function]] |
Revision as of 02:41, 7 March 2009
getAllPropertyNames() Function
Gets a list containing the the token property names that are defined in the campaign properties. 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. (as of MapTool 1.3b49)
- Otherwise a string list is returned with the delimiter passed in.
Usage
[h: player = getAllPropertyNames()]
[h: player = getAllPropertyNames(type)]
[h: player = getAllPropertyNames(type, delim)]
If type is specified then the string list contains the property names for that token property type, otherwise it will contain the token property names for all token property types. If delim is specified then it is used to separate the values in the string list, if it is not specified then it defaults to ','.
Examples
You can use the following code to print out all of the properties in the campaign properties list..
Campaign Properties<br>
[h: props = getAllPropertyNames()]
[foreach(name, props, "<br>"): name]
If you have two token property sets, for instance "PC" and "NPC", you could print out all of the properties for the "PC" property set like so:
PC Properties<br>
[h: props=getAllPropertyNames("PC")]
[foreach(name, props, "<br>"): name]