createMacro: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Added version.)
No edit summary
Line 1: Line 1:
{{stub|Examples using the new functionality.}}
{{MacroFunction
{{MacroFunction
|name=createMacro
|name=createMacro
|version=1.3b48
|version=1.3b48
|description=Creates a [[macro button]] for the [[Token:Current Token|Current Token]] and returns the index of the newly created button.
|description=
Creates a [[macro button]] for the [[Current Token]] and returns the index of the newly created button.


|usage=
|usage=
Line 14: Line 16:
createMacro(label, command, props, delim)
createMacro(label, command, props, delim)
</source>
</source>
Where
'''Parameters'''
* label is the label for the macro button.
{{param|label|The label for the macro button.}}
* command is the command to run when the macro button is clicked.
{{param|command|The command to run when the macro button is clicked, or the macro is called.}}
* props is a [[Macros:string property list |string property list ]] containing the properties for the button.
{{param|props|A [[String Property List]] or [[JSON object]] containing the properties for the button.
* delim is the delimiter used to separate the values in the  [[Macros:string property list|string property list]] which defaults to ';' if not specified.
** {{code|autoExec}} - If the macro will be automatically executed when the button is clicked, accepts {{true}} or {{false}}.
 
** {{code|color}} - The name of the color for the button.
'''Valid Properties for Macro Buttons'''
** {{code|fontColor}} - The name of the font color for the button.
* autoExec - true/false - Will the macro be automatically executed when the button is clicked on.
** {{code|includeLabel}} - If the label will be output when the button is clicked. Accepts {{true}} or {{false}}.
* color - The name of the color for the button.
** {{code|group}} - The name of the group that the button belongs to.
* fontColor - The name of the font color for the button.
** {{code|sortBy}} - The sort by value of the macro button.
* includeLabel - true/false - Will the label be output when the button is clicked.
** {{code|fontSize}} - The size of the font for the button.
* group - The name of the group that the button is in.
** {{code|minWidth}} - The minimum width of the buttom.}}
* sortBy - The sort by value of the macro button.
{{param|delim|The delimiter used to separate the values in the [[String Property List]]. Accepts {{code|"json"}} as a value if you want to pass the props as a [[JSON object]]. Defaults to {{code|","}}.}}
* fontSize - The size of the font for the button.
* minWidth - the minimum width of the button.


|example=
|example=
Line 37: Line 37:
Will create the following buttons on the current token.
Will create the following buttons on the current token.
[[Image:createMacros.png]]
[[Image:createMacros.png]]
|changes=
{{change|1.3b49|Added {{code|json}} delimiter option.}}
}}
}}
[[Category:Metamacro Function]]
[[Category:Metamacro Function]]

Revision as of 00:54, 23 March 2009

 This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.
 This article needs: Examples using the new functionality.

createMacro() Function

Introduced in version 1.3b48
Creates a macro button for the Current Token and returns the index of the newly created button.

Usage

createMacro(label, command)
createMacro(label, command, props)
createMacro(label, command, props, delim)

Parameters

  • label - The label for the macro button.
  • command - The command to run when the macro button is clicked, or the macro is called.
  • props - A String Property List or JSON object containing the properties for the button.
    • autoExec - If the macro will be automatically executed when the button is clicked, accepts true(1) or false(0).
    • color - The name of the color for the button.
    • fontColor - The name of the font color for the button.
    • includeLabel - If the label will be output when the button is clicked. Accepts true(1) or false(0).
    • group - The name of the group that the button belongs to.
    • sortBy - The sort by value of the macro button.
    • fontSize - The size of the font for the button.
    • minWidth - The minimum width of the buttom.
  • delim - The delimiter used to separate the values in the String Property List. Accepts "json" as a value if you want to pass the props as a JSON object. Defaults to ",".

Example

[createMacro("Test", "this is a test", "autoExec=true;color=blue", ";") ]
[createMacro("Another Test", "this is a test", "autoExec=true;color=red;fontColor=white", ";") ]

Will create the following buttons on the current token.


Version Changes

  • 1.3b49 - Added json delimiter option.