getInfo: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
|version=1.3b69 | |version=1.3b69 | ||
|description= | |description= | ||
Returns a | Returns a [[JSON Object]] with lots of information about a specified topic. | ||
|usage= | |usage= | ||
Line 10: | Line 10: | ||
</source> | </source> | ||
'''Parameter''' | '''Parameter''' | ||
{{param|topic|A string specifying the topic of the retrieved information. Can be | {{param|topic|A string specifying the topic of the retrieved information. Can be {{code|map}}, {{code|client}}, or {{code|server}}. {{code|campaign}} is an option you can use since 1.3b70.}} | ||
|examples= | |examples= | ||
===Retrieve {{code|map}} Information=== | |||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
<!-- print the | <!-- print the JSON Object about the current map to the chat window --> | ||
<pre> | <pre> | ||
[r:json.indent(getInfo("map"), | [r: json.indent(getInfo("map"), 2)] | ||
</pre> | </pre> | ||
</source> | </source> | ||
Sample output | Sample output: | ||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
map | map | ||
{ | { | ||
"id": "0A00010782897D2C3700000008000102", | "id": "0A00010782897D2C3700000008000102", | ||
"image y scale": 1, | "image y scale": 1, | ||
"height": 0, | "height": 0, | ||
"largest Z order": 2, | "largest Z order": 2, | ||
"width": 0, | "width": 0, | ||
"name": "Grasslands", | "name": "Grasslands", | ||
"creation time": 1276351711618, | "creation time": 1276351711618, | ||
"grid": { | "grid": { | ||
"cell offset height": 0, | "cell offset height": 0, | ||
"cell width": 50, | "cell width": 50, | ||
"color": "ff000000", | "color": "ff000000", | ||
"cell offset width": 0, | "cell offset width": 0, | ||
"units per cell": 5, | "units per cell": 5, | ||
"cell height": 50, | "cell height": 50, | ||
"second dimension": 0, | "second dimension": 0, | ||
"type": "Square", | "type": "Square", | ||
"x offset": 0, | "x offset": 0, | ||
"y offset": 0, | "y offset": 0, | ||
"size": 50 | "size": 50 | ||
}, | }, | ||
"vision type": "off", | "vision type": "off", | ||
"image x scale": 1, | "image x scale": 1, | ||
"player visible": 1 | "player visible": 1 | ||
} | } | ||
</source> | |||
===Retrieve {{code|client}} Information=== | |||
<source lang="mtmacro" line> | |||
<!-- print the JSON Object about client information to the chat window --> | |||
<pre> | |||
[r: json.indent(getInfo("client"), 2)] | |||
</pre> | |||
</source> | |||
Sample output: | |||
<source lang="mtmacro" line> | |||
client | client | ||
{ | { | ||
"movement metric": "ONE_TWO_ONE", | |||
"library tokens": { | |||
"Lib:cifMacroIO": "unknown" | |||
}, | |||
"portrait size": 175, | |||
"user defined functions": [ | |||
"getMacroGroups", | |||
"redefined_1_getMacroGroups", | |||
"l.decode", | |||
"redefined_0_l.decode" | |||
], | |||
"timeDate": "2010-10-13 19:03:38", | |||
"timeInMs": 1286989418105, | |||
"show stat sheet": true, | |||
"face vertex": 1, | |||
"version": "DEVELOPMENT", | |||
"face edge": 1 | |||
} | |||
</source> | |||
'''Note:''' | |||
The {{code|getInfo("client")}} function returns the names of all Lib: tokens. As a bonus if the Lib: token has a property called {{code|libversion}}, the value of this property will be reported as the value. | |||
===Retrieve {{code|server}} Information=== | |||
<source lang="mtmacro" line> | |||
<!-- print the JSON Object about server information to the chat window --> | |||
<pre> | |||
[r: json.indent(getInfo("server"), 2)] | |||
</pre> | |||
</source> | |||
Sample output: | |||
<source lang="mtmacro" line> | |||
server | server | ||
{ | { | ||
"initiative owner permissions": 0, | "initiative owner permissions": 0, | ||
"players can reveal": 0, | "players can reveal": 0, | ||
"movement locked": 0, | "movement locked": 0, | ||
"tooltips for default roll format": 1, | "tooltips for default roll format": 1, | ||
"individual views": 0, | "individual views": 0, | ||
"players receive campaign macros": 0, | "players receive campaign macros": 0, | ||
"strict token management": 0, | "strict token management": 0, | ||
"restricted impersonation": 0 | "restricted impersonation": 0 | ||
} | } | ||
</source> | </source> | ||
|changes= | |changes= | ||
* '''1.3b70''' - Added campaign option for {{code|topic}} | * '''1.3b70''' - Added campaign option for {{code|topic}} | ||
* '''1.3b76''' - Added values 'timeInMS' and 'timeDate' to both server | * '''1.3b76''' - Added values 'timeInMS' and 'timeDate' to both {{code|client}} and {{code|server}} return values | ||
}} | }} |
Revision as of 20:31, 13 January 2011
getInfo() Function
• Introduced in version 1.3b69
Returns a JSON Object with lots of information about a specified topic.
Usage
getInfo(topic)
Parameter
topic
- A string specifying the topic of the retrieved information. Can bemap
,client
, orserver
.campaign
is an option you can use since 1.3b70.
Examples
===Retrieve
Retrieve
Retrieve
map
Information===
<!-- print the JSON Object about the current map to the chat window -->
<pre>
[r: json.indent(getInfo("map"), 2)]
</pre>
Sample output:
map
{
"id": "0A00010782897D2C3700000008000102",
"image y scale": 1,
"height": 0,
"largest Z order": 2,
"width": 0,
"name": "Grasslands",
"creation time": 1276351711618,
"grid": {
"cell offset height": 0,
"cell width": 50,
"color": "ff000000",
"cell offset width": 0,
"units per cell": 5,
"cell height": 50,
"second dimension": 0,
"type": "Square",
"x offset": 0,
"y offset": 0,
"size": 50
},
"vision type": "off",
"image x scale": 1,
"player visible": 1
}
Retrieve client
Information
<!-- print the JSON Object about client information to the chat window -->
<pre>
[r: json.indent(getInfo("client"), 2)]
</pre>
Sample output:
client
{
"movement metric": "ONE_TWO_ONE",
"library tokens": {
"Lib:cifMacroIO": "unknown"
},
"portrait size": 175,
"user defined functions": [
"getMacroGroups",
"redefined_1_getMacroGroups",
"l.decode",
"redefined_0_l.decode"
],
"timeDate": "2010-10-13 19:03:38",
"timeInMs": 1286989418105,
"show stat sheet": true,
"face vertex": 1,
"version": "DEVELOPMENT",
"face edge": 1
}
Note:
The getInfo("client")
function returns the names of all Lib: tokens. As a bonus if the Lib: token has a property called libversion
, the value of this property will be reported as the value.
Retrieve server
Information
<!-- print the JSON Object about server information to the chat window -->
<pre>
[r: json.indent(getInfo("server"), 2)]
</pre>
Sample output:
server
{
"initiative owner permissions": 0,
"players can reveal": 0,
"movement locked": 0,
"tooltips for default roll format": 1,
"individual views": 0,
"players receive campaign macros": 0,
"strict token management": 0,
"restricted impersonation": 0
}
Version Changes
- 1.3b70 - Added campaign option for
topic
- 1.3b76 - Added values 'timeInMS' and 'timeDate' to both
client
andserver
return values