addToInitiative: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Conversion script moved page AddToInitiative to addToInitiative: Converting page titles to lowercase)
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 2: Line 2:
{{MacroFunction
{{MacroFunction
|name=addToInitiative
|name=addToInitiative
|description=Adds the [[Current Token]] to the [[Initiative:initiative panel|initiative panel]].  Additional parameters allow you to specify the token and an initiative value.
|description=Adds the [[Current Token]] to the [[Introduction to Initiative|initiative panel]].  Additional parameters allow you to specify the token and an initiative value.


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
addToInitiative()
addToInitiative()
addToInitiative(AllowDuplicates)
addToInitiative(AllowDuplicates)
Line 11: Line 11:
addToInitiative(AllowDuplicates, value, id)
addToInitiative(AllowDuplicates, value, id)
addToInitiative(AllowDuplicates, value, id, mapname)
addToInitiative(AllowDuplicates, value, id, mapname)
</source>
</syntaxhighlight>


'''Parameters'''
'''Parameters'''
Line 21: Line 21:


|example=
|example=
The following example shows how to add a [[Current Token]] to the [[Initiative:initiative panel|initiative panel]], set its initiative and then sort the [[Initiative:initiative panel|initiative panel]]. Normally you would not sort the [[Initiative:initiative panel|initiative panel]] every time you add a [[Current Token]] but its done here to show you how it is done.
The following example shows how to add a [[Current Token]] to the [[Introduction to Initiative|initiative panel]], set its initiative and then sort the [[Introduction to Initiative|initiative panel]]. Normally you would not sort the [[Introduction to Initiative|initiative panel]] every time you add a [[Current Token]] but its done here to show you how it is done.


<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h: addToInitiative()]
[h: addToInitiative()]
[h: setInitiative(1d20)]
[h: setInitiative(1d20)]
[h: sortInitiative()]
[h: sortInitiative()]
</source>
</syntaxhighlight>


|also=
|also=

Latest revision as of 23:08, 4 May 2023

Languages:  English  • 日本語

 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. Additional parameters allow you to specify the token and an initiative value.

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 token id of the token to add to the initiative. 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 and mapname parameter options.

Languages:  English  • 日本語