herolab.getStatBlock: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Created page with "{{MacroFunction |name=herolab.getStatBlock |trusted=true |version=1.5 |description= Returns associated statblock for the token as a string. Currently, Hero Lab stores three ty...")
 
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 7: Line 7:


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
herolab.getStatBlock(type)
herolab.getStatBlock(type)
herolab.getStatBlock(type,id)
herolab.getStatBlock(type,tokenRef)
</source>
</syntaxhighlight>
Note: The different formats may or may not contain the same information but it does reflects what is stored in the portfolio. If you find missing information, in the XML statblock for instance, you will need to report that to [[http://www.wolflair.com/index.php?context=hero_lab&page=support Wolf Lair]].
Note: The different formats may or may not contain the same information but it does reflects what is stored in the portfolio. If you find missing information, in the XML statblock for instance, you will need to report that to [[http://www.wolflair.com/index.php?context=hero_lab&page=support Wolf Lair]].


'''Parameters'''
'''Parameters'''
{{param|type|A string containing either "text", "html", or "xml"}}
{{param|type|A string containing either "text", "html", or "xml"}}
{{param|id|The ID of the token. Defaults to the Current Token.}}
{{param|tokenRef|Either the token [[getSelected|{{code|id}}]] or [[getTokenName|Token Name]] of the token 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.}}


Returns ''HeroLab data does not exist for this token'' if no data exists for the token and aborts the macro.
Returns ''HeroLab data does not exist for this token'' if no data exists for the token and aborts the macro.
Line 21: Line 22:
|example=
|example=
Get the Hero Lab Master character name associated with the current token.
Get the Hero Lab Master character name associated with the current token.
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[herolab.getStatBlock("text")]
[herolab.getStatBlock("text")]
</source>
</syntaxhighlight>
Returns:
Returns:
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
</source>
</syntaxhighlight>


|also=
|also=

Latest revision as of 23:59, 17 May 2024

herolab.getStatBlock() Function

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

Introduced in version 1.5
Returns associated statblock for the token as a string. Currently, Hero Lab stores three types of statblocks: Text, HTML, & XML.

Usage

herolab.getStatBlock(type)
herolab.getStatBlock(type,tokenRef)

Note: The different formats may or may not contain the same information but it does reflects what is stored in the portfolio. If you find missing information, in the XML statblock for instance, you will need to report that to [Wolf Lair].

Parameters

  • type - A string containing either "text", "html", or "xml"
  • tokenRef - Either the token id or Token Name of the token 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.


Returns HeroLab data does not exist for this token if no data exists for the token and aborts the macro.

Example

Get the Hero Lab Master character name associated with the current token.
[herolab.getStatBlock("text")]

Returns:

See Also

Version Changes

  • 1.5 - Added to main MapTool build.