Engine:CCMD context: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
Line 23: Line 23:
global
global
</kua>
</kua>
* Same as the first example. But change to the known 'client' context, which is addressable from the 'global' context.
=== Context seperation ===
* Same as the first example. But change to the known 'client' context, which is addressable from the 'global' context.  
<kua>
<kua>
> context client
> context client

Revision as of 07:02, 15 October 2023

Console commands

Switches contexts or prints the current context.

context client

Arguments

  • name (optional) - The name of the context to switch to. If no name, then prints the name of the current context.

Details

The 'context' command allows changing between named contexts. Each context may have its own commands and variables and rules, and purpose.

For a context to be available, it has to be associated with the one you are in. These associations are created by the various engine modules and can never be directly added or removed by console commands, or any type of script or AddOn.

Examples

Default values

  • Try to change to a non-existent context.
> context bob
Unknown: bob
  • Called with no name. The current context is printed.
> context
global

Context seperation

  • Same as the first example. But change to the known 'client' context, which is addressable from the 'global' context.
> context client
  • Start the client service, and change the client 'bob' variable which exists only in the 'client' context.
> start
Client is started.
> bob 8081
> bob
'bob' is '8081'
> context
client
  • Change back to the 'global' context. Test to see that the bob variable in 'client' is not in 'global'.
> context global
> context
global
> bob
Unknown: bob

Notes