bar.name: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (DISPLAYTITLE test)
m (Improve related pages)
Line 29: Line 29:


* [[Macros:Variables:list_of_special_variables|List of Special Variables]]
* [[Macros:Variables:list_of_special_variables|List of Special Variables]]
* [[Macros:Functions:list_of_functions_by_area#Token_Bars|Token Bar Functions]]
* [[:Category:Bar_Function|Token Bar Functions]]


[[Category:Special Variable]]
[[Category:Special Variable]]
{{DISPLAYTITLE:foobar}}
{{DISPLAYTITLE:foobar}}

Revision as of 02:46, 5 November 2019

The bar.[bar_name] variable permits the getting and setting of the token bar value (and the corresponding image displayed on the token) programmatically. Token bars are one, two, or multi-image graphical elements displayed on a token that are used (typically) to visually indicate the status of consumable or expendable items or character traits (such as Hit Points, Ammunition, Health, or the like).

Bars, like token states, are configured via the Campaign Properties dialog and are specific to the campaign in which they exist. In the screenshot shown below, the green-on-black line across the top of the token is a token bar.

Usage

[bar.[bar_name] = value]

Sets the value of the token bar named bar_name to the desired value. bar_name is set when the bar is created, and may be any name, provided it contains no spaces or special characters except the underscore. Value must be a number between 0 and 1.

Examples

[h: HP = HP - DamageTaken]
[h: bar.Health = HP / MaxHP]

Sets the value of bar.Health to the result of HP / MaxHP.

Notes

Two functions, setBar() and getBar() also exist to get and set the value of the token bar.

Related Pages