setMacroProps: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Added version.)
Line 1: Line 1:
{{MacroFunction
{{MacroFunction
|name=setMacroProps
|name=setMacroProps
|version=1.3b48
|description=
|description=
Sets the properties for the specified [[Token:Macro Button|Macro Button]] on the [[Token:Current Token|Current Token]] . The properties are passed to this function as a [[Macros:string_property_list|String Property List]]. This function accepts either a [[Token:Macro Button Index|Macro Button Index]] or the label of a [[Token:Macro Button|Macro Button]]. If it is a label then all of [[Token:Macro Button|Macro Button]]s on the [[Token:Current Token|Current Token]] with a matching label are changed. If the delimiter is not specified then the default value of ";" is used. As of MapTool 1.3b49 setMacroProps() accepts a [[Macros:json object|json object]] containing the button properties, no delimiter needs to be specified in this case.
Sets the properties for the specified [[Token:Macro Button|Macro Button]] on the [[Token:Current Token|Current Token]] . The properties are passed to this function as a [[Macros:string_property_list|String Property List]]. This function accepts either a [[Token:Macro Button Index|Macro Button Index]] or the label of a [[Token:Macro Button|Macro Button]]. If it is a label then all of [[Token:Macro Button|Macro Button]]s on the [[Token:Current Token|Current Token]] with a matching label are changed. If the delimiter is not specified then the default value of ";" is used. As of MapTool 1.3b49 setMacroProps() accepts a [[Macros:json object|json object]] containing the button properties, no delimiter needs to be specified in this case.
Line 18: Line 19:
|usage=
|usage=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: setMacroProps(index, props)]
setMacroProps(index, props)
[h: setMacroProps(index, props, delim)]
</source>
[h: setMacroProps(label, props)]
<source lang="mtmacro" line>
[h: setMacroProps(label, props, delim)]
setMacroProps(index, props, delim)
</source>
<source lang="mtmacro" line>
setMacroProps(label, props)
</source>
<source lang="mtmacro" line>
setMacroProps(label, props, delim)
</source>
</source>



Revision as of 12:59, 10 March 2009

setMacroProps() Function

Introduced in version 1.3b48
Sets the properties for the specified Macro Button on the Current Token . The properties are passed to this function as a String Property List. This function accepts either a Macro Button Index or the label of a Macro Button. If it is a label then all of Macro Buttons on the Current Token with a matching label are changed. If the delimiter is not specified then the default value of ";" is used. As of MapTool 1.3b49 setMacroProps() accepts a json object containing the button properties, no delimiter needs to be specified in this case.

Valid Properties for Macro Buttons

  • autoExec - true/false - Will the macro be automatically executed when the button is clicked on.
  • color - The name of the color for the button.
  • fontColor - The name of the font color for the button.
  • includeLabel - true/false - Will the label be output when the button is clicked.
  • group - The name of the group that the button is in.
  • sortBy - The sort by value of the macro button.
  • index - The index of the button.
  • label - the lavle of the button.
  • fontSize - The size of the font for the button.
  • minWidth - the minimum width of the button.

Usage

setMacroProps(index, props)
setMacroProps(index, props, delim)
setMacroProps(label, props)
setMacroProps(label, props, delim)

Example

[h: setMacroProps(1, "color=red;fontColor=white")]
[h: setMacroProps("Attack", "color=red;fontColor=white")]