Besides the Wiki.js functionality a custom javascript is available for writing custom functions and using Good Company sources. Up until now, functions have been added for replacing loca strings and inserting game data for items and equipment.
This page will explain how to use the custom javascript implementation.
As part of assets, the folder localization contains game language files of all supported languages. Those files can be updated by uploading new versions of the loca file into the same folder with the same name.
All available strings can be found in the uploaded JSON File
With the markdown editor it is possible to use a class in HTML elements called 'localize'. The custom javascript is supposed to replace a string identifier with the respective translation in the language the page is set to.
Example:
<span class="localize">lvl01_title</span>
-> lvl01_title
This localization is also able to use the ingame text replacements inside of [].
There are three types of replacements:
[t:lvl01_title]
-> lvl01_title[s:icons_common/dataC]
-> [goal2Target]
-> 20The replacement for strings and icons works automatically. The icons get looked up from the asset manager within wiki.js in the /icons
folder. If an icon is missing, it might be required to upload it.
In case of general replacements, those are usually very specific on where those replacements strings appear in the game. In some cases it is necessary to manually add a value for those replacements.
Without Replacement:
<span class="localize">chl03_desc</span>
chl03_desc
With Replacement:
<span class="localize">chl03_desc.goal2Target=90</span>
chl03_desc.goal2Target=90
Some texts, specifically the message texts in levels use [portrait:*]
as tag to show an image of the person talking. If this tag is included in a text string, the replacement will remove the tag.
Original Text:
[portrait:portraits/kerry_normal1]It's a pleasure to meet you! I'm Kerry Goldfield, business consultant. It's good to have you back in Good County.
Output:
lvl01_ms01_message01
If one wants to use the portraits from those strings this can be easily achieved by using parameters to the string replacement
Parameter | Syntax | Example |
---|---|---|
portrait_medium | lvl01_ms01_message01.portrait_medium | lvl01_ms01_message01.portrait_medium |
portrait | lvl01_ms01_message01.portrait | lvl01_ms01_message01.portrait |
Item replacement includes everything from Base Materials, Components, Modules and Cases, but not Products. Products are a different type of data. The data is extracted from the publicly available materials.json file.
If there is an update to the file, it needs to be uploaded and replaced via the Asset Manager into the gamedata folder.
The replacement works with HTML elements and it's highly recommended to use the markdown editor for those pages. What needs to be done is using the item
class and have the loca_string as identifer enclosed. Best usage are with span
and div
elements, depending on the display.
Example:
<span class="item">itm_led_matrix</span>
-> itm_led_matrix
Additionally editors can add parameters to the identifier by separating them with a .
As many parameters as required can be added, but parameters that would change the output will be overwritten if another one follows.
Parameter | Action | Syntax | Example |
---|---|---|---|
nolink | will disable linking the wiki page | item_led_matrix.nolink | itm_led_matrix.nolink |
notip | will disable the tooltip | item_led_matrix.notip | itm_led_matrix.notip |
text | will only display text | item_led_matrix.text | itm_led_matrix.text |
icon | will only display an icon up to 128x128 pixels | item_led_matrix.icon | itm_led_matrix.icon |
medium_icon | will only display an icon up to 48x48 pixels | item_led_matrix.medium_icon | itm_led_matrix.medium_icon |
data | will display an right bound info box | item_led_matrix.data |
The equipment replacement includes everything players can place in or outside their company, be it workstations, research tables, shelves, decorations etc. The data is extracted from the publicly available equipment.json file.
If there is an update to the file, it needs to be uploaded and replaced via the Asset Manager into the gamedata folder.
The replacement works with HTML elements and it's highly recommended to use the markdown editor for those pages. What needs to be done is using the equipment
class and have the loca_string as identifer enclosed. Best usage are with span
and div
elements, depending on the display.
Example:
<span class="equipment">bld_workbench_tier01</span>
-> bld_workbench_tier01
Additionally editors can add parameters to the identifier by separating them with a .
As many parameters as required can be added, but parameters that would change the output will be overwritten if another one follows.
Parameter | Action | Syntax | Example |
---|---|---|---|
nolink | will disable linking the wiki page | bld_workbench_tier01.nolink | bld_workbench_tier01.nolink |
notip | will disable the tooltip | bld_workbench_tier01.notip | bld_workbench_tier01.notip |
text | will only display text | bld_workbench_tier01.text | bld_workbench_tier01.text |
icon | will only display an icon up to 128x128 pixels | bld_workbench_tier01.icon | bld_workbench_tier01.icon |
medium_icon | will only display an icon up to 48x48 pixels | bld_workbench_tier01.medium_icon | bld_workbench_tier01.medium_icon |
data | will display an right bound info box | bld_workbench_tier01.data |