Documentation
Русский
  • Gem RTS v1 Documentation
  • Foundational Knowledge
    • Game local files and Player Profile locations
    • Game resource architecture
      • Packages
      • Package file structure
    • Basic knowledge about configuration files
      • Include instruction
      • Define instruction
      • Mod instruction
  • Mod Development
    • Creating mod
    • Advanced package configuration
    • Creating Settings templates
  • Editor
    • Camera control in the Editor
    • Useful Editor shortcuts and Console commands
    • Map Editor
      • Creating a new map
      • Scene Editor
      • Entity Editor
      • Landscape Editor
        • Heights Editor
        • Polygons Editor
        • Terrains Editor
        • Color Editor
        • Flags Editor
        • Material Editor
        • Grass Editor
        • Foliage Editor
      • Water Editor
      • Specifics of Map Editing
        • Creating destroyed vehicle entities for map entourage
        • Creating terrain folds
          • Creating Ground Surface relief
          • Rock and cliff entities
        • Stone entities
        • Entity for water sound effects
        • Building entities
      • Creating a minimap
    • Mission Editor
      • Mission Properties Editor
    • FX Editor
    • Environment Editor
      • Basic knowledge about HDR
      • Creating environment preset
      • Setting Environment preset parameters
    • Debug Tools
      • Console
      • Debug Processes Window
      • Render Layer List Window
    • Simulation Mode
  • Textures and Materials
    • Physically Based Rendering
      • Texture compression formats in GEM RTS
      • PBR parameters
      • Texture Conversion in Gem RTS
      • Texture conversion to PBR materials using Nvidia Texture Exporter
  • Modeling
    • 3ds Max Plugin
    • Vehicle Model Setup Pipeline
      • Bone hierarchy in vehicle models
        • Body
        • Turret
        • Engine
        • Gun
        • Secondary bones
        • Transmission
          • Сhassis mechanisms
  • Localization
    • Variable strings in localization
    • Adding a new localization language
  • Game settings
    • Movement on slopes
    • Configuration of movement types for human units
    • Configuring entity interaction with wind
    • Sensor
    • User control sound
Powered by GitBook
On this page
  • Types of Variable Strings
  • Giving orders in the Game
  • Specifying an in-game action
  • Specifying a keyboard key
  • For Hotbar Actions
  • Example of using variable strings in localization
  • Configuration files
  1. Localization

Variable strings in localization

Last updated 9 months ago

The game settings provide the ability to configure the order button and assign hotkeys for in-game actions. This requires identifying the corresponding keys in the localization files. For this, variable strings are used.

Types of Variable Strings

Giving orders in the Game

<&mouse_action_key>

By default, right-click button orders are used. In the Options window, players can enable left-click button orders by selecting the "LMB orders" checkbox.

Specifying an in-game action

<&optkey:anyAction>

When displaying localization texts, the value corresponding to the user's settings recorded in the keys.opt file will be substituted instead of <&optkey:anyAction>.

Example of specifying hotkeys for actions in localization texts

Assume the "cancel" action is assigned to the Z key. Then the keys.opt file will have the following lines:

{"actions/cancel"
    {value KEY_Z}
}

For the actions/cancel action, the localization lines might look like this:

{"stand_still" "To cancel an order, press the hotkey <&optkey:actions/cancel>."}

In the game text, the letter Z will be displayed instead of the variable string <&optkey:actions/cancel>, and the player will see:

"To cancel an order, press the hotkey Z."

Note: To ensure the action is found by the hotkey, the key parameter must be specified for the action in the action.setfile:

{...{name "[action_name]"} ...{key "actions/[action_name]"}...}

If you need to add the ability to trigger an action by hotkey, you can create the action+.set file and use the block with the modify parameter. For example, for the "cancel" action:

{modify "cancel"...{key "actions/cancel"}...}

Specifying a keyboard key

<&key:keycode>

Used to specify a specific keyboard key.

Example of specifying a specific key in localization texts

For the spacebar key, the variable string in localization files will look like this:

{"continue" "Press <&key:key_space> key to continue"}

To specify keys, you need to use values from the keycode list.

List of keycode values for keyboard keys

Note: For better readability, it is recommended to write in lowercase. keymap["KEY_ESCAPE"] = 0x01;

keymap["KEY_1"] = 0x02;

keymap["KEY_2"] = 0x03;

keymap["KEY_3"] = 0x04;

keymap["KEY_4"] = 0x05;

keymap["KEY_5"] = 0x06;

keymap["KEY_6"] = 0x07;

keymap["KEY_7"] = 0x08;

keymap["KEY_8"] = 0x09;

keymap["KEY_9"] = 0x0A;

keymap["KEY_0"] = 0x0B;

keymap["KEY_MINUS"] = 0x0C;

keymap["KEY_EQUALS"] = 0x0D;

keymap["KEY_BACK"] = 0x0E;

keymap["KEY_TAB"] = 0x0F;

keymap["KEY_Q"] = 0x10;

keymap["KEY_W"] = 0x11;

