Server setting variables

Post Reply
Masher
Site Admin
Posts: 3617
Joined: Thu Apr 20, 2006 2:54 pm
Location: America's Heartland
Contact:

Server setting variables

Post by Masher »

All server settings with a '+' after the setting name can use variables. Variables that are currently available are:
VariableReplaced withNotes
%ServerWD%Resolves to server's working directory value
%Root%Replaced with the associated server's root path setting
%Executable%Replaced with the associated server's executable setting
%DATE%Replaced with current dateInvalid file/path characters are replaced with '-'
%TIME% Replaced with current timeInvalid file/path characters are replaced with '-'
%IP%Replaced with the Query IP value for server
%Port%Replaced with the server's game port value
%Port+##%Replaced with the server's game port plus value after '+' symbolIf %Port% would return 27015, %Port+5% would return 27020
%Port-##%Replaced with the server's game port minus value after '+' symbolIf %Port% would return 27015, %Port-10% would return 27005
%RconPort%Replaced with the server's rcon port value
%QryPort%Replaced with server's Query Port setting
%QryPort2%Replaced with server's Query Port 2 setting
%ServerID%Replaced with the server's ID #
%OwnerID%Replaced with the owner's ID #
%SDefID%Replaced with the server definition's ID #
%SDef%Replaced with the server definition's textual name
%Var1% - %Var12%Replaced with the value for custom variableMay use value (1-12) for the various variables
%DependsID%Replaced with ID of the server the server depends onAdded in 1.862
%Depends*%Replaced with the variable of the server the server depends onAdded in 1.862 - See 'Dependency Server Variables' section below for details
%SteamCMD%Replaced with full path and executable of steamcmd; useful for update tool.Panel/monitor will download SteamCMD the first time the variable is encountered. Added in 1.88
%SteamID%Replaced with the game type's defined Steam ID valueAdded in 2.30. Useful for update command line in server templates.
%RandomString%Replaced with a 12 character random stringAdded in 2.36. Useful to specify a random password or seed in templates or command lines.
%JavaHome%Replaced with path to javaAdded in 2.36. On Windows searches registry and returns path to Java install (HLKM\SOFTWARE\JavaSoft\Java Runtime Environment\Currentversion --> HKLM\software\javasoft\java runtime environment<curver>\JavaHome), you still need to specify \bin\java_executable. For Linux returns /usr/bin/java
%MaxPlayers%Replaced with the Max Player monitoring valueUseful for templates and setting max player values.
%PID%Replaced with the PID value for the server.Useful for extras, etc.
%Utility%Replaced with the path of the auto-installer's utility cache.Introduced in 2.471
All variable names (ie %ServerWD%) are case sensitive!

Nested Variables
Nested variables are allowed. For example you may use the variable %Root% for the server's working directory value. Any reference to %ServerWD% would then resolve to the contents of %Root%.

Dependency Server Variables
Version 1.862 now allows servers that are dependencies of other servers to use variables from the server it depends on. Use the variable %Depends * % and replace '*' with the variable you want to use. For example if you want to get the %IP% variable you'd use %DependsIP%, to get the game port you can use %DependsPort%, etc. All variables will work with this method if the server depends on another server.

Public Variables
With version 1.58+ you can mark all Custom Variables as public variables. This will allow these variables to be editable by the server owner from a special page accessible from the Server Management page, via a link labeled "Srvr Vars". The page will display the variable description and a text box that contains the current setting for the variable and allow the user to change the values. Sub-user and group members with the edit command line permissions will be allowed to view/edit the values as well.

When using public variables as commandline options, be sure to quote them in the command line. This will prevent users from setting additional switches via this feature. For example, let's say you want to allow users to use their own username/password for the steamcmd update system. You make custom var 5 and 6 the steamcmd username and password. The update commandline should look something like:

+login "%Var5%" "%Var6%" +force_install_dir ../csgo_ds +app_update 740 validate
Last edited by Masher on Sun Sep 26, 2021 3:28 pm, edited 4 times in total.
Reason: Added %Executable% info
Masher
-----------
Please do not PM me unless asked to! We are a small company. If you have an issue or question it would be best to post it in the forums where it can help others in the future.

NEW Join our Discord!
Post Reply