getTokenStates: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Initial write-up.)
 
(Updated for new features in b55 and added more information.)
Line 1: Line 1:
{{stub}}
{{MacroFunction
{{MacroFunction
|name=getTokenStates
|name=getTokenStates
|version=1.3b51
|version=1.3b51
|description=
|description=
Returns the valid states in the campaign settings.
Returns the valid states in the campaign settings in either a [[String List]] or [[JSON Array]].  


|usage=
|usage=
Line 12: Line 11:
<source lang="mtmacro" line>
<source lang="mtmacro" line>
getTokenStates(delim)
getTokenStates(delim)
</source>
<source lang="mtmacro" line>
getTokenStates(delim, groupName)
</source>
</source>
'''Parameter'''
'''Parameter'''
* {{code|delim}} - Specifies the delimiter used in the string list that is returned, defaultis {{code|","}}. If the value is set to {{code|json}}, the function returns a JSON array instead.
* {{code|delim}} - Specifies the delimiter used in the string list that is returned, defaultis {{code|","}}. If the value is set to {{code|json}}, the function returns a JSON array instead.
* {{code|groupName}} - Specifies the name of the group to get the states for.
|example=
To get a [[String List]] of the valid [[Token State]]s in the campaign.
<source lang="mtmacro" line>
[h: states = getTokenStates()]
</source>
To get a [[JSON Array]] of the valid [[Token State]]s in the campaign.
<source lang="mtmacro" line>
[h: states = getTokenStates("json")]
</source>
To get a [[JSON Array]] of the valid [[Token State]]s in the ''Damage'' group in the campaign in 1.3b55 or later.
<source lang="mtmacro" line>
[h: states = getTokenStates("json", "Damage")]
</source>
|changes=
* '''1.3b55''' - Added the {{code|groupName}} parameter.


}}
}}
[[Category:State Function]]
[[Category:State Function]]

Revision as of 01:48, 13 April 2009

getTokenStates() Function

Introduced in version 1.3b51
Returns the valid states in the campaign settings in either a String List or JSON Array.

Usage

getTokenStates()
getTokenStates(delim)
getTokenStates(delim, groupName)

Parameter

  • delim - Specifies the delimiter used in the string list that is returned, defaultis ",". If the value is set to json, the function returns a JSON array instead.
  • groupName - Specifies the name of the group to get the states for.

Example

To get a String List of the valid Token States in the campaign.
[h: states = getTokenStates()]

To get a JSON Array of the valid Token States in the campaign.

[h: states = getTokenStates("json")]

To get a JSON Array of the valid Token States in the Damage group in the campaign in 1.3b55 or later.

[h: states = getTokenStates("json", "Damage")]


Version Changes

  • 1.3b55 - Added the groupName parameter.