setGMName: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Completed the article.)
No edit summary
 
(5 intermediate revisions by 3 users not shown)
Line 7: Line 7:


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
setGMName(name)
setGMName(name)
</source>
setGMName(name, tokenRef)
<source lang="mtmacro" line>
setGMName(name, tokenRef, mapRef)
setGMName(name, id)
</syntaxhighlight>
</source>
'''Parameters'''
'''Parameters'''
{{param|name|A string that is set as the GM Name on the token.}}
{{param|name|A string that is set as the GM Name on the token.}}
{{param|id|The token id of the token that has its GM Name set. Defaults to the [[Current Token]].}}
{{param|tokenRef|Either the token [[getSelected|{{code|id}}]] or [[getTokenName|Token Name]] of the token that has its GM Name set. Defaults to the [[Current Token]].}}
{{param|mapRef|The Name or ID of the map to find the token.  Defaults to the current map.}}
{{Note|Token IDs are unique, but Token Names can be duplicated. Using Token Name when more than one token has the same name can produce unexpected results.}}


|examples=
|examples=
Sets the GM Name of the [[Current Token]] to {{code|New GM Name}}.
Sets the GM Name of the [[Current Token]] to {{code|New GM Name}}.
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h: setGMName("New GM Name")]
[h: setGMName("New GM Name")]
</source>
</syntaxhighlight>


Sets the GM Name of all selected tokens to {{code|New GM Name}}.
Sets the GM Name of all selected tokens to {{code|New GM Name}}.
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h: SelectedTokens = getSelected()]
[h: SelectedTokens = getSelected()]
[h,foreach(TokenID, SelectedTokens), code:
[h,foreach(TokenID, SelectedTokens), code:
Line 30: Line 31:
[h: setGMName("New GM Name", TokenID)]
[h: setGMName("New GM Name", TokenID)]
}]
}]
</source>
</syntaxhighlight>


|also=
|also=
Line 37: Line 38:
|changes=
|changes=
{{change|1.3b51|Added {{code|id}} parameter option.}}
{{change|1.3b51|Added {{code|id}} parameter option.}}
{{change|1.5.9|Added {{code|mapname}} parameter option.}}
}}
}}
[[Category:Token Function]]
[[Category:Token Function]]

Latest revision as of 23:59, 11 May 2024

setGMName() Function

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

Introduced in version 1.3b49
Sets the GM Name of a token.

Usage

setGMName(name)
setGMName(name, tokenRef)
setGMName(name, tokenRef, mapRef)

Parameters

  • name - A string that is set as the GM Name on the token.
  • tokenRef - Either the token id or Token Name of the token that has its GM Name set. Defaults to the Current Token.
  • mapRef - The Name or ID of the map to find the token. Defaults to the current map.
Token IDs are unique, but Token Names can be duplicated. Using Token Name when more than one token has the same name can produce unexpected results.

Examples

Sets the GM Name of the Current Token to New GM Name.
[h: setGMName("New GM Name")]

Sets the GM Name of all selected tokens to New GM Name.

[h: SelectedTokens = getSelected()]
[h,foreach(TokenID, SelectedTokens), code:
{
[h: setGMName("New GM Name", TokenID)]
}]

See Also

Version Changes

  • 1.3b51 - Added id parameter option.
  • 1.5.9 - Added mapname parameter option.