Graphics.AddingATclScript - lordmundi/wikidoctest GitHub Wiki
Adding a Tcl Script
« Adding a Vehicle Camera | EDGE User’s Guide | Adding reconfigs and toggles »
Simple directions
-
Edit userdata/user.cfg
-
Add a line to source your tcl script in the appropriate "TCL" or "GUI" block
GUI { simple_overlay "${USERDATA}/gui/simple_overlay.tcl" }
What's really going on
The "userdata/user.cfg" file (or any config file for that matter) may contain many TCL or GUI blocks. The block that you place your script in will determine in which situations it is sourced. For example, selecting a DOUG→GUI block that is under a specific DISPLAY context will only get sourced when that DISPLAY context is used (via the -display command line argument). Or, placing a script inside the overall DOUG→GUI block will source the script in all instances of DOUG.
As a clarification, in EDGE v2.2, a new block type, "TCL", was added. This block is for non-visual scripts, meaning they do not require Tk or any windows to run. This is useful for the DOUG manager which is a non-visual process. Running the manager will automatically not include any scripts inside "GUI" blocks. "TK" is another name for the GUI block, although "GUI" is more commonly used.
As far as syntax, the first portion of the script is an alias that can be used to reference the script. The second argument is the full path to the script, which should be in quotes to protect against paths that have spaces in them. Using the alias further down in the config file processing, one can reassign the alias to a new script, or to an empty string ("") to remove the script.
Errors caused from sourcing the script may be seen in the console, but you can also run with the "-tcldebug" argument to get a popup dialog with more information if an error occurs. This is very useful when debugging scripts.
« Adding a Vehicle Camera | EDGE User’s Guide | Adding reconfigs and toggles »