模块:Random world names/doc

出自Terraria Wiki
跳至導覽 跳至搜尋

此頁面為 模块:Random world names 的說明文件

This module is used to display the table body on World/Name. It uses a seed that changes each second to generate the random examples, hence simply purging the page generates new random examples.

The module has one function to be called, go. It takes a $lang argument that is used for generating the {{gameText}} strings, so it should be set to the wiki's language code (as returned by {{lang|}}). It also takes a $compositions argument, which should be set to a comma-separated list of world name composition IDs. The compositions are defined in the RandomWorldName_Composition group of {{gameText}} (i.e. RandomWorldName_Composition.1 through RandomWorldName_Composition.8). Depending on the language, there may be multiple compositions that are identical, so only the IDs of distinct compositions should be passed to the module function. This avoids duplicate table rows in the output. For example, when using the module in English, it would be sensible to set the parameter to |compositions=1,3,5,6,7,8 because the compositions 2 and 4 are duplicates of 1 and 3, respectively.

Furthermore, the go function takes several arguments for properly displaying the "generic" composition in the left cell: $adjective, $location, and $noun, as replacements for the respective placeholders. The values of these arguments are used for all compositions, but it is possible to overwrite them for specific compositions with arguments of the format <composition>:<adjective/location/noun>. For instance, using |3:adjective=foo in the module invocation sets the adjective placeholder in composition 3 (and only in composition 3) to "foo".

Lastly, the $count argument defines the number of random world names that are generated for each composition. It defaults to 3 if omitted.