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.

General comment tags


Defines a template header for use by the template manager. Example:
// ---------------------------------------------------------------------
// ver: 1.1
// engineReq: 7.82
// date: 091011
// title: weaponFX
// class: WEAPON
// type: SUPPORT
// image: weaponfx.pcx
// help: Handle weapon effects (bullet holes, sparks, etc.).
// needs: particles.h
// prefix: wfx_
// idcode: 720
// ---------------------------------------------------------------------

// title: text

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

// needs: name1.h name2.h ...

This token in a customizable script determines that the given template scripts must also be present when adding the script. WED looks whether they are already included. If not, they will be automatically included immediately before the current script, and copied into the work folder. Example:
// needs: movement.h animation.h

Includes movement.h and animation.h before the current template in the main script, if they are not already included.

// image: name.pcx

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

// 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.

Function comment tags

// skill1: name default
// FLAG1: name default

Determines individual skill and flag names for the following entity action. The Skill1..Skill20 and Flag1..Flag8 names in the WED Behavior Panel are then replaced by the name listed here. 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' (1) 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.

Entry comment tags

// 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 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:
//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

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
flags2 = 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.

// 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

// 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.

// id: number

Gives any entry field a unique number. This is important for automatically updating the template from the WED template manager, but maintaining the customized entry values.


? latest version online