getBar: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(New page: ==Function getBar== Returns the number padded in if it is an integer, otherwise the number is rounded down to the nearest smaller integer and that value is returned. ===Usage=== <source l...)
 
No edit summary
Line 1: Line 1:
==Function getBar==
==Function getBar==
Returns the number padded in if it is an integer, otherwise the number is rounded down to the nearest smaller integer and that value is returned.
Gets the value of the specified [[Token:bar|bar]] for the token. The value returned is between 0 and 1 for 0% to 100% respectively.


===Usage===
===Usage===
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: result = floor(num)]
[h: pct = getBar(name)]
</source>
</source>


===Examples===
===Examples===
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[r: floor(2)]
[r: healthPct = getBar("health") * 100]
</source>
</source>
Returns 2.
<source lang="mtmacro" line>
[r: floor(1.2)]
</source>
Returns 1.
<source lang="mtmacro" line>
[r: floor(-1.2)]
</source>
Returns -2.

Revision as of 13:35, 1 December 2008

Function getBar

Gets the value of the specified bar for the token. The value returned is between 0 and 1 for 0% to 100% respectively.

Usage

[h: pct = getBar(name)]

Examples

[r: healthPct = getBar("health") * 100]