Engine:Console commands: Difference between revisions

 
(25 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{\|dev|macronav}}
{{dev|macronav}}
This is a reference for Engine [[console commands]] available for use a [[chat window]] or other console, and as [[macro commands]] in a [[macro]].
This is a reference for Engine [[console commands]] available for use a [[chat window]] or other console, and as [[macro commands]] in a [[macro]].


This list describes all of the [[slash commands]], [[console commands]] and [[console variables]] from Engine itself, in one list for now, and not ones from any additional components or [[AddOn]]s. These same commands are available in the base Engine scripting language.
This list describes all of the [[slash commands]], [[console commands]] and [[console variables]] from Engine itself, in one list for now. Does include not any from additional components or [[AddOn]]s. These same commands are available in the base Engine scripting language.


== Notes ==
== Notes ==
Line 15: Line 15:
** <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'.  
** <kua>lua print(1 + 3)</kua> Prints '3'. The 'lua' context is addressable from 'global'. The default command 'lua_edit' in the 'lua' context runs the lua statement in the Lua runtime, where the 'print' is a real Lua statement, not an Engine script one.
** <kua>lua print(1 + 3)</kua> Prints '3'. The 'lua' context is addressable from 'global'. The default command 'lua_edit' in the 'lua' context runs the lua statement in the Lua runtime, where the 'print' is a real Lua statement, not an Engine script one.
** <kua>context lua; print(1 + 3); exit</kua> Also prints '3' and returns to 'global'. Where the 'lua' context is switched to first, then the unqualified Lua command is run, also using the default 'lua_edit' command.
** <kua>context lua; print(1 + 3); exit</kua> Also prints '3'. Switches to the 'lua' context. Runs the same 'lua_edit' default command, with the bare statement in the Lua runtime. Switches back to 'global' with the 'exit' command, which is not run in Lua runtime as it exists as a command in the 'lua' context.
* 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:
** <kua>client start</kua> Starts the client service. The 'client' context is addressable from 'global', and the client 'start' command is run.  
** <kua>client start</kua> Starts the client service. The 'client' context is addressable from 'global', and the client 'start' command is run.  
Line 24: Line 24:
* Binding - key bindings to the keyboard or mouse buttons, or from other real or virtual devices.
* Binding - key bindings to the keyboard or mouse buttons, or from other real or virtual devices.
* Associations - Module or context associations and features.
* Associations - Module or context associations and features.
* Service - An engine messaging service. Which may be internal, local, or network for send or receive.
* Service - An engine messaging service. Which may be internal, local, or network for send or receive. Some types of services offer commands that only exist while the service is running. 
* Script - May refer to the base Engine script language, which can contain elements here. Or to strings of commands for an alias, or integrated higher-level scripting like blended in-line engine script with lua, JS, or C#.
* Script - May refer to the base Engine script language, which can contain elements here. Or to strings of commands for an alias, or integrated higher-level scripting like blended in-line engine script with lua, JS, or C#.
* Module - An independent static module built into the engine.
* Module - An independent static module built into the engine. Modules may create one or more command or script contexts, services or other things. If the module is not available, its commands, variables and contexts won't exist.
* Log - A text buffer that may or may not have an actual file log attached. The default console is composed of a 'log' and a basic text mode edit box.


== Reference ==
== Reference ==
Line 42: Line 43:
: [[CCMD bind|bind]] - bind, /bind - Key to script.  Map a key to a script block.
: [[CCMD bind|bind]] - bind, /bind - Key to script.  Map a key to a script block.
: [[CCMD echo|echo]] - echo, /echo - Write text to log only. Print text to current console but not the file.
: [[CCMD echo|echo]] - echo, /echo - Write text to log only. Print text to current console but not the file.
: [[CCMD bind|print]] - print, /print - Write text to log and file. Print text to current console and to file.
: [[CCMD print|print]] - print, /print - Write text to log and file. Print text to current console and to file.
: [[CCMD bind|context]] - context, /context - Change context. Change current console context to another known context.
: [[CCMD context|context]] - context, /context - Change context. Change current console context to another known context.
: [[CCMD bind|run]] - run, /run - Load and run script file. Run a named script file. Name must include extension.
: [[CCMD run|run]] - run, /run - Load and run script file. Run a named script file. Name must include extension.


Global vars:
Global vars:
: [[CVAR lib_path|lib_path]] - './lib/' - Path for native 'world' modules.
: [[CVAR lib_path|lib_path]] - './lib/' - Path for native 'world' libraries.
: [[CVAR base_path|base_path]] - './data/' - Path for content and assets.
: [[CVAR base_path|base_path]] - './data/' - Path for content and assets.
: [[CVAR module|module]] - 'game' - Base name for 'world' module, without platform postfix.
: [[CVAR module|module]] - 'game' - Base name for 'world' module, without platform postfix.
Line 77: Line 78:
Assignments:
Assignments:
: Explicit context name is 'lua' reachable through 'global'
: Explicit context name is 'lua' reachable through 'global'
: Inherits 'global' context
: Default reachable contexts: none. See 'exit' command
: Optional reachable contexts: none
: Default self-reference context: 'lua'
: Does not inherit 'global' context


Lua context commands:
Lua context commands:
Line 84: Line 88:
: [[CCMD lua.block|block]] - lua run - Runs a Lua command block in the Lua runtime
: [[CCMD lua.block|block]] - lua run - Runs a Lua command block in the Lua runtime
: [[CCMD lua.exit|exit]] - lua exit - Immediately switches current context to 'global'
: [[CCMD lua.exit|exit]] - lua exit - Immediately switches current context to 'global'
Lua context variables:
: none


Lua context aliases:
Lua context aliases:
: none
: none
Lua functions placed in a Lua runtime by the lua context:
: [[CLUA script|script]] - Runs an engine script from the Lua runtime.
: [[CLUA require|require]] - Loads and runs lua text file asset from engine data.


=== Msg module ===
=== Msg module ===