setMacroCommand: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Added version change.)
m (Updated with recent version changes.)
Line 8: Line 8:
|usage=
|usage=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
setMacroCommand(buttonIndex, command)
setMacroCommand(index, command)
</source>
</source>
<source lang="mtmacro" line>
setMacroCommand(index, command, id)
</source>
'''Parameters'''
{{param|index|The index of the macro button.}}
{{param|command|A string containing the command to set on the macro button.}}
{{param|id|The token {{code|id}} of the token that the command is set on.}}


|examples=
|examples=
Line 18: Line 25:
|changes=
|changes=
{{change|1.3b49|Changed to a trusted function.}}
{{change|1.3b49|Changed to a trusted function.}}
{{change|1.3b51|Added {{code|id}} parameter option.}}
}}
}}
[[Category:Metamacro Function]]
[[Category:Metamacro Function]]

Revision as of 00:00, 31 March 2009

setMacroCommand() Function

 Note: This function can only be used in a Trusted Macro

Introduced in version 1.3b48
Sets the command that will be run when the Macro Button is pressed. Note because of the way the parser interprets values within [] you may have to use the encode() and decode() functions with the string.

Usage

setMacroCommand(index, command)
setMacroCommand(index, command, id)

Parameters

  • index - The index of the macro button.
  • command - A string containing the command to set on the macro button.
  • id - The token id of the token that the command is set on.

Examples

[h: setMacroCommand(1, "[macro('Test@Lib:Test'): '']")]

Version Changes

  • 1.3b49 - Changed to a trusted function.
  • 1.3b51 - Added id parameter option.