herolab.getMasterName: Difference between revisions
Jump to navigation
Jump to search
m (Conversion script moved page herolab.getMasterName to Herolab.getMasterName without leaving a redirect: Converting page title to first-letter uppercase) |
No edit summary |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 7: | Line 7: | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
herolab.getMasterName() | herolab.getMasterName() | ||
herolab.getMasterName( | herolab.getMasterName(tokenRef) | ||
</ | </syntaxhighlight> | ||
'''Parameters''' | '''Parameters''' | ||
{{param| | {{param|tokenRef|Either the token [[getSelected|{{code|id}}]] or [[getTokenName|Token Name]] of the token to name, defaults to the Current Token.}} | ||
{{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.}} | |||
|example= | |example= | ||
Get the Hero Lab Master character name associated with the character represented by the current token. | Get the Hero Lab Master character name associated with the character represented by the current token. | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h: myMaster = herolab.getMasterName()] | [h: myMaster = herolab.getMasterName()] | ||
[r: out = "My master's name is: " + myMaster] | [r: out = "My master's name is: " + myMaster] | ||
</ | </syntaxhighlight> | ||
Returns: | Returns: | ||
< | <syntaxhighlight lang="text" line> | ||
My master's name is: Fred | My master's name is: Fred | ||
</ | </syntaxhighlight> | ||
|also= | |also= |
Latest revision as of 23:59, 17 May 2024
herolab.getMasterName() Function
Note: This function can only be used in a Trusted Macro
• Introduced in version 1.5
Get basic information about the Hero Lab data associated with this token. Returns a JSON object containing various metadata about the character.
Usage
herolab.getMasterName()
herolab.getMasterName(tokenRef)
Parameters
tokenRef
- Either the tokenid
or Token Name of the token to name, defaults to the Current Token.
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.
Example
Get the Hero Lab Master character name associated with the character represented by the current token.
[h: myMaster = herolab.getMasterName()]
[r: out = "My master's name is: " + myMaster]
Returns:
My master's name is: Fred
See Also
Version Changes
- 1.5 - Added to main MapTool build.