Editing Module:Test/doc
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | + | '''This module is used for development. Even if it works at the moment it might break at any time.''' | |
− | '''This module is used for development.''' | ||
− | == | + | == Description == |
− | This module is used to | + | This module is used to get information about game objects. |
+ | 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. | |
+ | |||
+ | If the queried value is not a simple one (strings, numbers or booleans), for now, the default behaviour is to dump the contents of the thing to the log. The log can be accessed when previewing a page you're editing. A hint that this has happened (there is something in the log) may be that the modlue returned the string "table". | ||
== Usage == | == Usage == | ||
− | |||
− | |||
=== query === | === query === | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | < | + | <pre><nowiki> |
+ | {{#invoke:Test|query|<defName>|...|<tag>}} | ||
+ | </nowiki></pre> | ||
− | < | + | ; <defName> |
+ | : defName of the Def. | ||
− | + | ; ... | |
+ | : Additional arguments are here to help uniquely identify the final argument <tag>. If the wanted tag is already unique within a Def tree, then additional parameters are not needed. | ||
− | < | + | ; <tag> |
+ | : This is the key to be retrieved. They are the same as those in the XML files (filtered, of course; not all of the data from the files is available). | ||
− | + | === getDefName === | |
− | + | <pre><nowiki> | |
+ | {{#invoke:Test|getDefName|<label>}} | ||
+ | </nowiki></pre> | ||
− | + | ; <label> | |
+ | : get defName based on the label of a Def (not case sensitive) | ||
− | + | == Examples == | |
− | + | === strings, numbers, booleans === | |
− | + | ;<code><nowiki>{{#invoke:Test|query|Fox_Fennec|description}}</nowiki></code> | |
− | + | :{{#invoke:Test|query|Fox_Fennec|description}} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | </ | ||
− | + | ;<code><nowiki>{{#invoke:Test|query|Fox_Fennec|MoveSpeed}}</nowiki></code> | |
+ | :{{#invoke:Test|query|Fox_Fennec|MoveSpeed}} | ||
− | <code><nowiki>{{# | + | ;<code><nowiki>{{#invoke:Test|query|Caribou|herdAnimal}}</nowiki></code> |
+ | :{{#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 retrieves the same data (just as an example) but with the use of an additional argument. | ||
− | + | ;<code><nowiki>{{#invoke:Test|query|Caribou|race|herdAnimal}}</nowiki></code> | |
+ | :{{#invoke:Test|query|Caribou|race|herdAnimal}} | ||
− | === | + | === numbered lists (tradeTags) === |
+ | * TODO: define syntax to get list length | ||
− | + | === sibling queries (lifeStageAges or tools) === | |
+ | * TODO: define syntax | ||
− | + | === getDefName === | |
− | < | + | ;<code><nowiki>{{#invoke:Test|getDefName|fennec fox}}</nowiki></code> |
− | < | + | :{{#invoke:Test|getDefName|feNNec fox}} |