getMacroButtonIndex: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(New page: ==Function getMacroButtonIndex== '''Introduced in MapTool 1.3b50''' Returns the index of the macro button that was clicked on for the token. The macro button must have the auto execute ...)
 
No edit summary
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
==Function getMacroButtonIndex==
{{stub|Expanded examples of usage.}}
{{MacroFunction
|name=getMacroButtonIndex
|version=1.3b50
|description=
Returns the index of the [[Token]] macro button that was clicked on. The macro button must have the auto-execute check box selected. If the macro is not running from a [[Token]] macro button then {{code|-1}} is returned.


|usage=
<syntaxhighlight lang="mtmacro" line>
getMacroButtonIndex()
</syntaxhighlight>


 
|example=
'''Introduced in MapTool 1.3b50'''
<syntaxhighlight lang="mtmacro" line>
Returns the index of the macro button that was clicked on for the token. The macro button must have the auto execute check box selected. If the macro is not running from a token macro button then -1 is returned.
 
===Usage===
<source lang="mtmacro" line>
[h: ind = getMacroButtonIndex()]
[h: ind = getMacroButtonIndex()]
</source>
</syntaxhighlight>
 
If the macro is not run from an auto-execute macro button on a [[Token]], {{code|ind}} is set to {{code|-1}}. Otherwise {{code|ind}} is set to a non-negative number which is the index of the button.


===Examples===
|also=
<source lang="mtmacro" line>
{{func|getMacroIndexes}}
[h: ind = getMacroButtonIndex()]
</source>


Returns
}}
  -1 if the macro is not run from an auto execute macro button on a token, or a non negative number which is the index of the button.
[[Category:Metamacro Function]]

Latest revision as of 23:59, 14 March 2023

 This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.
 This article needs: Expanded examples of usage.

getMacroButtonIndex() Function

Introduced in version 1.3b50
Returns the index of the Token macro button that was clicked on. The macro button must have the auto-execute check box selected. If the macro is not running from a Token macro button then -1 is returned.

Usage

getMacroButtonIndex()

Example

[h: ind = getMacroButtonIndex()]
If the macro is not run from an auto-execute macro button on a Token, ind is set to -1. Otherwise ind is set to a non-negative number which is the index of the button.

See Also