ezQuake Manual: TCL - Tool Command Language

Why Tcl has been chosen? First, it is simplicity of embedding: Tcl, unlike, for example, Perl, has been initially developed so that it could be built in the existing application written on C (in our case ezQuake). Secondly, Tcl support Tcl does not need of additional libraries and files, except for tcl.dll. Well and at last, simple enough syntax.

Following 3 commands was added:
tcl_eval - execute line as tcl code
tcl_exec - execute a config as tcl script
tcl_proc <name> [parameters] - execute a Tcl-procedure <name> with parameters <parameters>. Procedure must be difened before thru tcl_eval or tcl_exec commands.

In Tcl-scripts you can use qw-variables. Since this variables are global, you must define them inside procedures with a command global, or iput before that name of a variable: ::, for example: set x $::fov

Besides that, for interaction with the client in Tcl interpreter were added following commands: cmd <line> - executes string as a qw-command or alias alias <name> [args] - similar to the Tcl-command 'proc', but except for definition of procedure is defined as qw-alias.

Example:

alias +wswitch {weapon} {
     set ::last_weapon $::weaponnum
     cmd impulse $weapon
     cmd +attack
}
alias -wswitch {} {
     cmd -attack
     cmd impulse $::last_weapon
}
cmd bind MOUSE3 +wswitch 2 ;

For more info visit TCL Tutorial.

Last update: 29.08.2006 07:03 UTC
ezQDocs

SourceForge.net Logo