Quake III Shell Interpreter

By PhaethonH <PhaethonH@gmail.com>

Purpose

To add additional scripting abilities to Quake III: Arena

Overview

Motivation

The scope of scripting in Id Software's Quake III: Arena is very limited. The extent of the scriptability is basically just assigning strings to variables, and then executing the content of those variables by keystroke. There is little else to justify calling the system "scripting".

My goal is to extend the scriptability of Quake III by implementing the abilities of more capable scripting languages. These include variable substitution/expansion, control structures (if-then-else), loops (for-do, while), and subroutines, among others.

Given Quake III's console nature, I have taken a particular bias towards the syntax and semantics of the GNU Bourne Again Shell (BASH) v2.04. This necessarily translates into more-lax data typing (weak typing), dynamic scoping, and confounded quoting and escaping rules.

For my distribution and archival purposes (as in "If my computer blows up"), I intend to place "milestone" achievements on this page. For size purposes, the code will be in unified diff format against the stock Q3 game source code.

Code fragments

2001.08.08 -- Milestone 1: Variable expansion

cgame.qsh1.diff, patched against Q3 1.27g game source.

Adds two files, cg_qsh2.c and cg_hash.c. Thus, you have to manually add these two files to the compile script/batch file and the cgame.q3asm (or cgame_ta.q3asm) file. Patches cg_consolecmds.c to hook in Q3SH.

New commands:

New features:

Stupid examples:
/bind l eval say_team "I am at $location"
/bind . eval say_team "Status: Health ${health}, Armor $armor"


-- PhaethonH (PhaethonH@gmail.com)