getMacroLocation: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Added version.)
m (Updated for changes in 1.3b51)
Line 2: Line 2:
|name=getMacroLocation
|name=getMacroLocation
|version=1.3b48
|version=1.3b48
|description=Returns the location of the macro being executed via [[Macro:Roll:macro {{!}} [macro():] ]]. If the macro typed into chat, run by clicking on a [[macro button]], or run via the [[Token:popup menu{{!}} token popup menu]] then this function will return "chat".
|description=
Returns the location of the macro being executed, the return value will be {{code|"chat"}}, {{code|"global"}}, {{code|"campaign"}} or the label of the token the macro resides on (e.g. {{code|"Lib:Utilities"}} or {{code|"Token:Orc"}}.) Standard PC and NPC tokens will have their label prefixed with {{code|Token:}}.


|usage=
|usage=
Line 11: Line 12:
|example=
|example=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: libToken = getMacroLocation()]
[h: MacroLocation = getMacroLocation()]
[if(libToken == "chat", "You are running from chat", "You are running from library token " + libToken)]
[if(MacroLocation == "chat", "You are running from chat", "You are running from "+MacroLocation]
</source>
</source>
|changes=
{{change|1.3b51|Now accurately reports where the macro button resides.}}
}}
}}
[[Category:Metamacro Function]]
[[Category:Metamacro Function]]

Revision as of 04:38, 16 June 2009

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

getMacroLocation()

Example

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


Version Changes

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