SnowRunner

SnowRunner

Discover a wealth of new maps, vehicles, modes, and more, all created by the community! Discover something new every day and expand your SnowRunner experience.

Find the game on Epic Games, Xbox, Playstation, Facebook, Twitter, Instagram, Reddit, Forums, Discord.

SnowRunner Text Mod

Now in the game you can see what previously you were able to see in the cheat sheets only. No more questions like: which tires are better?

Posted by on


SnowRunner Text Mod

Features

The script allows you to change the names or descriptions of certain types of entities in the game resources automatically using customizable templates into which parameter values of these entities can be substituted. As a result, the game will display specific values in addition to the relative characteristics that it normally uses.

The supported entities:

  • engines
  • gearboxes
  • suspensions
  • tires
  • winches
  • machine addons
  • machines
  • trailers[1]
  • cargo types[1]

[1]: Only for these entities, the script changes the name, while for others - the description.

Requirements

The following components are required to run the script:

  • Windows PowerShell 2.0
  • .NET Framework 3.0

All of them are already preinstalled in Windows 7. There should be no problems with subsequent versions of Windows either.

Theoretically, the script will work on Linux and Mac OS after installing the specified components.

Usage

Preparation

The script processes files that are in initial.pak archive file of the game. Therefore, they must be unpacked into an arbitrary directory which will be considered the working directory.

The configuration file must have the same name as the script file and be located in the same directory.

Run

General view of the run command:

powershell ./snowrunner_text_mod.ps1 [-<option> [<value>]]

The following are the parameters that the script accepts:

  • Languages (alias l) - list of the game languages whose files will be processed. By default, all found language files are processed. The available values are determined based on filenames that are of strings_<language>.str form and located in [strings] subdirectory.
  • EntityTypes (alias et) - list of the game entity types whose names or descriptions need to be changed. By default, all supported entity types are processed. Available values:
    • CARGO_TYPE
    • ENGINE
    • GEARBOX
    • SUSPENSION
    • TIRE
    • TRAILER
    • TRUCK
    • TRUCK_ADDON
    • WINCH
  • WorkingDirPath (alias wdp) - the working directory. By default, this is the one that the script file is located in.
  • Restore (alias r) - the switch that enables the process of restoring the original names or descriptions after they were changed.
  • Verbose (alias v) - the switch that allows output of additional information during the script run.
  • Debug (alias d) - the switch that allows the output of detailed information during the script run. Specifying this option also activates the logic of Verbose option which doesn't need to be specified in this case.

There are several nuances when using parameters:

  1. All parameters except switches are separated from their values by spaces. Switches are used independently.
  2. Parameter names and their values are case insensitive.
  3. The Languages and EntityTypes parameters are arrays. Therefore, if it is necessary to set several values for any of them then they must be listed separated by commas (without spaces).

An example of a command that processes some entity types for several languages:

powershell ./snowrunner_text_mod.ps1 -Languages english,russian -EntityTypes engine,gearbox,tire

The same command, but using parameter aliases:

powershell ./snowrunner_text_mod.ps1 -l english,russian -et engine,gearbox,tire

Operation logic

The script allows you to change the names or descriptions of entities repeatedly without the need to restore them before the next change.

The script works not only with the basic resources of the game, but also automatically finds the additional ones (so-called seasons). Therefore, it is compatible with any version of the game, as long as its resource structure is preserved.

The process of changing the names or descriptions of entities in the resource files consists of the following main steps:

  • determining the final parameter values of entities based on references to templates with parameter values and/or parent entities in the way that, in my opinion, the game does
  • creation of new names or descriptions of entities based on templates in the configuration file
  • adding new keys with new names or descriptions to the language files (the original keys and values remain unchanged)
  • replacement of the original keys in the resource files, which point to the names or descriptions of entities in the language files, with new ones

As a consequence of this process, the script can also be used after applying other game modifications or modifying the resource files manually, as long as the game resource structure hasn't been broken.

Configuration

File structure

The configuration file is in XML format and must be stored in UTF-8 encoding to correctly support texts in different languages. Tag and attribute names are case sensitive and must be lowercase.

It presents the general structure of the file and describes the purpose of each XML tag.

<!--
    Strictly defined root tag
