getBarImage: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Create page for getBarImage())
 
m (Fix typos (state -> bar))
Line 4: Line 4:
|version=unreleased
|version=unreleased
|description=
|description=
Gets the [[Asset ID|asset id]] for the image of a bar, the state must be one of the image types (single-, double-, or multi-image) for this to work.
Gets the [[Asset ID|asset id]] for a specific image in a bar. The bar must be one of the image types (single-, double-, or multi-image) for this to work.


|usage=
|usage=
Line 17: Line 17:
</source>
</source>
'''Parameters'''
'''Parameters'''
* {{code|state}} - The name of the state which has its image asset returned.
* {{code|state}} - The name of the bar which has its image asset returned.
* {{code|size}} - The size that the state image will be resized to; this is the height of the final size; this argument is optional, pass a 0 or an empty string to ignore it.
* {{code|size}} - The size that the bar image will be resized to; this is the height of the final size; this argument is optional, pass a 0 or an empty string to ignore it.
* {{code|value}} - The value (0 to 1) on the bar where the image you want is; if a bar only contains a single image, this argument is optional.
* {{code|value}} - The value (0 to 1) on the bar where the image you want is; if a bar only contains a single image, this argument is optional.



Revision as of 14:53, 20 February 2021

 This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.

getBarImage() Function

Introduced in version unreleased
Gets the asset id for a specific image in a bar. The bar must be one of the image types (single-, double-, or multi-image) for this to work.

Usage

getBarImage(bar)
getBarImage(bar, size)
getBarImage(bar, size, value)

Parameters

  • state - The name of the bar which has its image asset returned.
  • size - The size that the bar image will be resized to; this is the height of the final size; this argument is optional, pass a 0 or an empty string to ignore it.
  • value - The value (0 to 1) on the bar where the image you want is; if a bar only contains a single image, this argument is optional.

Example

To display the image for the midway point of a custom bar called "Mana", use
<img src='[r:getBarImage("Mana", 0, 0.5)]'></img>