Engine:CCMD varedit: Difference between revisions

Line 15: Line 15:


Behaves like a combination of 'var' and 'set', but will never create a variable:
Behaves like a combination of 'var' and 'set', but will never create a variable:
* varedit - Never creates variables, and sets anytime variable already exists.
* varedit - Never creates a variable, and sets anytime variable already exists.
* var - Creates and sets variables, only if the variable not yet exist.
* var - Will create and set a variable, only if the variable does not yet exist.
* set - Creates or sets variable, any time.
* set - Will create or set a variable, any time.


While 'varedit' is intended make console variable checking and editing easy, in combination with the other variable commands, can allow scripts and other types of macros to avoid lots of situations where complex logic would otherwise be required.
While 'varedit' is intended make console variable checking and editing easy, in combination with the other variable commands, can allow scripts and other types of macros to avoid lots of situations where complex logic would otherwise be required.


For example, this default command 'varedit' would allow writing a script that was intended to only set certain variables if another service or module had already created them.
For example, this default command 'varedit' would allow writing a script that was intended to only set certain variables if another service or module had already created them.
This is a 'default' command for the global context and is used by simply using the 'name' and 'value' directly in a statement. It does not have a name in global to call it by name.


== Examples ==
== Examples ==