settings.scr and user.scr Last edited 3 months ago2024-07-18 12:57:27 UTC

The files settings.scr and user.scr define graphical user interfaces for cvars that otherwise needs the console to change. The file to GUI panel mapping is as follows:
File GUI location Description
settings.scr Create Server > Game dialog Multiplayer server settings
user.scr Options > Advanced or Options > Multiplayer > Advanced tab User settings
Similarly-named files are also used on Source games, located in cfg/ (may be packed in a .vpk)

Note: if the mod's liblist.gam features the type "singleplayer_only" line the Advanced tab will be available right in the Options menu instead of Multiplayer options.
Multiplayer Advanced dialog with a custom `user.scr`Multiplayer Advanced dialog with a custom user.scr

Format

The following section is from the comments inside these files, copied verbatim.
Format:
 Version [float]
 Options description followed by
 Options defaults

Option description syntax:
 "cvar" { "Prompt" { type [ type info ] } { default } }

 type =
  BOOL   (a yes/no toggle)
  STRING
  NUMBER
  LIST

type info:
BOOL                 no type info
NUMBER       min max range, use -1 -1 for no limits
STRING       no type info
LIST          delimited list of options value pairs


default depends on type
BOOL is "0" or "1"
NUMBER is "value"
STRING is "value"
LIST is "index", where index "0" is the first element of the list

Usage

You can use these files to give players access to cvars, either those provided by the base SDK or those you added with custom game code.

Example of user.scr

This will show "Draw HUD" option with parameters selectable from the list and "FOV" numeric option bounded to number between 10 and 180.
VERSION 1.0

DESCRIPTION INFO_OPTIONS
{
    "hud_draw"
    {
        "Draw HUD"
        {
            LIST
            "Hide HUD" "0"
            "Show HUD" "1"
        }
        { "1.000000" }
    }

    "default_fov"
    {
        "FOV"
        { NUMBER 10.000000 180.000000 }
        { "90.000000" }
    }
}

Notes about LIST option

Behavior of LIST option is buggy. It requires all items values to be consecutive integer numbers starting with 0. Otherwise setting the option via UI will be incorrect. It means that you can't put floating numbers in the list, make a list with gaps or allow selecting the negative number.

E.g. the following setting will be buggy because it has the negative number and a gap (no "3" between "2" and "4").
"cl_rollangle"
{
    "View rolling"
    {
        LIST
        "Reversed" "-1"
        "Disabled" "0"
        "Mild" "1"
        "Average" "2"
        "Heavy" "4"
    }
    { "1.000000" }
}

Comments

You must log in to post a comment. You can login or register a new account.