getInitiativeList: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Update for 1.3b78)
m (Clarified which version introduced this function.)
Line 2: Line 2:
{{MacroFunction
{{MacroFunction
|name=getInitiativeList
|name=getInitiativeList
|version=1.3.b61 (?)
|version=1.3b57
|description=
|description=
Retrieves a list of all tokens currently in the Initiative Panel.  The return value is a JSON object with various information about initiative, including global information (round number, which map is current, which token is current) and token-specific information (token id, initiative value, whether the token is holding or not).
Retrieves a list of all tokens currently in the Initiative Panel.  The return value is a JSON object with various information about initiative, including global information (round number, which map is current, which token is current) and token-specific information (token id, initiative value, whether the token is holding or not).
Line 30: Line 30:


|changes=
|changes=
{{change|1.3b61|Added macro function (could have been b60)}}
{{change|1.3b57|Added macro function.}}
}}
}}
[[Category:Initiative Function]]
[[Category:Initiative Function]]

Revision as of 20:09, 11 January 2011

 This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.
 This article needs: more examples.

getInitiativeList() Function

Introduced in version 1.3b57
Retrieves a list of all tokens currently in the Initiative Panel. The return value is a JSON object with various information about initiative, including global information (round number, which map is current, which token is current) and token-specific information (token id, initiative value, whether the token is holding or not). When called from a Trusted Macro or by a client with GM authority, it will return all information. Otherwise it only returns information visible to the current player. In other words, it respects the Initiative Panel's Hide NPCs and the token's Visible To Owner Only flags, among others. (This is new in 1.3b78. Prior versions didn't have the check for trusted context at all.)

Usage

[ json = getInitiativeList() ]

Parameters None.

Example

The following code will simply return a JSON object and print each property name one at a time on separate lines. Refer to JSON Object for more information about JSON object themselves and json.get for information on retrieving properties and their values.
[h: json = getInitiativeList() ]
[ foreach(item, json, "<br>"): item ]

This example prints a nicely formatted output showing what the contents of the JSON object look like.

[h: json = getInitiativeList() ]
<pre>[r: json.indent(json) ]</pre>


Version Changes

  • 1.3b57 - Added macro function.