getInitiativeList: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
m (Update for 1.3b78) |
||
Line 2: | Line 2: | ||
{{MacroFunction | {{MacroFunction | ||
|name=getInitiativeList | |name=getInitiativeList | ||
|version=1.3.b61 (?) | |version=1.3.b61 (?) | ||
|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). | ||
( | 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 {{code|Hide NPCs}} and the token's {{code|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= | |usage= | ||
Line 17: | Line 16: | ||
|example= | |example= | ||
The following code will simply return a JSON object and print each property name one at a time on separate lines. Refer to [[ | 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. | ||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
[h: json = getInitiativeList() ] | [h: json = getInitiativeList() ] |
Revision as of 00:09, 15 December 2010
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.3.b61 (?)
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.3b61 - Added macro function (could have been b60)