GetCVar

From ZDoom Wiki

Jump to: navigation, search

int GetCVar (str cvar)

Usage

Returns the value of a particular cvar.

Parameters

  • cvar
Name of a console variable to get the value from.

Return value

The value of the specified console variable. This is only useful for cvars that can be represented as integers. Also note that you can create your own console variables by using 'set' console command.

Examples

One possible use for this is if you are making additions to the HUD, you can check if the player is using the status bar or not and act accordingly:

int screenblocks = GetCVar ("screenblocks");

if (screenblocks < 10)
{
    // The status bar is visible
}
else if (screenblocks == 10)
{
    // The fullscreen HUD is visible instead
}
else
{
    // No HUD of any sort is visible
}
Personal tools