Engine:CCMD run: Difference between revisions

no edit summary
No edit summary
Line 16: Line 16:
This very basic syntax structure however lends well to being flexible and extensible, and thus sometimes confusing. A complex base Engine script can interact with many different environments and contexts.
This very basic syntax structure however lends well to being flexible and extensible, and thus sometimes confusing. A complex base Engine script can interact with many different environments and contexts.


=== Script statement syntax ===
== Examples ==
=== Default values ===
For a script file named 'startup.cfg' and looks like:
<kua>
echo fred
lua print(1 + 3)
alias bob fred
var fred james
bob
</kua>
* Try to load a non-existent file.
<kua>
> run bob.cfg
Run failed: bob.cfg
</kua>
* Run the example script file.
<kua>
> run startup.cfg
fred
4
'fred' is 'james'
</kua>
: In this case: echos 'fred' to console, runs a Lua statement that adds '1 + 3' and prints the result, creates an alias 'bob', creates 'fred' variable that the alias 'bob' will show the value of, runs the 'bob' alias that effectively prints the value of 'fred' that is 'james'.
 
 
== Script statement syntax ==
In the pseudo-syntax examples in these descriptions, a space ' ' is the same as any whitespace except newline, and all of the newline chars are represented by just '\n', to make easier to read. Text with no line '\n' delimiters is considered a single line. The examples are illustrative and not exact, the descriptions are correct.
In the pseudo-syntax examples in these descriptions, a space ' ' is the same as any whitespace except newline, and all of the newline chars are represented by just '\n', to make easier to read. Text with no line '\n' delimiters is considered a single line. The examples are illustrative and not exact, the descriptions are correct.
:1. 'Statement' is a text block that begins with a command name, and is followed by any other text, and ends with line-end or semi-colon. A new statement can begin adjacent to the previous statements ending delimiter.
:1. 'Statement' is a text block that begins with a command name, and is followed by any other text, and ends with line-end or semi-colon. A new statement can begin adjacent to the previous statements ending delimiter.
Line 45: Line 70:
::<kua>+zoom</kua>
::<kua>+zoom</kua>
12. 'Executable statements' are composed of both the parsed 'command name' and 'other text' components, excluding comments
12. 'Executable statements' are composed of both the parsed 'command name' and 'other text' components, excluding comments
== Examples ==
=== Default values ===
For a script file named 'startup.cfg' and looks like:
<kua>
echo fred
lua print(1 + 3)
alias bob fred
var fred james
bob
</kua>
* Try to load a non-existent file.
<kua>
> run bob.cfg
Run failed: bob.cfg
</kua>
* Run the example script file.
<kua>
> run startup.cfg
fred
4
'fred' is 'james'
</kua>
: In this case: echos 'fred' to console, runs a Lua statement that adds '1 + 3' and prints the result, creates an alias 'bob', creates 'fred' variable that the alias 'bob' will show the value of, runs the 'bob' alias that effectively prints the value of 'fred' that is 'james'.


== Notes ==
== Notes ==
*
*