addToInitiative: Difference between revisions
Jump to navigation
Jump to search
Lmarkus001 (talk | contribs) No edit summary |
No edit summary |
||
Line 8: | Line 8: | ||
|usage= | |usage= | ||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
addToInitiative() | |||
addToInitiative(AllowDuplicates) | |||
addToInitiative(AllowDuplicates, value) | |||
addToInitiative(AllowDuplicates, value, id) | |||
addToInitiative(AllowDuplicates, value, id, mapname) | |||
</source> | </source> | ||
'''Parameters''' | '''Parameters''' | ||
{{param|AllowDuplicates|If false (default) then will not add the token if it is already in the initiative list. If true (1) an additional entry will be added to the initiative list (so there could be multiple initiative entries for the same token).}} | |||
{{param|value|The initiative value to set. If included, the initiative will be set even if the token is already on the initiative list and duplicates are not allowed.}} | |||
{{param|id|The token {{code|id}} of the token to check for the state. Defaults to the [[Current Token]]. {{TrustedParameter}} }} | |||
{{param|mapname|The name of the map to find the token. Defaults to the current map.}} | |||
* {{code|return}} - Returns 1 if added to the initiative, 0 if did not. | * {{code|return}} - Returns 1 if added to the initiative, 0 if did not. | ||
Line 28: | Line 34: | ||
|also= | |also= | ||
[[setInitiative | setInitiative()]] [[addAllPCsToInitiative | addAllPCsToInitiative()]] [[addAllToInitiative | addAllToInitiative()]] | [[setInitiative | setInitiative()]] [[addAllPCsToInitiative | addAllPCsToInitiative()]] [[addAllToInitiative | addAllToInitiative()]] | ||
|changes= | |||
{{change|1.5.7|Added {{code|id}} and {{code|mapname}} parameter options.}} | |||
}} | }} | ||
[[Category:Initiative Function]] | [[Category:Initiative Function]] |
Revision as of 17:15, 10 October 2019
This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.
addToInitiative() Function
Adds the Current Token to the initiative panel.
This function will not assign any initiative value to the tokens, you can use the setInitiative() function
to set the initiative value of tokens.Usage
addToInitiative()
addToInitiative(AllowDuplicates)
addToInitiative(AllowDuplicates, value)
addToInitiative(AllowDuplicates, value, id)
addToInitiative(AllowDuplicates, value, id, mapname)
Parameters
AllowDuplicates
- If false (default) then will not add the token if it is already in the initiative list. If true (1) an additional entry will be added to the initiative list (so there could be multiple initiative entries for the same token).value
- The initiative value to set. If included, the initiative will be set even if the token is already on the initiative list and duplicates are not allowed.id
- The tokenid
of the token to check for the state. Defaults to the Current Token.Note: This parameter can only be used in a Trusted Macro.
mapname
- The name of the map to find the token. Defaults to the current map.return
- Returns 1 if added to the initiative, 0 if did not.
Example
The following example shows how to add a Current Token to the initiative panel, set
its initiative and then sort the initiative panel. Normally you would not sort the initiative panel every time you add a Current Token but its done here to show you how it is done.
[h: addToInitiative()]
[h: setInitiative(1d20)]
[h: sortInitiative()]
See Also
Version Changes
- 1.5.7 - Added
id
andmapname
parameter options.