token.init: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
The variable ''token.init'' holds the value of the token's initiative when the token is present in the Initiative Panel. Note that token.init is only valid for tokens that are added to the Initiative Panel (querying ''token.init'' when the token is not in the Initiative Panel will return an error).  
The variable ''token.init'' holds the value of the token's initiative when the token is present in the Initiative Panel. Note that ''token.init'' is only valid for tokens that are added to the Initiative Panel (querying ''token.init'' when the token is not in the Initiative Panel will return an error).  


==Usage==
==Usage==
Line 5: Line 5:
To set a token's ''token.init'' value, do the following:
To set a token's ''token.init'' value, do the following:


<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[token.init=value]
[token.init=value]
</source>
</syntaxhighlight>


where ''value'' is a number.  
where ''value'' is a number.  
Line 15: Line 15:
After adding the token to the Initiative Panel (either by right-clicking on the token and selecting '''Add to Initiative''', or by using the [[Macros:Functions:addToInitiative|addToInitiative()]] function), you can set the token's initiative via a macro such as the following:
After adding the token to the Initiative Panel (either by right-clicking on the token and selecting '''Add to Initiative''', or by using the [[Macros:Functions:addToInitiative|addToInitiative()]] function), you can set the token's initiative via a macro such as the following:


<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h:token.init = 1d20 + initBonus]
[h:token.init = 1d20 + initBonus]
</source>
</syntaxhighlight>


where ''initBonus'' is assumed to be a variable passed to the initiative macro, or a [[Token:token_property|token property]] of the token being added. The new initiative value will appear in the initiative panel next to the token name.
where ''initBonus'' is assumed to be a variable passed to the initiative macro, or a [[Token:token_property|token property]] of the token being added. The new initiative value will appear in the initiative panel next to the token name.
Line 23: Line 23:
==Related Pages==
==Related Pages==


* [[Initiative:initiative_panel|Initiative Panel]]
* [[Introduction to Initiative|Initiative Panel]]
* [[Macros:Special_Variables:token.initHold|token.initHold]]
* [[token.initHold]]
* [[Macros:Variables:list_of_special_variables|List of Special Variables]]
[[Category:Special Variable]]
[[Category:Macro Function]]

Latest revision as of 23:59, 4 July 2023

The variable token.init holds the value of the token's initiative when the token is present in the Initiative Panel. Note that token.init is only valid for tokens that are added to the Initiative Panel (querying token.init when the token is not in the Initiative Panel will return an error).

Usage

To set a token's token.init value, do the following:

[token.init=value]

where value is a number.

Examples

After adding the token to the Initiative Panel (either by right-clicking on the token and selecting Add to Initiative, or by using the addToInitiative() function), you can set the token's initiative via a macro such as the following:

[h:token.init = 1d20 + initBonus]

where initBonus is assumed to be a variable passed to the initiative macro, or a token property of the token being added. The new initiative value will appear in the initiative panel next to the token name.

Related Pages