Comment tags

Comment tags in the script allow changing defines, variables and strings in a script-defined WED panel without editing the script. This way, customizable template scripts allow to produce many different kinds of games and to add all sorts of customized effects or resources without any scripting at all. The following script comment tags are used for composing the script customize panel and the entity behavior panel.  !!  Note that the comments must immediately precede the variable, definition or action they refer to, without empty lines inbetween.

// uses: skillname, flagname...

Determines individual skill and flag names for the following non-empty entity action. The Skill1..Skill20 and Flag1..Flag8 names in the behavior panel are then replaced by the names listed here, which have to be defined as skill names before. 

Example:

#define Health skill9
#define Armor skill10
...
//uses: Health, Armor
action warrior() { .... }

// skill1: name default
// flag1: name default

Alternative to the uses comment tag for skills and flags that haven't given a name yet. All skills and flags available in the behavior panel can be named this way for a certain non-empty entity action. If the action is assigned the first time, the skills and flags get the default values given in the comment.

Example:

// flag7: Remote 1
// Skill20: Health 123.45
action warrior() { .... } // Defines the name 'Remote' for flag7, and sets it to 'on' by default.
// Also defines the name 'Health' for skill20 and initializes it at 123.45.

// desc: text

The given text appears in WED's Action or Material panel after clicking the Help Icon [?] and then clicking onto the action or material definition immediately following the comment. The comment can extend over several lines; only the first line requires the desc: tag.

// title: text

The given text appears as title in bold font on the customize panel.

// image: name.pcx

The given pcx file is displayed at the head of the customize panel. It must exist in the template folder.

// help: text

The given text appears when pressing the [?] button of the customize panel, and then clicking the mouse pointer on the entry item following the help tag.

// section: text

Defines a horizontal line or space in the Customize Panel that can be used to group several entry fields together. The given text appears as section title.

// text: text

The given text appears on the Customize Panel and can be used for descriptions.

// needs: name1.wdl name2.wdl ...

This token in a customizable script determines that the given template scripts must also be included when adding the script. WED looks whether they are already included. If not, they will be automatically included immediately before the current script.

Example:

// needs: movement.c animation.c

Includes movement.c and animation.c before the current script if they are not already included.

// enable: text

Creates a flag in the Customize panel that can be marked or unmarked. When the flag is unmarked, the following code line in the script is commented out by a "//", otherwise it's uncommented.

Example:

//enable: Shadow Map
//help: Activate this for a shadow map on the blue channel
#define SHADOWMAP

// entry: text

Defines an entry field in the Properties panel. The field is labeled with the given text, and allows editing the next number, string (within""), or file name (within <>) following the comment. The "entry" can have a type appended, like "entry_entity" or "entry_path" (see below). This is for defining special entry types.

Examples for entry fields:

//entry: Fall Speed
var fallspeed = 17;

The next number is 17, so a number entry field labeled "Fall Speed" will appear in the panel with a default value of 17.

//entry: model description
STRING* my_desc = "This is a walking guard";

A 32 character wide text entry field labeled "model description" will pop up.

//entry: background image (256x1024 max.)
type = "mountains.tga"

A file requester labeled "background image (256x1024 max.)" will pop up with a default type of image files (*.pcx, *.bmp, *.tga).

//entry: step sound
SOUND* tap_snd = "tap.wav";

A file requester labeled "step sound" will pop up with a default type of sound files (*.wav).

// cntl: spin min max step

Addendum to an entry comment tag. Defines a spinner control. The min and max values keep the value entered in range. The small up and down arrows next to the field allow you to increase and decrease the numeric value by the step amount.

Example:

//entry: Light Value
//cntl: spin 0 255 5 //help: Set the light vlaue between 0 and 255 in steps of 5
var light = 100;

// cntl: slider min max step

 A6.6  Addendum to an entry comment tag, defines a horizontal slider. The min and max values keep the value entered in range.

Example:

//entry: Light Value
//cntl: slider 1 50 1 //help: Set the value between 1 and 50 in steps of 1

var myValue = 30;

// cntl: drop_list option1 option2 option3..

Addendum to an entry_drop comment tag. Adds a drop down box with a list of options.

Example:

// entry_drop: Sky type 
// help: Select render style of the sky
// cntl: drop_list dome cube cylinder
flags = dome;
// This will create a drop down box with the option to select: dome, cube, cylinder (with dome already selected).

Some special entry types:

// entry_drop: text

Entry field that uses a drop down box. Must be followed by a drop_list cntl tag.

// entry_entity: text

Edits the following string, from a scroll list which contains all entity names in the level.

// entry_path: text

Edits the following string, from a scroll list which contains all path and start names in the level.

// entry_text: x,y,text

Edits the following string, with a scrollable text entry field of x characters width and y lines height. If y = 0, the field has only one line and no scrollbar. ? latest version online