table: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Cleaned up formatting, added version, added See Also links.)
Line 1: Line 1:
{{MacroFunction
{{MacroFunction
|name=table
|name=table
|version=1.3b39
|description=
|description=
Gets the text 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 text value from the specified [[Table|table]]. If the row is not specified then the default [[Roll|roll]] for the [[Table|table]] is used. The row can be either a constant or a [[Roll|roll]].


|usage=
|usage=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
    [h: table(tableName)]
table(name)
    [h: table(tableName, row)]
</source>
</source>
<source lang="mtmacro" line>
table(name, row)
</source>
<source lang="mtmacro" line>
tbl(name)
</source>
<source lang="mtmacro" line>
tbl(name, row)
</source>
'''Parameters'''
* {{code|name}} - A string containing the name of the [[Table|table]].
* {{code|row}} - The row of the [[Table|table]] that should be returned.
 
|examples=
|examples=
Display a random value from table "tbl1" using default roll. >
'''Example 1:''' Display a random value from table {{code|"tbl1"}} using default roll:
<source lang="mtmacro" line>
<source lang="mtmacro" line>
    [r: table("tbl1")]
[r: table("tbl1")]
</source>
</source>


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


Display one of the first 4 values from "tbl1" chosen randomly.
'''Example 3:''' Display one of the first four values from {{code|"tbl1"}}, chosen randomly:
<source lang="mtmacro" line>
<source lang="mtmacro" line>
    [r: table("tbl1", "1d4")]
[r: table("tbl1", "1d4")]
</source>
</source>
|also=
[[Table]], [[tableImage|tableImage()]]
}}
}}
[[Category:Table Function]]
[[Category:Table Function]]

Revision as of 14:54, 9 March 2009

table() Function

Introduced in version 1.3b39
Gets the text value from the specified table. If the row is not specified then the default roll for the table is used. The row can be either a constant or a roll.

Usage

table(name)
table(name, row)
tbl(name)
tbl(name, row)

Parameters

  • name - A string containing the name of the table.
  • row - The row of the table that should be returned.

Examples

Example 1: Display a random value from table "tbl1" using default roll:
[r: table("tbl1")]

Example 2: Display the first value from table "tbl1":

[r: table("tbl1", 1)]

Example 3: Display one of the first four values from "tbl1", chosen randomly:

[r: table("tbl1", "1d4")]

See Also