Difference between revisions of "Module:Test/doc"

From RimWorld Wiki
Jump to navigation Jump to search
m
m
Line 16: Line 16:
  
 
; <def id>
 
; <def id>
: A string needed to identify a Def. Works with defName or label.  
+
: A string needed to identify a Def. Works with defName or label. At the moment, upper/lower case is important but I might change this so it's simpler to use.
  
 
; ...
 
; ...
Line 22: Line 22:
  
 
; <tag>
 
; <tag>
: tag defines data to be retrieved.
+
: Value to be retrieved. (Upper/lower case also important.)
  
 
== Examples ==
 
== Examples ==
Line 45: Line 45:
  
 
=== numbered lists (tradeTags) ===
 
=== numbered lists (tradeTags) ===
* TODO: define syntax to get list lenth
+
* TODO: define syntax to get list length
  
 
=== sibling queries (lifeStageAges or tools) ===
 
=== sibling queries (lifeStageAges or tools) ===
 
* TODO: define syntax
 
* TODO: define syntax

Revision as of 11:58, 14 April 2021

This module is used for development. Even if it works at the moment it might break at any time.

Description

This module is used to get information about game objects. It uses data stored in subpages of the module which is gathered from the game's XML files. Its main purpose is to populate the contents of infoboxes.

Values retrieved are those defined in the files so they may need to be processed to be user friendly. For example "foodType" that holds the value "OminvoreRoughAnimal" is not entirely helpful.

Usage

{{#invoke:Test|query|<def id>|...|<tag>}}
<def id>
A string needed to identify a Def. Works with defName or label. At the moment, upper/lower case is important but I might change this so it's simpler to use.
...
Additional numbered arguments are here to help uniquely identify the final argument <tag>. If the wanted tag is unique within a Def tree, then additional parameters are not needed.
<tag>
Value to be retrieved. (Upper/lower case also important.)

Examples

strings, numbers, booleans

{{#invoke:Test|query|Fox_Fennec|description}}
{{#invoke:Test|query|fennec fox|description}}
{{#invoke:Test|query|Fox_Fennec|MoveSpeed}}
{{#invoke:Test|query|Caribou|herdAnimal}}

"herdAnimal" is located in a branch of the main Def called "races" but because it appears nowhere else in the Def no additional parameters are needed to uniquely identify it. The following query would retrieve the same data (just as an example) but with the use of an additional argument.

{{#invoke:Test|query|Caribou|race|herdAnimal}}

numbered lists (tradeTags)

  • TODO: define syntax to get list length

sibling queries (lifeStageAges or tools)

  • TODO: define syntax