getInitiativeList

From RPTools Wiki
Revision as of 20:09, 11 January 2011 by Verisimilar (talk | contribs) (Clarified which version introduced this function.)
Jump to navigation Jump to search

 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.