Scripting

What’s this?

Scripting quick reference


- SCRIPT (file format) - Script events D3 Doom 3 script events Q4 Quake 4 script events Prey Prey script events ETQW ET:QW script events - Scripting basics - Script objects

Scripting is a specific domain of programming. It focuses more on specifying what should be done instead of how . Mostly read by a script interpreter instead of being compiled to bytecode.

On id Tech 4 , it is used to allow mappers or modders to change behavior without recompiling the bytecode, only a map restart is needed to parse the script again.

Different fields

The various forms of scripting in id Tech 4 are:

  • Level scripting - Used for scripting events in levels.
  • Weapon scripting - Used for defining the behavior of weapons.
  • AI scripting - Used for defining the behavior of monsters and characters.
  • GUI scripting - Used for defining the behavior and appearance of game GUIs . Uses a separate scripting system.

Check out the separate topics to get more specific scripting info.

Definitions

These definitions are related to scripting.

Script parser
The program reading a script file, here it the game binary of the respective id Tech 4 game.

Syntax
The rules defining a scripting language.

Keyword
Special word, reserved by the language to mark the start of a language construct.

Operator
Special symbol, reserved by the language to show what operation should be done.

Variable
A variable can be thought of as a named container used to store a value. It can only be of one data type at a time

Data type
See data types .

Reference
A special variable that can reference an entity.

Function or method
A function is a structure to group commands so they can be reused later in the script. It is also possible to give it a return type and value.

Return value
Once a function has finished it’s commands, it can return a result.

Return type
Defines the data type of the return value, must be given when defining a function

Object
A reference to the script object of an entity.

Event
Also called script event , these are commands via a reference or identifier.

Syntax

  • To find out about script file syntax, see the .SCRIPT format reference.
  • If you want to start immediately, go read some tutorials on level scripting .
  • If you are looking for a more steady introduction to scripting, check out the scripting basics page.

See also the editing of declarations, which is not exactly a part of scripting but an important part of editing for id Tech 4 engine.