getMacroProps: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 4: Line 4:
|description=
|description=
Returns a property list of the properties for a [[macro button]] for the [[Token:Current Token|Current Token]]. You can retrieve the index of a [[macro button]] with the [[Macros:Functions:getMacroIndexes|getMacroIndexes()]] function.The type of the value returned depends on the delimiter parameter.  
Returns a property list of the properties for a [[macro button]] for the [[Token:Current Token|Current Token]]. You can retrieve the index of a [[macro button]] with the [[Macros:Functions:getMacroIndexes|getMacroIndexes()]] function.The type of the value returned depends on the delimiter parameter.  
* If the delimiter is not specified then a [[Macros:string propert list|string propert list]] is returned with the default value of 'l' is used.
* If the delimiter {{code|"json"}} then a [[Macros:json object|json object]] is returned.
* Otherwise a [[Macros:string property list|string property list]] is returned with the delimiter passed in.


|usage=
|usage=
Line 21: Line 18:
getMacroProps(index, delim)
getMacroProps(index, delim)
</source>
</source>
Where
<source lang="mtmacro" line>
* label is the label for the macro button. If you specify a label then '''all''' [[macro buttons]] on the [[Token:token|token]] that have that label will be updated.
getMacroProps(label, delim, id)
* index is the index of the [[macro button]].
</source>
* delim is the delimiter used to separate the values in the  [[Macros:string property list|string property list]] which defaults to ';' if not specified.
<source lang="mtmacro" line>
getMacroProps(index, delim, id)
</source>
'''Parameters'''
{{param|label|The label for the macro button. If you specify a label then '''all''' [[macro buttons]] on the [[Token:token|token]] that have that label will be returned.}}
{{param|index|The index of the [[macro button]].}}
{{param|delim|The delimiter used to separate the values in the  [[Macros:string property list|string property list]] which defaults to {{code|";"}} if not specified. This function returns a [[JSON object]] if {{code|"json"}} is specified.}}
{{param|id|The token {{code|id}} of the token that the function is executed on. {{TrustedParameter}} }}


'''Valid Properties for Macro Buttons'''
'''Valid Properties for Macro Buttons'''
Line 40: Line 44:
|changes=
|changes=
{{change|1.3b49|Added {{code|json}} delimiter option.}}
{{change|1.3b49|Added {{code|json}} delimiter option.}}
{{change|1.3b51|Added optional token {{code|id}} parameter.}}
}}
}}
[[Category:Metamacro Function]]
[[Category:Metamacro Function]]

Revision as of 01:18, 23 March 2009

getMacroProps() Function

Introduced in version 1.3b48
Returns a property list of the properties for a macro button for the Current Token. You can retrieve the index of a macro button with the getMacroIndexes() function.The type of the value returned depends on the delimiter parameter.

Usage

getMacroProps(label)
getMacroProps(index)
getMacroProps(label, delim)
getMacroProps(index, delim)
getMacroProps(label, delim, id)
getMacroProps(index, delim, id)

Parameters

  • label - The label for the macro button. If you specify a label then all macro buttons on the token that have that label will be returned.
  • index - The index of the macro button.
  • delim - The delimiter used to separate the values in the string property list which defaults to ";" if not specified. This function returns a JSON object if "json" is specified.
  • id - The token id of the token that the function is executed on.

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

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.


Version Changes

  • 1.3b49 - Added json delimiter option.
  • 1.3b51 - Added optional token id parameter.