GetCVarString (ACS)

From ZDoom Wiki
Jump to navigation Jump to search

Warning: This feature has at least one use case where the outcome is indeterminate. This feature can break demo and multiplayer sync if an indeterminate result is used to modify the playsim (anything that uses the random number generator, modify level geometry, spawn obstacles, monsters, or powerups, and so on). Usage of the feature in conjunction with non-playsim related features, such as displaying a HudMessage, is safe.

Using non-playsim CVARs such as screenblocks or invertmouse will cause indeterminate behavior. Using Server or User variables, either internal or defined via CVARINFO, is however perfectly safe.

string GetCVarString (str cvar)


Returns the value of a particular cvar.


Return value

(Verification needed)

The value of the specified console variable. For numerical values, see GetCVar instead. Also note that you can create your own console variables by using the CVARINFO lump.

If the console variable is a user CVAR, it will check the activator of the script. To check the user CVAR of a specific player, you can use GetUserCVarString.

If no such console variable exists, it will return an empty string.


script 42 (void)
    Print(s:"Your name is... ", s:GetCVarString("name"), s:"!");
    //Prints your name configured in the Player settings menu on the screen.

See also

Console variable functions
GetCVar SetCVar
GetCVarString SetCVarString
GetUserCVar SetUserCVar
GetUserCVarString SetUserCVarString