getMacroName: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Macros:Functions:getMacroName moved to getMacroName: Taking it out of Macros namespace.)
m (Added MacroFunction template.)
Line 1: Line 1:
==Function getMacroName==
{{MacroFunction
 
|name=getMacroName
|description=
Returns the name 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".
Returns the name 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".


===Usage===
|usage=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: macroName = getMacroName()]
[h: macroName = getMacroName()]
</source>
</source>
===Examples===
|examples=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: macroName = getMacroName()]
[h: macroName = getMacroName()]
[if(macroName == "chat", "You are running from chat", "You are running the macro called " + macroName)]
[if(macroName == "chat", "You are running from chat", "You are running the macro called " + macroName)]
</source>
</source>
}}

Revision as of 16:13, 7 March 2009

getMacroName() Function

Returns the name of the macro being executed via [macro():] . If the macro typed into chat, run by clicking on a macro button, or run via the token popup menu then this function will return "chat".

Usage

[h: macroName = getMacroName()]

Examples

[h: macroName = getMacroName()]
[if(macroName == "chat", "You are running from chat", "You are running the macro called " + macroName)]