This article's documentation is for anything that uses the Source engine. Click here for more information.

toggle

From Valve Developer Community
Jump to: navigation, search

toggle is a console command available in all Source Source games. Toggle a ConVar on and off, or cycle it between a set of values.

Syntax

toggle <cvar> <value 1> <value 2> <value 3> ...

"Toggling" past the last argument will loop around, i.e. the variable is set to its first value once again. Repeating the last value will prevent looping.

Examples

If values are omitted, the cvar is toggled between 0 and 1

toggle cl_showpos

Step 0 to 4

toggle cl_showfps 0 1 2 3 4

Step 0 to 4 and stop at 4

toggle cl_showfps 0 1 2 3 4 4

Cycle values

toggle viewmodel_fov 54 57 59 65 71 98

See also