keymap["KEY_E"] = 0x12;

keymap["KEY_R"] = 0x13;

keymap["KEY_T"] = 0x14;

keymap["KEY_Y"] = 0x15;

keymap["KEY_U"] = 0x16;

keymap["KEY_I"] = 0x17;

keymap["KEY_O"] = 0x18;

keymap["KEY_P"] = 0x19;

keymap["KEY_LBRACKET"] = 0x1A;

keymap["KEY_RBRACKET"] = 0x1B;

keymap["KEY_RETURN"] = 0x1C;

keymap["KEY_LCONTROL"] = 0x1D;

keymap["KEY_A"] = 0x1E;

keymap["KEY_S"] = 0x1F;

keymap["KEY_D"] = 0x20;

keymap["KEY_F"] = 0x21;

keymap["KEY_G"] = 0x22;

keymap["KEY_H"] = 0x23;

keymap["KEY_J"] = 0x24;

keymap["KEY_K"] = 0x25;

keymap["KEY_L"] = 0x26;

keymap["KEY_SEMICOLON"] = 0x27;

keymap["KEY_APOSTROPHE"] = 0x28;

keymap["KEY_GRAVE"] = 0x29;

keymap["KEY_LSHIFT"] = 0x2A;

keymap["KEY_BACKSLASH"] = 0x2B;

keymap["KEY_Z"] = 0x2C;

keymap["KEY_X"] = 0x2D;

keymap["KEY_C"] = 0x2E;

keymap["KEY_V"] = 0x2F;

keymap["KEY_B"] = 0x30;

keymap["KEY_N"] = 0x31;

keymap["KEY_M"] = 0x32;

keymap["KEY_COMMA"] = 0x33;

keymap["KEY_PERIOD"] = 0x34;

keymap["KEY_SLASH"] = 0x35;

keymap["KEY_RSHIFT"] = 0x36;

keymap["KEY_MULTIPLY"] = 0x37;

keymap["KEY_LALT"] = 0x38;

keymap["KEY_SPACE"] = 0x39;

keymap["KEY_CAPSLOCK"] = 0x3A;

keymap["KEY_F1"] = 0x3B;

keymap["KEY_F2"] = 0x3C;

keymap["KEY_F3"] = 0x3D;

keymap["KEY_F4"] = 0x3E;

keymap["KEY_F5"] = 0x3F;

keymap["KEY_F6"] = 0x40;

keymap["KEY_F7"] = 0x41;

keymap["KEY_F8"] = 0x42;

keymap["KEY_F9"] = 0x43;

keymap["KEY_F10"] = 0x44;

keymap["KEY_NUMLOCK"] = 0x45;

keymap["KEY_SCROLL"] = 0x46;

keymap["KEY_NUMPAD7"] = 0x47;

keymap["KEY_NUMPAD8"] = 0x48;

keymap["KEY_NUMPAD9"] = 0x49;

keymap["KEY_SUBTRACT"] = 0x4A;

keymap["KEY_NUMPAD4"] = 0x4B;

keymap["KEY_NUMPAD5"] = 0x4C;

keymap["KEY_NUMPAD6"] = 0x4D;

keymap["KEY_ADD"] = 0x4E;

keymap["KEY_NUMPAD1"] = 0x4F;

keymap["KEY_NUMPAD2"] = 0x50;

keymap["KEY_NUMPAD3"] = 0x51;

keymap["KEY_NUMPAD0"] = 0x52;

keymap["KEY_DECIMAL"] = 0x53;

keymap["KEY_F11"] = 0x57;

keymap["KEY_F12"] = 0x58;

keymap["KEY_F13"] = 0x64;

keymap["KEY_F14"] = 0x65;

keymap["KEY_F15"] = 0x66;

keymap["KEY_KANA"] = 0x70;

keymap["KEY_CONVERT"] = 0x79;

keymap["KEY_NOCONVERT"] = 0x7B;

keymap["KEY_YEN"] = 0x7D;

keymap["KEY_NUMPADEQUALS"] = 0x8D;

keymap["KEY_CIRCUMFLEX"] = 0x90;

keymap["KEY_AT"] = 0x91;

keymap["KEY_COLON"] = 0x92;

keymap["KEY_UNDERLINE"] = 0x93;

keymap["KEY_KANJI"] = 0x94;

keymap["KEY_STOP"] = 0x95;

keymap["KEY_AX"] = 0x96;

keymap["KEY_UNLABELED"] = 0x97;

keymap["KEY_NUMPADENTER"] = 0x9C;

keymap["KEY_RCONTROL"] = 0x9D;

keymap["KEY_NUMPADCOMMA"] = 0xB3;

keymap["KEY_DIVIDE"] = 0xB5;

keymap["KEY_SYSRQ"] = 0xB7;

keymap["KEY_RALT"] = 0xB8;

keymap["KEY_PAUSE"] = 0xC5;

keymap["KEY_HOME"] = 0xC7;

keymap["KEY_UP"] = 0xC8;

keymap["KEY_PRIOR"] = 0xC9;

