getMacroLocation: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Conversion script moved page GetMacroLocation to getMacroLocation: Converting page titles to lowercase)
m (Text replacement - "source>" to "syntaxhighlight>")
Line 8: Line 8:
<source lang="mtmacro" line>
<source lang="mtmacro" line>
getMacroLocation()
getMacroLocation()
</source>
</syntaxhighlight>


|example=
|example=
Line 14: Line 14:
[h: MacroLocation = getMacroLocation()]
[h: MacroLocation = getMacroLocation()]
[if(MacroLocation == "chat", "You are running from chat", "You are running from "+MacroLocation]
[if(MacroLocation == "chat", "You are running from chat", "You are running from "+MacroLocation]
</source>
</syntaxhighlight>


|changes=
|changes=

Revision as of 18:27, 14 March 2023

getMacroLocation() Function

Introduced in version 1.3b48
Returns the location of the macro being executed, the return value will be "chat", "global", "campaign" or the label of the token the macro resides on (e.g. "Lib:Utilities" or "Token:Orc".) Standard PC and NPC tokens will have their label prefixed with Token:.

Usage

<source lang="mtmacro" line> getMacroLocation() </syntaxhighlight>

Example

<source lang="mtmacro" line>

[h: MacroLocation = getMacroLocation()] [if(MacroLocation == "chat", "You are running from chat", "You are running from "+MacroLocation]

</syntaxhighlight>


Version Changes

  • 1.3b51 - Now accurately reports where the macro button resides.