IfCVarInt

From ZDoom Wiki
Jump to navigation Jump to search

IfCVarInt [not] <cvarname>, <value> [, equal]


Executes the following sub block if the specified console variable's value is greater than or equal to value. If not is provided, the check is inverted, and the sub block is executed if the variable's value is less than value. Passing equal, changes the comparison from greater than or equal to to equal to.

The command accepts integer-type console variables as well as bool-type ones. Note that for the bool type, value should either be 0 (for false) or 1 (for true).

Examples

This block of code is executed if the value of mymod_somecvar custom console variable is greater than or equal to 5.

IfCVarInt mymod_somecvar, 5
{
  // commands...
}


This one is executed if the value of the variable is equal to 12.

IfCVarInt mymod_somecvar, 12, equal
{
  // commands...
}


This block is executed if the value of the variable does not equal 3.

IfCVarInt not mymod_somecvar, 3, equal
{
  // commands...
}