Incrementvar: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(How to use it.)
mNo edit summary
Line 7: Line 7:
There is a bug (or at least a wierd way of doing things), where incrementing a variable past the maxValue specified can set it to 0. The example linked below avoids this problem by first decrementing, then incrementing the specified variable.
There is a bug (or at least a wierd way of doing things), where incrementing a variable past the maxValue specified can set it to 0. The example linked below avoids this problem by first decrementing, then incrementing the specified variable.


See [Unlocking_chapters_in_your_mod] for an example of how to use incrementvar.
See [[Unlocking_chapters_in_your_mod]] for an example of how to use incrementvar.

Revision as of 18:05, 21 June 2006

A console command which can increment a given console variable.

Usage

  • incrementvar varname minValue maxValue delta
    • Increments the given variable by the delta, whilst keeping the value within the bounds specified by minValue and maxValue

There is a bug (or at least a wierd way of doing things), where incrementing a variable past the maxValue specified can set it to 0. The example linked below avoids this problem by first decrementing, then incrementing the specified variable.

See Unlocking_chapters_in_your_mod for an example of how to use incrementvar.