-->
<snowrunner_text_mod>
    <!--
        Configuration version
    -->
    <version>
    </version>
    <!--
        Language codes
    -->
    <language_codes>
        <!--
            Language code that defines template formatting settings
            The tag name must match one of the supported languages.
        -->
        <_supported-language_>
        </_supported-language_>
    </language_codes>
    <!--
        Glossaries grouped by language
    -->
    <glossaries>
        <!--
            Glossary for a specific language
            The tag name must match one of the supported languages.
        -->
        <_supported-language_>
            <!--
                Specific glossary element used when formatting templates for the corresponding language
                key - key used in template argument expressions
                value - value to be substituted into templates when they are formatted
            -->
            <item key="_key_" value="_value_"/>
        </_supported-language_>
    </glossaries>
    <!--
        Templates common to all languages
    -->
    <templates>
        <!--
            Entity name or description template (depending on its type)
            The tag name must match one of the supported entity types.
        -->
        <_supported-entity-type_>
        </_supported-entity-type_>
    </templates>
    <!--
        Template arguments grouped by entity type
    -->
    <template_arguments>
        <!--
            Template arguments for a specific entity type
            The tag name must match one of the supported entity types.
        -->
        <_supported-entity-type_>
            <!--
                Specific argument to be substituted into the template for the corresponding entity type
            -->
            <argument>
            </argument>
        </_supported-entity-type_>
    </template_arguments>
    <!--
        Arbitrary code to run before formatting each template
    -->
    <initialization_code>
    </initialization_code>
</snowrunner_text_mod>

Configuration version

The version of the configuration serves as a marker of its compatibility with the script that is run, in order to prevent the use of an outdated configuration in case of possible changes in the future.

Language codes

A language code specifies the language settings for template formatting. Its value determines how some types of template arguments will be presented as a result (for example, what will be the separator of the integer and fractional parts of real numbers). The value must follow the format that is supported by CultureInfo class. If no language code is specified, the language-independent settings are used.

Glossaries

A glossary defines a set of language-specific elements that can be used when formatting templates. Each set element consists of a key, which is used in template argument expressions, and a value, which is substituted in the templates when they are formatted.

Templates

A template is a special kind of string that, after formatting, becomes a new name or description of an entity. It must conform to the format that Format method of String class accepts.

For convenience of perception, a template can be located on several lines in the configuration file. But before formatting it, leading and trailing spaces will be removed from each line, and then these lines will be merged into one, since only texts that consist of one line are allowed in the language files. At the same time, the game supports displaying text on multiple lines using \n character combination. A part of a line that follows this combination is displayed in the game on a new line.

Template arguments

The order of XML tags with template arguments determines their indexes in it.

Template arguments are evaluated using PowerShell expressions. The following variables are available to expressions:

  • Glossary - an object of Hashtable class that contains all glossary items for the current language
  • Entity - an object of XmlNode class that corresponds to an XML tag of an entity that is processed and contains its final parameters from a resource file
  • EntityType - an object of String class that contains the type of entity that is processed
  • OriginalValue - an object of String class that contains the original name or description of an entity that is processed (depending on its type)

Initialization code

Arbitrary PowerShell code that is executed before each template is formatted. All variables and functions declared here can be used in template argument expressions.

The same variables are available here as in template argument expressions.

Reference information

The table below provides information about the location of entities in the resource files.

Entity type Path to resource files Path to entity XML tags in these files
CARGO_TYPE classes\trucks\cargo\cargo_*.xml /TruckAddon
ENGINE classes\engines\e*.xml /EngineVariants/Engine
GEARBOX classes\gearboxes\gearboxes_*.xml /GearboxVariants/Gearbox
SUSPENSION classes\suspensions\s_*.xml /SuspensionSetVariants/SuspensionSet
TIRE classes\wheels\wheels_*.xml /TruckWheels/TruckTires/TruckTire
TRAILER classes\trucks\trailers\*.xml /Truck
TRUCK classes\trucks\*.xml /Truck
TRUCK_ADDON classes\trucks\addons\*.xml /TruckAddon
WINCH classes\winches\winches_*.xml /WinchVariants/Winch

Post scriptum

There are a few points that I would like to add.

  1. I wrote this script primarily for myself, but I decided to share it with others who play the game that I liked.
  2. In the attached configuration file, in the templates I used those game entity parameters, the values of which were of the greatest interest to me.
  3. The units that are used in the configuration file are based on my assumptions. Let me know if I made a mistake in their choice.
  4. Don't ask me to explain how to change the configuration file. This is a broad topic. Get to know PowerShell at least superficially. It's worth it.
  5. Since the script finds more than 500 supported entities in the resource files of the game version 17.2, I haven't checked the final parameter values of all these entities. If you find an inconsistency between the values that will be displayed in the game and those shown in the enthusiast-created help resources, please let me know. The discrepancy can be caused both by errors in the script logic, and by incorrect data in these resources.
  6. Help me add glossaries for other languages to the configuration file. Please use only those words that are present in the original texts of the game, so that the texts changed by the script look harmonious. It will take a little time for you (only about 20 words and phrases), but it will help a lot of players.
  7. If you find any errors in the glossary in your language in the attached configuration file, please report it.
  8. Also I would be interested to hear your opinion about the script.
  9. If you want to use parts of the script, then be sure to indicate this in your project and, if possible, notify me about it.

Available languages of glossaries in the default configuration:

  • English (by me)
  • Russian
  • French (by @lemicromegas)


Comments

Join the community or sign in with your gaming account to join the conversation: