GUI Scripting In ETQW
Since Doom 3 there have been some major changes to the GUI system. Enemy Territory: QUAKE Wars still supports Doom 3-style GUI scripts, but it has changed to become more event driven.
For GUI scripting we use Ultra Edit 32 and Textpad text editors, but any text editor can be used. A text editor that supports syntax highlighting is highly recommended. There is no GUI editor built into the game like there are for Doom 3 and Quake 4.
- Event driven GUI.
- Multiple timelines per window possible.
- Multi-part materials reduces the number of windows needed.
- Template support.
- Global/player properties for gamecode and game script communication.
Like in Doom 3 every window must have a unique name. A window property may be accessed from any other window by using gui.<windowname>.<propertyname>.
Accessing properties from other windows:
gui.dynamicRankIconFlash.backColor.a = transition( 0, 1, 500 );
There has been the addition of a properties block and an events block. Properties may be defined within the properties, which can then be used in timelines or events. The types allowed in the GUIs are:
- float - a float property.
- handle - usually a material handle or localized text handle.
- vec2 - 2D vector.
- vec3 - 3D vector.
- vec4 / color / rect - 4D vector.
- X may be accessed with .x/.r/.red/.left.
- Y with .y/.g/.green/.top.
- Z with .z/.b./.w/.blue/.width.
- W with .h/.a/.alpha/.height.
All the GUI files can be found in the base/guis folder. The GUIs have the .gui extension, all templates can be found in files with the .include extension, and themes can be found in files with the .guitheme extension. Themes were used at some point for changing the color of the HUD depending on if the player was on GDF or Strogg.
The GUI folder:
- assets - all the assets used by the GUIs.
- common - Contains common templates and defines that can be used throughout the GUIs.
- demos - Demo making HUD.
- game - GUIs related to the game (player HUD, limbo menu, vehicle HUDs, weapon HUDs, etc.).
- loadscreen - Map loading GUIs.
- mainmenu - The main menu GUI and all the dialogs and components for it.
- maps - Map related GUIs (GUI consoles mainly).
- system - Event notification GUI (friends coming online for example).
- themes - Themes are defined here.
- tools - Unused.
- globals.gui - Global properties mainly used for communication between game scripts and GUI scripts.
- postprocess.gui - GUI post processing effects.
Event Based Scripting
The Quake Wars GUIs are event driven.
For a full explanation, see GUIs: Event Based Scripting.
Material system and caching of materials.
For a full explanation, see GUIs: Materials.
Transitions are used for smooth window movement and all types of text/material fading, either linear or non-linear change can be used.
For a full explanation, see GUIs: Transitions.
Most lists in the game are filled from enumerators.
For a full explanation, see GUIs: List Enumeration.
Player, Limbo and Global Properties
Global properties can be accessed from anywhere in the GUI and is used for communicating with the gamecode and game scripts.
For a full explanation, see GUIs: Properties.
Just as in Doom 3 timelines can be used to trigger events regularly or at specific times. They can be stopped, started and reset to specific times. There may also be defined multiple timelines for the same window or GUI and they can be given names for referencing.
For a full explanation, see GUIs: Timelines.
Layouts are used for automatically ordering windows next to each other.
For a full explanation, see GUIs: Layouts.
Adding a new notify icon to the HUD.
For a full explanation, see GUIs: Notify Icon.
UIObject is the base window type from which all other window types inherit from.