tableImage: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Updated formatting, , added version, clarified the size parameter in usage text, added See Also links.)
Line 1: Line 1:
{{MacroFunction
{{MacroFunction
|name=tableImage
|name=tableImage
|version=1.3b40
|description=
|description=
Gets the image asset value from the specified [[Table]]. If the row is not specified then the default [[Macros:roll|roll]] for the [[Table]] is used. The row can be either a constant or a [[Macros:roll|roll]].
Gets the image asset value from the specified [[Table|table]]. If the row is not specified then the default [[Roll|roll]] for the [[Table|table]] is used.


|usage=
|usage=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
    [h: tableImage(tableName)]
tableImage(name)]
    [h: tableImage(tableName, row)]
    [h: tableImage(tableName, row, size)]
</source>
</source>
<source lang="mtmacro" line>
tableImage(name, row)]
</source>
<source lang="mtmacro" line>
tableImage(name, row, size)]
</source>
<source lang="mtmacro" line>
tblImage(name)]
</source>
<source lang="mtmacro" line>
tblImage(name, row)]
</source>
<source lang="mtmacro" line>
tblImage(name, row, size)]
</source>
'''Parameters'''
* {{code|name}} - A string containing the name of the [[Table|table]].
* {{code|row}} - The row of the [[Table|table]] that should have the image asset returned.
* {{code|size}} - The size the image asset returned should be. If the image is not square, this will be the size of the height.
 
|examples=
|examples=
Display a random image from table "tbl1" using default roll.
'''Example 1:''' Display a random image from [[Table|table]] {{code|"tbl1"}} using default [[Roll|roll]]:
<source lang="mtmacro" line>
<source lang="mtmacro" line>
    <image src='[r: tableImage("tbl1")]'></image>
<image src='[r: tableImage("tbl1")]'></image>
</source>
</source>


Display the first image from table "tbl1".
'''Example 1:''' Display the first image from [[Table|table]] {{code|"tbl1"}}:
<source lang="mtmacro" line>
<source lang="mtmacro" line>
    <image src='[r: tableImage("tbl1", 1)]'></image>
<image src='[r: tableImage("tbl1", 1)]'></image>
</source>
</source>


Display one of the first 4 images resized to 40 pixels high from "tbl1" chosed randomly. >
'''Example 2:''' Display one of the first four images, resized to {{code|40}} pixels tall, from {{code|"tbl1"}}, chosed randomly:
<source lang="mtmacro" line>
<source lang="mtmacro" line>
    <image src='[r: tableImage("tbl1", "1d4", 40)]'></image>
<image src='[r: tableImage("tbl1", "1d4", 40)]'></image>
</source>
</source>
|also=
[[Table|Table]], [[table (function)|table()]]
}}
}}
[[Category:Table Function]]
[[Category:Table Function]]

Revision as of 15:10, 9 March 2009

tableImage() Function

Introduced in version 1.3b40
Gets the image asset value from the specified table. If the row is not specified then the default roll for the table is used.

Usage

tableImage(name)]
tableImage(name, row)]
tableImage(name, row, size)]
tblImage(name)]
tblImage(name, row)]
tblImage(name, row, size)]

Parameters

  • name - A string containing the name of the table.
  • row - The row of the table that should have the image asset returned.
  • size - The size the image asset returned should be. If the image is not square, this will be the size of the height.

Examples

Example 1: Display a random image from table "tbl1" using default roll:
<image src='[r: tableImage("tbl1")]'></image>

Example 1: Display the first image from table "tbl1":

<image src='[r: tableImage("tbl1", 1)]'></image>

Example 2: Display one of the first four images, resized to 40 pixels tall, from "tbl1", chosed randomly:

<image src='[r: tableImage("tbl1", "1d4", 40)]'></image>

See Also