keymap["KEY_LEFT"] = 0xCB;

keymap["KEY_RIGHT"] = 0xCD;

keymap["KEY_END"] = 0xCF;

keymap["KEY_DOWN"] = 0xD0;

keymap["KEY_NEXT"] = 0xD1;

keymap["KEY_INSERT"] = 0xD2;

keymap["KEY_DELETE"] = 0xD3;

keymap["KEY_LWIN"] = 0xDB;

keymap["KEY_RWIN"] = 0xDC;

keymap["KEY_APPS"] = 0xDD;

keymap["KEY_ESC"] = KEY_ESCAPE;

keymap["KEY_ENTER"] = KEY_ENTER;

keymap["KEY_BACKSPACE"] = KEY_BACK;

keymap["KEY_NUMPADSTAR"] = KEY_MULTIPLY;

keymap["KEY_NUMPADMINUS"] = KEY_SUBTRACT;

keymap["KEY_NUMPADPLUS"] = KEY_ADD;

keymap["KEY_NUMPADPERIOD"] = KEY_DECIMAL;

keymap["KEY_NUMPADSLASH"] = KEY_DIVIDE;

keymap["KEY_UPARROW"] = KEY_UP;

keymap["KEY_PGUP"] = KEY_PRIOR;

keymap["KEY_LEFTARROW"] = KEY_LEFT;

keymap["KEY_RIGHTARROW"] = KEY_RIGHT;

keymap["KEY_DOWNARROW"] = KEY_DOWN;

keymap["KEY_PGDN"] = KEY_NEXT;

keymap["MOUSE0"] = MOUSE0;

keymap["MOUSE1"] = MOUSE1;

keymap["MOUSE2"] = MOUSE2;

keymap["MOUSE3"] = MOUSE3;

keymap["MOUSE4"] = MOUSE4;

keymap["MOUSE5"] = MOUSE5;

keymap["MOUSE6"] = MOUSE6;

keymap["MOUSE7"] = MOUSE7;

keymap["MOUSE_LEFT"] = MOUSE_LEFT;

keymap["MOUSE_RIGHT"] = MOUSE_RIGHT;

keymap["MOUSE_MIDLE"] = MOUSE_MIDLE;

keymap["KEY_CONTROL"] = KEY_CONTROL;

keymap["KEY_ALT"] = KEY_ALT;

keymap["KEY_SHIFT"] = KEY_SHIFT;

keymap["ALT"] = KF_ALT;

keymap["CTRL"] = KF_CTRL;

keymap["SHIFT"] = KF_SHIFT;

keymap["DOUBLE"] = KF_DOUBLE;

keymap["~ALT"] = KF_NOALT;

keymap["~CTRL"] = KF_NOCTRL;

keymap["~SHIFT"] = KF_NOSHIFT;

keymap["~DOUBLE"] = KF_NODOUBLE.

For Hotbar Actions

<&hotbar_key:anyAction>

Working Algorithm:

  • If the specified action is on the Hotbar, the game will display the corresponding hotbar key value in the text instead of the variable string.

  • If the specified action is not on the Hotbar, the action hotkey value will be displayed if set.

  • Otherwise, an empty value [] will be displayed.

Example of using variable strings in localization

Fragment of a .lng file using variable strings:

{"02" "To build a breastwork, select your riflemen and press <&hotbar_key:barricade>. Then select a starting spot for the breastwork and press <&mouse_action_key>. Drag the mouse cursor to set the length for the fortification. Press <&mouse_action_key> again to order the breastwork to be built."

Explanation of variables

  • <&hotbar_key:barricade> This variable will be replaced by the key assigned to the barricade action in the hotbar. If the barricade action is assigned to a key, that key will be displayed. If not, it will display the hotkey for the action if set, or an empty value [] if neither is set.

  • <&mouse_action_key> This variable will be replaced by the mouse button configured for order issuance in the options window. By default, it is the right mouse button (RMB). If the "LMB orders" option is checked, it will be replaced by the left mouse button (LMB).

Example user settings

  • Assume the barricade action is assigned to the key F1 in the hotbar.

  • Assume the mouse order button is set to the right mouse button (RMB).

Resulting In-Game Text

With these settings, the variables will be substituted as follows:

  • <&hotbar_key:barricade> becomes F1.

  • <&mouse_action_key> becomes RMB.

Thus, the text displayed in the game will be:

To build a breastwork, select your riflemen and press F1. Then select a starting spot for the breastwork and press RMB. Drag the mouse cursor to set the length for the fortification. Press RMB again to order the breastwork to be built.

By understanding how the variables are substituted with actual key values set by the user, we can see how the text dynamically adapts to the player's configuration, ensuring that the instructions are always accurate and relevant to the current settings.

Configuration files

File name
Purpose

keys.opt

Configuration of in-game actions to hotkeys

scene\hud2\action.set

File with descriptions of in-game actions

interface\text#ingame+.lng

Localization file for in-game actions

*.lng

Localization files
Switching Order button from Right-Click to Left-Click in the OPTIONS window