cvars package

Submodules

Module contents

Provides access to ConVar instances and the ability to create a ConVar.

class cvars.ConVar

Bases: ConCommandBase, _IConVar

__init__((object)arg1, (str)name[, (str)value=''[, (str)description=''[, (_engines._sound.Channel)flags=0[, (object)min_value=None[, (object)max_value=None]]]]]) object :

Called when a server-var is initilized.

If the ConVar already exists, all other parameters except name are inconsequential.

Parameters:
  • name (str) – The name of the ConVar.

  • value (str) – The initial value of the ConVar if it doesn’t already exist.

  • description (str) – The description of the ConVar.

  • flags (ConVarFlags) – The initial flags of the ConVar if it doesn’t already exist.

  • min_value (float) – The minimum value allowed for the ConVar.

  • max_value (float) – The maximum value allowed for the ConVar.

get_bool((ConVar)arg1) bool :

Return the value as a bool.

Return type:

bool

get_float((ConVar)arg1) float :

Return the value as a float.

Return type:

float

get_int((ConVar)arg1) int :

Return the value as an int.

Return type:

int

get_string((ConVar)arg1) str :

Return the value as a string.

Return type:

str

has_max((ConVar)arg1) bool :

Returns wether the ConVar has a maximum value.

Return type:

bool

has_min((ConVar)arg1) bool :

Return wether the ConVar has a minimum value.

Return type:

bool

make_public((ConVar)arg1) None :

Set the notify flag and make the console variable public.

remove_public((ConVar)arg1) None :

Remove the notify flag and make the console variable no longer public.

revert((ConVar)arg1) None :

Reset the console variable to its default value.

set_bool((ConVar)arg1, (bool)value) None :

Set the console variable to a boolean value.

property default

Return the default value.

Return type:

str

property max

Return the maximum value.

Return type:

float

property min

Return the minimum value.

Return type:

float

class cvars._Cvar

Bases: instance

__init__()

Raises an exception This class cannot be instantiated from Python

call_global_change_callbacks((_Cvar)arg1, (ConVar)cvar, (str)old_string, (float)old_float) None :

Call all global change callbacks.

Parameters:
  • cvar (ConVar) – The console variable that has changed.

  • old_string (str) – The old value of the variable as a string.

  • old_value (float) – The old value of the variable as a float.

find_base((_Cvar)arg1, (str)name) _commands.ConCommandBase :

Find the ConCommandBase instance of a server command or console variable.

Returns:

Return None if the command or variable was not found.

Return type:

ConCommandBase

find_command((_Cvar)arg1, (str)name) _commands.ConCommand :

Find the ConCommand instance of a server command.

Returns:

Return None if the command was not found.

Return type:

ConCommand

find_var((_Cvar)arg1, (str)name) ConVar :

Find the ConVar instance of console variable.

Returns:

Return None if the console variable was not found.

Return type:

ConVar

register_base((_Cvar)arg1[, (_commands.ConCommandBase)con_command=True]) None :

Register a console command.

unregister_base((_Cvar)arg1, (_commands.ConCommandBase)con_command) None :

Unregister a console command.

property commands

Return the first ConCommandBase instance that can be used to iterate through all ConCommandBase instances

.:rtype: ConCommandBase

cvars.cvar

The singleton instance for cvars._Cvar.