init.current: Difference between revisions
Jump to navigation
Jump to search
(Created page with "The special variable ''init.current'' holds the index of the token in the Initiative window that currently has initiative. Is set to {{code|-1}} if there are no tokens in the...") |
No edit summary |
||
(6 intermediate revisions by 3 users not shown) | |||
Line 3: | Line 3: | ||
==Example== | ==Example== | ||
'''Simple Count''' | '''Simple Count''' | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[if(init.current != -1), code: { | [if(init.current != -1), code: { | ||
[h: json = getInitiativeList()] | [h: json = getInitiativeList()] | ||
[h: tarray = json.get(json,"tokens")] | [h: tarray = json.get(json,"tokens")] | ||
[h: tok = json.get(tarray,init.current)] | [h: tok = json.get(tarray,init.current)] | ||
Token with Initiative: [r: getName(json.get(tok,"tokenId"))] | Token with Initiative: [r: getName(json.get(tok,"tokenId"))]<br> | ||
Initiative Round: [r: init.round] | |||
};{ | };{ | ||
No token with initiative. | No token with initiative. | ||
}] | }] | ||
</ | </syntaxhighlight> | ||
==Related Pages== | ==Related Pages== | ||
[[:Category:Initiative_Function|Initiative Functions]] | |||
[[Category:Special Variable]] | [[Category:Special Variable]] | ||
Pages with ignored display titles |
Latest revision as of 23:59, 4 July 2023
The special variable init.current holds the index of the token in the Initiative window that currently has initiative. Is set to -1
if there are no tokens in the Initiative window.
Example
Simple Count
[if(init.current != -1), code: {
[h: json = getInitiativeList()]
[h: tarray = json.get(json,"tokens")]
[h: tok = json.get(tarray,init.current)]
Token with Initiative: [r: getName(json.get(tok,"tokenId"))]<br>
Initiative Round: [r: init.round]
};{
No token with initiative.
}]
Related Pages
Initiative Functions Pages with ignored display titles