Engine:Console commands: Difference between revisions

Line 9: Line 9:


=== Key ===
=== Key ===
* 'Global commands' and 'Global variables' - Short-hand for commands placed in the 'global' context.
* 'Global commands' - Short-hand for commands placed in the 'global' context.
* 'Default command' - Is run by default, if its context is addressed by name or is the current context. Examples:
* 'Global variables' - Short-hand for variables placed in the 'global' context.
** <kua>var bob fred; bob</kua> Prints 'fred'. The 'var' command is used ot create a new variable, then the next statement uses the 'global' default 'varedit' command to print the value of 'bob'. 'bob' is not a command but an existing variable.
* 'Default command' - Command run by default if no command or alias exists for that name, in the current context. Examples:
** <kua>var bob fred; bob</kua> Prints 'fred'. The 'var' command is used to create a new variable, then the next statement uses the 'global' default 'varedit' command to print the value of 'bob'. 'bob' is not a command but an existing variable.
** <kua>bob james; bob</kua> Prints 'james'. In the first statement, the global default command 'varedit' finds the existing 'bob' variable in the 'global' context, and assigns 'james'. In the next statement, the default command finds and prints the value of variable 'bob'.  
** <kua>bob james; bob</kua> Prints 'james'. In the first statement, the global default command 'varedit' finds the existing 'bob' variable in the 'global' context, and assigns 'james'. In the next statement, the default command finds and prints the value of variable 'bob'.  
* Context - A script or command context. Each context may have its own commands and variables and rules. Examples:
* Context - A script or command context. Each context may have its own commands and variables and rules. Examples: