Warzone2100. Script language notes.
Pumpkin Studios. 1999

Note: making any modifications to Warzone 2100 will void any technical support open to you. We will not answer questions or help you in any way if you have modified Warzone 2100. Pumpkin Studios and Eidos will not take responsibility for any damage resulting from modifcation of Warzone 2100.

Specific skirmish notes:
Much of the file below doesn’t apply to skirmish scripts!
Make your changes to player0.slo and vlo -> player7.slo and vlo.
This file may not be complete or contain out of date information.

Comments

There are two type of comment for the script language.  A multi-line comment is started by 
the characters /* and finishes with */.  A single line comment is started by //.

Declaring Variables

A variable declaration is structured :

	<storage> <type> <name> [ , <name> , … ] ;

<storage> is one of public or private.  public means that the variable can have a 
value assigned in the world editor.  private means the value is only used within the script 
and cannot be set in the editor.

<type> is the data type of the variable.  There are four default types of variable: int bool 
trigger event.  int is a numeric value.  bool stores only a true or false value.  
trigger stores a reference to a script trigger.  event stores a reference to a script event.  
There are also a number of extra user defined types specific to the game.

<name> is the identifier by which the variable is referred to.  If more than one variable of a 
type is required, additional names separated by commas can be added.

Declaring Triggers

Triggers are used to schedule when an event should occur.  The format of a declaration is:

	trigger <name> ( <trigger type> );

<trigger type> can be any of:

	init	Run the event when the script starts.
	inactive	Do not run the event until a trigger is assigned to it.
	wait , <time>	Run the event after delay <time>.
	every , <time>	Run the event at every <time> interval.
	<bool exp>, <time>	Run the event if <bool exp> is true, checking every
		<time> interval.

<bool exp> is a boolean expression (described below) which may include game function 
calls and script variables.

Declaring Events

Events contain the actual code to execute when a trigger is activated.  They are declared :

	event <name> ( <trigger> ) { <code> }

<name> is the identifier for the event.

<trigger> is either the identifier of a previously declared trigger, or a new <trigger type> 
declaration.

<code> is the actual script code to execute when the event is activated.

Number Expressions

Numeric expressions are made up of int variables, numeric constants and functions that 
return int values, e.g.:

	power * 32 - basePower
	numDroids(player) + 5

The possible operators are :

	+  -  *  /

There are also a number of operators that compare numeric expressions to give a boolean 
expression :

	<  >	Less than / Greater than
	<= >=	Less or Equal / Greater or Equal
	== !=	Equal / Not Equal

Boolean Expressions

Boolean expressions are made up of bool variables, the boolean constants true and 
false and game functions that return a boolean value e.g.

	not droidSeen and attackDroid

The possible operators are :

	and or not == !=

The operators == and != can also be used with user defined type variables.

Assignment

The value of a variable or an expression can be assigned to another using the = character, 
e.g.:

	currentDroid = foundDroid;
	index = base + found * 4;

if statements

if statements are used to control which bits of code are executed.  The simplest form is :

	if ( <bool exp> )
	{
		<code>
	}

In this form if <bool exp> evaluates to true then the script code <code> is executed, 
otherwise the code is ignored.

	if ( <bool exp> )
	{
		<code>
	}
	else
	{
		<code>
}

	if ( <bool exp> )
	{
		<code>
	}
	else if ( <bool exp> )
	{
		<code>
}
	else
	{
		<code>
}

while statements

	while ( <bool exp> )
	{
		<code>
	}

SCRIPT FUNCTION TYPES

With a complex object it is possible to access information specific to the instance of this object. For example a DROID is a complex object - its x,y,z can be queried whereas a DROIDID (a simple object) is just a placeholder for the numeric value of the ID.

INTMESSAGE - (simple) Name of a message as defined in Messages.txt

BASEOBJ	- (complex) any of a DROID,FEATURE or STRUCTURE
	You have access to :
 	baseobj.x
	baseobj.y
	baseobj.z
	baseobj.id			- unique id number
	baseobj.player		- player id
	baseobj.type		- one of OBJ_DROID, OBJ_STRUCTURE, OBJ_FEATURE
 	baseobj.health		- %age number of body points
	baseobj.clusterID	- the cluster the object is a member of

NOTE: the functions objToDroid, objToStructure and objToFeature exist to convert a BASEOBJ
	  to a droid, structure or feature if the base obj is of the right type.

DROID	- (complex) defined by the ID got from the world editor
	You have access to :
		all BASEOBJ variables
		droid.order    -  current order of the droid
		droid.body	   - the BODY of the droid
		droid.propulsion - the PROPULSION of the droid
		droid.weapon   - the WEAPON of the droid

DROIDID - (simple) literally just an ID of a droid

FEATURE - (complex) defined by the ID got from the world editor
	You have access to :
		all BASEOBJ variables

FEATURESTAT - (simple) name of a feature as defined in features.txt

TEMPLATE - (simple) name of a template as defined in templ.bjo - loaded in as part of the save game

STRUCTURE - (complex) defined by the ID got from the world editor
	You have access to :
		all BASEOBJ variables
		structure.stat	- the STRUCTURESTAT of the structure

STRUCTUREID - (simple) literally just an ID of a struct
STRUCTURESTAT - (simple) name of a structure as defined in structures.txt

BODY - (simple) name of a body as defined in body.txt 
PROPULSION - (simple) name of a propulsion as defined in propulsion.txt 
ECM - (simple) name of a ECM as defined in ecm.txt
SENSOR - (simple) name of a sensor as defined in sensor.txt
CONSTRUCT - (simple) name of a construct as defined in construct.txt
WEAPON - (simple) name of a weapon as defined in weapons.txt
REPAIR - (simple) name of a repair type as defined in Repair.txt
BRAIN - (simple) name of a brain type as defined in Brain.txt

SOUND - (simple) ID of sound used in playSound()

LEVEL - ID of a level as defined in GameDesc.lev

GROUP - (complex) a group of droids
	You have access to :
	group.x			- average x coord
	group.y			- average y coord
	group.members	- number of units in the group
	group.health	- average %age health of the units

NOTE: these are calculated the first time you access them for a group
and then cached for repeated access for this group.  It is therefore
much quicker if you do all actions on one group before accessing another

RESEARCHSTAT - (simple) name of a research topic as defined in research.txt (and the database)

SCRIPT FUNCTIONS

setSnow(BOOL)
This function switchs snow on or off. TRUE will turn snow on, FALSE will turn snow off. If rain is on when snow is started the rain 
will be turned off.
 
setRain(BOOL)
This function switchs rain on or off. TRUE will turn rain on, FALSE will turn rain off. If snow is on when rain is started the snow 
will be turned off.

setBackgroundFog(BOOL)
This function switchs background fog on or off. This sets the backdrop to the current fogcolour and fogs the edge of the visible world.
TRUE will turn background fog on, FALSE will turn background fog off.

setDepthFog(BOOL)
This function switchs depth fog on or off. This sets the sets fog ramping up from zero in the middle of the view to full fog at the edge
of the visible world. TRUE will turn depth fog on, FALSE will turn depth fog off.

setFogColour(RED, GREEN, BLUE)
This function sets the fog colour, to be used when fog is enabled. This colour is also used in the background clear when fog is enabled.
The colour is specified as RED, GREEN and BLUE components each in the range 0 to 255. This yields a 24 bit colour value.
Colour values outside the range 0 to 255 will have an indeterminate effect.
WARNING setting the fog colour to BLACK(0, 0, 0) does not turn fog off and should be avoided.
Arizona: NEW	204, 149, 70	Nick approved 24/09/98		(Old 176, 143, 95	B08F5F)
Urban:		201, 146, 15	C9920F
Rockies:	182, 225, 236	B6E1EC

enableComponent(COMPONENT, PLAYER)
This function makes a component found to a player - so that they can research a topic that requires the component
COMPONENT is any type of Body, Propulsion, Weapon, ECM, Sensor, Construct etc
PLAYER is the id of the player who gets the component

makeComponentAvailable(COMPONENT, PLAYER)
This function makes a component available to a player - so that they can build Units using this component
COMPONENT is any type of Body, Propulsion, Weapon, ECM, Sensor, Construct etc
PLAYER is the id of the player who gets the component

enableStructure(STRUCTURESTAT, PLAYER)
This function makes a structure available to a player - so that they can research a topic that requires the structure or build the structure
STRUCTURESTAT is defined by the name from Access
PLAYER is the id of the player who gets the structure

enableResearch(RESEARCHSTAT, PLAYER)
This function makes a research topic available to a player regardless of its pre-requisites
RESEARCHSTAT is defined by the name from Access
PLAYER is the id of the player who gets the research

completeResearch(RESEARCHSTAT, PLAYER)
This function acts as if the research was performed by the player giving them the results
RESEARCHSTAT is defined by the name from Access
PLAYER is the id of the player who gets the research

BOOL objectInRange(PLAYER, X,Y, RANGE)
BOOL droidInRange(PLAYER, X,Y, RANGE)
BOOL structInRange(PLAYER, X,Y, RANGE)

These functions check for when an object/droid/structure belonging to a player is within range of a position
PLAYER is the id of the player whose unit is checked for in range
X,Y is the position to check from in world coords
RANGE is in world coords - 128 units = 1 tile

BOOL objectInArea(PLAYER, X1,Y1, X2,Y2)
BOOL droidInArea(PLAYER, X1,Y1, X2,Y2)
BOOL structInArea(PLAYER, X1,Y1, X2,Y2)

These functions check for when an object/droid/structure belonging to a player is in a square area
PLAYER is the id of the player whose droid is checked for in area
X1,Y1,  X2,Y2 is the area to check in world coords
X1,Y1 should be smaller than X2,Y2

BOOL droidHasSeen(OBJECT, PLAYER)
This functions checks for when a player has seen a given object - either by unit or structure
OBJECT is any type of DROID, FEATURE, STRUCTURE
PLAYER is the id of the player to check for having seen

addDroid(TEMPLATE, X, Y, PLAYER)
This function adds a unit for the player based on the template passed in. 
The unit is placed at x,y
TEMPLATE is a valid template (doesn't have to belong to the player!)
X, Y are in world coords
PLAYER is the id of the player whose the unit belongs to

buildDroid(TEMPLATE, STRUCTURE, PLAYER, QUANTITY)
This function sets a factory defined by STRUCTURE to build units based on the TEMPLATE for the PLAYER. 
TEMPLATE is a valid template (doesn't have to belong to the player!)
STRUCTURE is a structure defined by ID and MUST BE A FACTORY
PLAYER is the id of the player whose the unit belongs to
QUANTITY is the number of units that will be built

BOOL buildingDestroyed(STRUCTUREID, PLAYER)
This function checks that a structure (given by the id) no longer exists for the player
STRUCTUREID is the id of the structure - NB this is different to an object of type STRUCTURE
PLAYER is the id of the player whose list is checked for the building

BOOL structureIdle(STRUCTURE)
This function checks whether the structure is doing anything. Returns TRUE if idle
STRUCTURE is a valid structure defined by ID

BOOL structureBeingBuilt(STRUCTURESTAT, PLAYER)
This function checks that a structure of type STRUCTURESTAT is currently being built for the specified PLAYER
STRUCTURESTAT is defined by the name from Access
PLAYER is the id of the player who gets the structure

BOOL structureBuilt(STRUCTURESTAT, PLAYER)
This function checks that a structure of type STRUCTURESTAT is currently built for the specified PLAYER
STRUCTURESTAT is defined by the name from Access
PLAYER is the id of the player who gets the structure

addReticuleButton(BUTTONID)
This function adds a reticule button to the interface
BUTTONID is the id of a button - see ScriptConstants.txt

removeReticuleButton(BUTTONID)
This function removes a reticule button from the interface
BUTTONID is the id of a button - see ScriptConstants.txt 

addMessage(INTMESSAGE, MESSAGETYPE, PLAYER, PLAY_IMMEDIATE)
This adds a message to the interface for the PLAYER
INTMESSAGE is a variable defined in the values file 
MESSAGETYPE is a predefined type - see ScriptConstants.txt
PLAYER is the player who gets the message
PLAY_IMMEDIATE is a bool for whether to bring the Intelligence Screen up with the message immediately or just store it

removeMessage(INTMESSAGE, MESSAGETYPE, PLAYER)
This removes a message from the interface for the PLAYER
INTMESSAGE is a variable defined in the values file 
MESSAGETYPE is a predefined type - see ScriptConstants.txt
PLAYER is the player who loses the message

!!!!!!!!!!!NO LONGER AVAILABLE!!!!!!!!!!
//addTutorialMessage(INTMESSAGE, PLAYER)
//This adds a tutorial message to the display for the PLAYER - its is played immediately //without the intelligence screen coming up. The message is not stored and therefore cannot //be re-displayed. It can be added over and over again though!
//INTMESSAGE is a variable defined in the values file 
//PLAYER is the player who gets the message

BOOL selectDroidByID(DROIDID, PLAYER)
This selects a unit defined by the ID since we can't guarantee the name! Only the list of units belonging to PLAYER will be checked. This returns TRUE if the unit could be found - it will be worth checking it exists!
DROIDID is a valid unit defined by ID

setAssemblyPoint(X, Y, STRUCTURE)
This sets the location of where new units assemble at for a specific factory
X, Y are the x and y in world coordinates
STRUCTURE is a valid structure defined by ID

FEATURE addFeature( FEATURESTAT, X, Y )
Builds a feature at position (x,y).
FEATURESTAT is the name of a feature stat defined in features.txt.
The feature identifier is returned - this can be used in e.g. destroyFeature.

destroyFeature(FEATURE)
This removes the feature from the world
FEATURE is a feature defined by ID

centreView(OBJECT)
This function centres the view on the object supplied
OBJECT is any type of DROID, FEATURE, STRUCTURE

STRUCTURE addStructure( STRUCTURESTAT, PLAYER, X, Y )
Builds a structure belonging to PLAYER centred at (X, Y).
The structure must be previously enabled via enableStructure().
The structure identifier is returned - this can be used in e.g. destroyStructure.

destroyStructure(STRUCTURE)
This removes the structure from the world
STRUCTURE is a structure defined by ID

STRUCTURE getStructure(STRUCTURESTAT, PLAYER)
This function returns the first STRUCTURE based on the stat for the player it can find.
To use it create a STRUCTURE variable and assign it to the result of the function call.
For example:

STRUCTURE 			myNewStructure;
STRUCTURESTAT 		Factory;

myNewStructure = getStructure(Factory, 0);

This will look through the player 0 list of structures to find a Factory and return a variable of type STRUCTURE. You will then be able to access the x, y, and z. If a structure cannot be found than NULL is returned . It will be worth checking that the STRUCTURE does not equal NULL before using it. For example:
if (myNewStructure == NULLOBJECT)
{
	do something
}

initEnumStruct(STRUCTURESTAT,player,player2)
STRUCTURE enumStruct()
Enumerate through visible structures of given type, enum struct returns NULLOBJECT when no more exist.
player  = player who is looking (eg selectedPlayer)
player2 = player whose structures are to be enumerated.

TEMPLATE getTemplate(COMPONENT, PLAYER)
This function returns the first TEMPLATE based on the stat for the player it can find. It can be any type of component. To use it create a TEMPLATE variable and assign it to the result of the function call. For example:

TEMPLATE			myNewTemplate;
WEAPON			Rocket;

myNewTemplate = getStructure(Rocket, 0);

This will look through the player 0 list of template to find one which contains a rocket and then return a variable of type TEMPLATE. You will then be able to access its attributes. If a template cannot be found than NULL is returned . It will be worth checking that the TEMPLATE does not equal NULL before using it. For example:

if (myNewTemplate == NULLTEMPLATE)
{
	do something
}
	
setScrollParams(minX, minY, maxX, maxY)
This literally sets the scroll settings for the current map - be careful not to set the maxX/maxY greater than that possible for the map!
minX, minY, maxX, maxY are all numbers. These are in TILE COORDINATES!!!!!!

setScrollMinX(minX)
This just sets the one variable. These are in TILE COORDINATES!!!!!!
minX is a number

setScrollMinY(minY)
This just sets the one variable. These are in TILE COORDINATES!!!!!!
minY is a number

setScrollMaxX(maxX)
This just sets the one variable. These are in TILE COORDINATES!!!!!!
maxX is a number

setScrollMaxY(maxY)
This just sets the one variable. These are in TILE COORDINATES!!!!!!
maxY is a number

setDefaultSensor(SENSOR, PLAYER)
This sets which sensor will be used as the default when designing units in game for the specified player. The SENSOR must be a valid DEFAULT sensor.

setDefaultECM(ECM, PLAYER)
Like the above functionm, this sets which ECM will be used as the default when designing units. Again the ECM must be a valid DEFAULT ECM.

setStructureLimits(STRUCTURESTAT, LIMIT, PLAYER)
This sets a limit for a specific structure on how many can be built on a map. 
STRUCTURESTAT is defined by the name from Access
LIMIT is a number between 0 and 255
PLAYER is the id of the player 

setAllStructureLimits(LIMIT, PLAYER)
This sets a limit for all structures on how many can be built on a map. 
LIMIT is a number between 0 and 255
PLAYER is the id of the player 

playSound( SOUND, PLAYER)
Plays a '2D' sound ie speech and is audible for the player identified
SOUND is a defined type.
PLAYER is the id of the player 

playSoundPos( SOUND, PLAYER, x, y, z)
Plays a '2D' sound ie speech and is audible for the player identified
Position of sound is saved so camera can move to object playing sound if required.
SOUND is a defined type.
PLAYER is the id of the player
x, y, z is the position of the object in game units.

addConsoleText( TEXTSTRING, PLAYER)
Adds console text to the top of the screen (centre justified) for the player concerned
TEXTSTRING is a string ID obtained from strings.txt
PLAYER is the id of the player 

turnPowerOn()
Literally makes the power calculations be used

turnPowerOff()
Literally stops the power calculations being used

setPowerlevel(POWER, PLAYER)
sets the power level for a player - this overrides any current setting there is
POWER is the value to set the player's power to
PLAYER is the id of the player 

addPower(POWER, PLAYER)
adds the POWER amount to the PLAYER's current level
POWER is the value to add to the player's power
PLAYER is the id of the player 

setLandingZone(x1, y1, x2, y2)
sets the landing zone for the map. The coords are in tile units and must all be less than 255

setLimboLanding(x1, y1, x2, y2)
sets the landing zone for the Limbo Units.The coords are in tile units and must all be less than 255
The units from the Limbo list are then placed at this location - so call in CALL_GAME_INIT of the mission you want them to appear in

initAllNoGoAreas()
initialises all the no go areas to 0. Should be called when a new map is loaded

setNoGoArea(x1, y1, x2, y2, areaNum)
defines an area that cannot be built on - used for enemy landing zones. 
areaNum is a number between 0 and 7. If 0, then this function is the same as calling setlandingZone

setTransporterExit( PLAYER, exitTileX, exitTileY )
setup transporter exit point on map for PLAYER

flyTransporterIn( PLAYER, entryTileX, entryTileY, BOOL bTrackTransporter )
flys PLAYER's transporter in from entry point on map; set bTrackTransporter true to
track it onto the map.

tutorialEnd()
A bit of a hack to notify the game when the last of the tutorial events has been run 
so that the console messages can be turned back on to how they will appear for 
the rest of the game

gameOver(BOOL)
function to call for ending the game
BOOL - true or false depending on whether the player has won or not

anyDroidsLeft(PLAYER)
checks the specified player for any units - returns TRUE if some exist, FALSE if 
they have all been destroyed

anyStructButWallsLeft(PLAYER)
checks the specified player for any structures except walls - returns TRUE if some 
exist, FALSE if they have all been destroyed

anyFactoriesLeft(PLAYER)
returns true if player has a factory/cyborg factory/ vtol factory

setRetreatPoint(PLAYER, x,y)
sets the position for a players units to retreat to

setRetreatForce(INT player, INT level)
Sets the percentage of the current force below which units for a side will retreat

setRetreatLeadership(INT player, INT level)
Sets the leadership level (chance to run away) for a player (1-100)

startMission(MISSION_TYPE, LEVEL)
Starts a mission for the currently selected player - NB Transporters must be filled if
you want units to appear on the Mission map
MISSION_TYPE is a predefined type - see ScriptConstants.txt
LEVEL is the name of the level to load as defined in GameDesc.lev

endMission(BOOL)
Ends the current mission the selected player is on - returns all Units that have been 
loaded onto the Transporter. False if player lost, true if player won????

!!!! DISABLED, no group wins at this time !!!!!!
!!BOOL allianceState()
!!returns true if group wins are allowed in the particular multiplayer game.
!!returns false otherwise.

BOOL allianceExists()
returns true if two or more players are in alliance. returns false otherwise.

BOOL dominatingAlliance()
returns true if there is a single dominating alliance, using all multi-players.

BOOL playerInAlliance()
returns true if player is in an alliance

BOOL myResponsibility(PLAYER);
returns true if this machine is responsible for 'player' in multiplayer games.

STRUCTURE structureBuiltInRange(STRUCTURESTAT, X, Y, RANGE, PLAYER)
Checks to see if a Structure has been built within a specified range of x, y. The first structure
to be found within this range will be returned. Check the result of the function for being
NULLOBJECT before using!
STRUCTURE is a return value (structure defined by ID)
STRUCTURESTAT is defined by the name from Access
X, Y, RANGE are all in world coords
PLAYER is the id of the player whose structure list is searched

groupAddDroid(GROUP, DROID)
Add a unit to a group

groupAddArea(GROUP, PLAYER, X1,Y1, X2,Y2)
Add all the units inside the rectangle X1,Y1, X2,Y2.
Only units belonging to player PLAYER are added.

groupAddAreaNoGroup(GROUP, PLAYER, X1,Y1, X2,Y2)
as above but doesnt add units that are already grouped.

groupAddGroup(group1, group2)
Add all the units in group2 to group1.
All the units are removed from group2.

orderDroid(DROID, order)
Give a unit an order currently one of:
	DORDER_STOP			- stop current order
	DORDER_RETREAT		- retreat
	DORDER_DESTRUCT		- self destruct
	DORDER_RTR			- return to repair
	DORDER_RTB			- return to base
	DORDER_RUN			- run away for a bit (moral failure)

orderDroidLoc(DROID, order, x,y)
Give a unit an order with a location :
	DORDER_MOVE			- move to location

orderDroidObj(DROID, order, BASEOBJ)
Give a unit an order with an object :
	DORDER_ATTACK		- attack the object
	DORDER_HELPBUILD	- help construct the object
	DORDER_DEMOLISH		- demolish structure
	DORDER_REPAIR		- repair structure
	DORDER_OBSERVE		- (sensor units) keep a target in sensor range
	DORDER_EMBARK		- get onto a transporter
	DORDER_FIRESUPPORT	- follow this sensor unit and attack anything it DORDER_OBSERVE's

orderDroidStatsLoc(DROID, INT order, STRUCTURESTAT stats, INT x, INT y)
Give a unit an order with stats and a location :
	DORDER_BUILD		- build a structure at the location

orderGroup(GROUP, order)
Give all the units in the group an order

orderGroupLoc(GROUP, order, x,y)
Give all the units in the group an order with a location

orderGroupObj(GROUP, order, BASEOBJ)
Give all the units in the group an order with an object

DROID objToDroid(BASEOBJ)
Convert a BASEOBJ to DROID when BASEOBJ.type == OBJ_DROID. Returns NULLOBJECT otherwise

STRUCTURE objToStructure(BASEOBJ)
Convert a BASEOBJ to STRUCTURE when BASEOBJ.type == OBJ_STRUCTURE. Returns NULLOBJECT otherwise

FEATURE objToFeature(BASEOBJ)
Convert a BASEOBJ to FEATURE when BASEOBJ.type == OBJ_FEATURE. Returns NULLOBJECT otherwise

INT random(range)
Return a random number between 0 and range - 1.

flashOn(INT buttonID)
turn on flashing for a button (id's in scriptConstants.txt)
 ... now works for all buttons not just reticule buttons

flashOff(INT buttonID)
turn off flashing for a button

createAlliance(INT player1, INT player2)
Create an alliance between two players

breakAlliance(INT player1, INT player2)
Breake an alliance between two players

setRadarZoom(INT level)
level is the zoom level between 0 .. 2 on the PC and 0 .. 1 on PSX.
0 is the most zoomed out, 2 the most zoomed in.
2 is mapped to 1 if the script is run on the PSX

centreViewPos(INT x, INT y)
center the view on the world coordinates x,y.

setGroupRetreatForce(GROUP group, INT level)
Sets the percentage of the current force below which units for a side will retreat

setGroupRetreatLeadership(GROUP group, INT level)
Sets the leadership level (chance to run away) for a player (1-100)

setGroupRetreatPoint(GROUP group, INT x, INT y)
Set the retreat position for a group

setDroidSecondary(DROID droid, INT secondaryOrder, INT secondaryState)
Set the state of a secondary order for a droid (values in scriptConstants.txt)

setGroupSecondary(GROUP group, INT secondaryOrder, INT secondaryState)
Set the state of a secondary order for a group (values in scriptConstants.txt)

setMissionTime(INT time)
used to specify how long an OffWorld mission will last for - used in conjunction with the
callback CALL_MISSION_TIME so that end conditions can be displayed if the player has not
managed to finish the mission
If time < 0, there is no limit. time is in 10th of a second

INT missionTimeRemaining()
Returns how long left for the current mission. If the mission time has not been set it will return 0.
The value returned is in 10ths of a second

setReinforcementTime(INT time)
this defines how long it will take for reinforcements to arrive for an OffWorld mission
If time < 0, there can be no reinforcements. Time is in 10th of a second.
Set time to LZ_COMPROMISED_TIME to display '--:--' to indicate the Transporter is unable to land

INT idleGroup(GROUP group)
returns number of units in group not doing anything.

BOOL groupMember(GROUP group, DROID droid)
return whether a unit is a member of a group.

initIterateGroup(GROUP group)
Prepare a group to iterate through the units in it.

DROID iterateGroup(GROUP group)
Get the next unit from the group.  Must be called after an initial initGroupIterate.
To reset a group back to the start call initGroupIterate.

droidLeaveGroup(DROID droid)
Make a unit leave the group it is a member of (if any).

initGetFeature(STRUCTURESTAT, PLAYER,BUCKET)
getFeature(BUCKET)
enumerate features of a single feature type.
PLAYER is the player to use, Only features visible to that player are returned.
BUCKET is an int of range 0-MAX_PLAYERS(8), so up to 8 feature enumerations can be going on at any time! (wow)
getFeature returns NULLOBJECT when no more features are visible.

BOOL structButNoWallsInArea(PLAYER, X1,Y1, X2,Y2)
See if there are any player structures excluding walls in an area.

INT numObjectsInArea(PLAYER, X1,Y1, X2,Y2)
Return the number of player objects in an area.

INT numDroidsInArea(PLAYER, X1,Y1, X2,Y2)
Return the number of player units in an area.

INT numStructsInArea(PLAYER, X1,Y1, X2,Y2)
Return the number of player structures in an area.

INT numStructsButNotWallsInArea(PLAYER, X1,Y1, X2,Y2)
Return the number of player structures excluding walls in an area.

randomiseSeed()
Generate a new random seed for the random number generator.

INT numStructsByTypeInArea(PLAYER, TYPE, X1,Y1, X2,Y2)
Return the number of structures of a certain type in an area.

flushConsoleMessages()
Clear all the console messages

BOOL pickStructLocation(STRUCTURESTAT,ref x, ref y, player);
returns true if structure of type strucutrestat can be built at x,y.
 If a structure can be built nearby then returns true and modifies x and y
to the coords of acceptable location. Player trying to build - uses this for the visibility

INT playerPower(INT player)
returns aspower[player].currentPower (players current power)

BOOL seenStructInArea(INT player,INT enemy,BOOL walls,INT x1,INT y1,INT x2,INT y2)
returns true if player has seen a structure belonging to enemy in area specified. Call with
walls = true/false to include/exclude walls in the search.
(note similar to StructInArea)

INT	distBetweenTwoPoints(INT x1, INT y1, INT x2, INT y2)
Returns the distance between the two points given.

BOOL losTwoObjects(BASEOBJ source, BASEOBJ target, BOOL wallsMatter)
Decides whether object source can see object target and you can specify whether
walls matter or not. Note that whilst target can be anything, source needs to be
something that can actually see - ie - have a sensor like a unit or structure.
Returns TRUE or FALSE

void killStructsInArea(INT player, INT buildingRef (like REF_WALL etc), INT x1, INT y1, 
	INT x2, INT y2, BOOL bSeeEffect, BOOL bTakeFeatures)
Blows up all the buildings of the specified reference within the specified area. 
If bSeeEffect is set, then you'll see it blow up (provided you can see the building
in question of course).
If bTakeFeatures is et, then it will also kill features of type BUILDING.
Returns 'nowt.

INT getThreatInArea(INT playerLooking, INT playerTarget, INT x1, INT y1, INT x2, INT y2, INT ldThreat, INT mdThreat, INT hdThreat)
Returns the threat value of all units of a specified player within a certain area for a specified player. 
The user can 'calibrate' this threat value by specifying the relative weights attached to the threats of
small,medium and heavy units respectively as the last three parameters to this function. The final boolean
parameter allows the user to say whether they care about whether or not the units in question are
presently visible.. TRUE means they only add to the threat if PlayerLooking can see this unit (owned by
playerTarget), FALSE means they add to the threat if even they can't see that unit.

BOOL getNearestGateway(INT x, INT y, ref rX, ref rY)
Puts the coordinates of the nearest gateway into reference variables rX and rY. It might not though
if there are no gateways on the present map. So make sure you look at the return value. If it's FALSE, 
then the values in rX and rY will be meaningless - unchanged actually, assuming the scripting works 
this way. Otherwise, they'll be the coordinates of the midpoint of the nearest gateway.

VOID setWaterTile(INT tileNum)
Sets the tile to use for underwater. Count from the top of the tileset pcx - presently 17 for arizona.

initIterateCluster(INT clusterID)
get ready to iterate a cluster

BASEOBJ iterateCluster()
return the next object in the cluster or NULLOBJ if none left

cmdDroidAddDroid(DROID commander, DROID droid)
adds the unit droid to the command group of the command unit commander

BOOL testStructureModule(INT playeNumber, ST_STRUCTURE structureToTest, INT ref)
Returns true if the structure in question has a module attached - presently the ref id is unused but 
could be later on. At the moment it returns true if the structure has _any_ number of modules attached.
If the structure pointer that's sent in is NULL (ie - no structure is specified), then it'll return 
TRUE is _any_ of the player's structures possess _any_ module. In all other cases, it'll return FALSE.

BOOL addTemplate(TEMPLATE, INT player)
given a template, gives the player the template so that build droid can be used. At least one
player must have the template.

VOID vanishUnit(DROID droid)
Will remove 'droid' from the world without any graphical hoo ha.

VOID forceDamageObject(BASEOBJ obj, INT damage)
Sets 'obj' to be 'damage' percent damaged. Obj must be a feature,droid or structure and damage 
must be <= 100.

BOOL getGameStatus(INT StatusRequired)
Gets the status of some of the game TRUE/FALSE variables. Can be used to find if the reticule is up or the
battle map is open,  that sort of thing.

e.g.    getGameStatus(STATUS_ReticuleIsOpen);	will return TRUE if the reticule is open (on screen) or FALSE if the reticule is not (disabled)
or
	    getGameStatus(STATUS_BattleMapViewEnabled);	will return TRUE if we are in the battle map mode
or
	    getGameStatus(STATUS_DeliveryResposInProgress);	will return TRUE if we are repositioning the delivery point

these are currently the only two options implemented ... for other game modes (like design screen or intelligence map modes)
 use the externed variable intMode

INT getPlayerColour(INT player)
returns the colour of the player

VOID setPlayerColour(INT colour, INT player)
sets the colour to use for the player specified - colour must be 0 to (MAX_PLAYERS-1)

DROID takeOverSingleDroid(DROID droidToTakeOver, INT playerToGain)
this replaces the existing droid (droidToTakeOver) by a new one for the playerToGain. 
The new droid is passed back to the script 
****Test for NULLOBJECT BEFORE calling this function****

INT takeOverDroidsInArea(INT fromPlayer, INT toPlayer, INT x1, INT y1, INT x2, INT y2)
x1,y1,x2,y2 are in world units
checks for units belonging to fromPlayer and if they are in the area they are 'given' to the toPlayer

INT takeOverDroidsInAreaExp(INT fromPlayer, INT toPlayer, INT x1, INT y1, INT x2, INT y2, INT level, INT max)
x1,y1,x2,y2 are in world units
checks for units belonging to fromPlayer and if they are in the area they are 'given' to the toPlayer
if their experience level is less than or equal to level
max specifies the maximum number of units to take over

STRUCTURE takeOverSingleStructure(STRUCTURE structToTakeOver, INT playerToGain)
this replaces the existing structure (structToTakeOver) by a new one for the playerToGain. 
The new structure is passed back to the script 
****Test for NULLOBJECT BEFORE calling this function****

INT takeOverStructsInArea(INT fromPlayer, INT toPlayer, INT x1, INT y1, INT x2, INT y2)
x1,y1,x2,y2 are in world units
checks for structures belonging to fromPlayer and if they are in the area they are 'given' to the toPlayer
This will NOT WORK for the selectedPlayer on any Factory. The structure limits will be increased if necessary

VOID resetStructTargets()
reset the structure preferences

VOID resetDroidTargets()
reset the unit preferences

VOID setStructTarPref(INT type)
set a prefered structure target type, repeated calls combine the effect

VOID setStructTarIgnore(INT type)
set structure target ignore types

VOID setDroidTarPref(INT type)
set prefered unit target types

VOID setDroidTarIgnore(INT type)
set unit target ignore types

STRUCTURE structTargetInArea(INT targetPlayer, INT visibleToPlayer, INT x1, INT y1, INT x2, INT y2)
get a structure target in an area using the preferences
targetPlayer is the player to choose targets from, visibleToPlayer specifies the
player that has to be able to see the target or -1 for no visibility check

STRUCTURE structTargetOnMap(INT targetPlayer, INT visibleToPlayer)
get a structure target on the map using the preferences

DROID droidTargetInArea(INT targetPlayer, INT visibleToPlayer, INT x1, INT y1, INT x2, INT y2)
get a unit target in an area using the preferences

DROID droidTargetOnMap(INT targetPlayer, INT visibleToPlayer)
get a unit target on the map using the preferences

BASEOBJ targetInCluster(INT clusterID, INT visibleToPlayer)
get a target from a cluster using the preferences

VOID fireWeaponAtObj(WEAPON weap, BASEOBJ target)
fire a single shot of the weapon weap at the object target

VOID fireWeaponAtLoc(WEAPON weap, INT x, INT y)
fire a single shot of the weapon weap at the location x,y

BOOL isStructureAvailable(STRUCTURESTAT stat, INT player)
PC ONLY FOR NOW. returns true if structure is available to player, false otherwise.

BOOL structureComplete(STRUCTURE struct)
PC ONLY FOR NOW. returns true if the structure is completely built.

INT getDroidCount(INT player)
returns the number of units on the current map for the specified player

setDroidKills(DROID droid, INT kills)
sets the number of kills for a unit.  currently the level boudaries are:
4, 8, 16, 32, 64, 128, 256, 128

resetPlayerVisibility(INT player)
reset the visibility for a player

VOID resetLimboMission(VOID)
This can only be called mid Limbo Expand mission - the units that were stored in the
mission list at the start of the mission are added back into the map, and the mission
type is changed to an Expand Mission.

INT killDroidsInArea(INT x1, INT y1, INT x2, INT y2, INT player)
Kills all the player's units within the area defined. Returns how many it wiped out.

 traceOn()  -- view the script debug info to stdout.
 traceOff()

BOOL applyLimitSet (void)
Apply the limits set in the structure limits screen.

BOOL isHumanPlayer (INT pl)
Returns true is pl is human.

VOID offerAlliance (INT p1, INT p2)
Make p1 offer p2 an alliance

BOOL allianceExistsBetween (INT p1 , INT p2)
True if alliance exists between p1 and p2.

VOID skDoResearch{ STRUCTURE str , INT pl , INT bias)
Make player pl do some research with structure str.

BASEOBJECT	skLocateEnemy( INT pl)
Return a baseobject of interest belonging to player pl.

BOOL	 skCanBuildTemplate{ INT pl, STRUCTURE str, TEMPLATE tem)
True when player pl can build design tem with structure str.

BOOL	skVtolEnableCheck{ INT pl)
True when player pl is actively using vtols.

INT	skGetFactoryCapacity( STRUCTURE str)
Return the capacity of factory str.

VOID	skDifficultyModifier( INT pl)
Apply the frontend slider settings to player pl.

BOOL	skDefenseLocation (ref INT x , ref INT y , STRUCTURESTAT defenceStat, STRUCTURESTAT wallstat, DROID unit, INT player} },
Given a starting x and y, make unit ‘unit’ belonging to ‘player’ build either a ‘defenceStat’ or a row of ‘wallStat’s. returns 
Modified x and y’s.

VOID	skFireLassat {INT pl, BASEOBJECT obj)
Fire lassat of player pl’s at object obj.

SCRIPT FUNCTION CONSTANTS

These values are used to represent numbers that are constant throughout the game.

BUTTONID - these values are used when a particular reticule button needs to be identified
OPTIONS		- NOTE - this currently references the command button
CANCEL
BUILD
MANUFACTURE
RESEARCH
INTELMAP
DESIGN
COMMAND
 - When flashing an icon - with scrFlashOn()  scrFlashOff()
you can additional use

	IDRET_OPTIONS,
	IDRET_CANCEL,		
	IDRET_BUILD,		
	IDRET_MANUFACTURE,	
	IDRET_RESEARCH,		
	IDRET_INTEL_MAP,	
	IDRET_DESIGN,		
	IDRET_COMMAND,		
	IDDES_TEMPLSTART,	
	IDDES_SYSTEMBUTTON,	
	IDDES_BODYBUTTON,	
	IDDES_PROPBUTTON,	

MESSAGETYPE - these values are used when a type of message needs to be identified
RES_MSG
CAMP_MSG
MISS_MSG
PROX_MSG

NULLOBJECT - used to check that a BASEOBJECT has been assigned by a function
NULLTEMPLATE - used to check that a TEMPLATE has been assigned by a function
NULLSTAT - used to check that a BASESTAT has been assigned by a function

BARBARIAN1 - this can used to represent enemy1 (PC:player 6, PSX:player2)
BARBARIAN2 - this can used to represent enemy2 (PC:player 7, PSX:player3)

MISSIONTYPE - these values are used when a type of mission needs to be identified
CAMP_START - used for the starting point of a campaign
CAMP_EXPAND - used to expand a current campaign map
OFF_KEEP - used to load up an off world map, but keeping access to factories and 
	   research facilities back at home base
OFF_CLEAR - used to load up an off world map, but having no access to home base

LZ_COMPROMISED_TIME - value to set the reinforcement time with to display '--:--' when
		the Transporter is unable to land

Droid Orders
	DORDER_NONE			- no order assigned
	DORDER_STOP			- stop current order
	DORDER_RETREAT		- retreat
	DORDER_DESTRUCT		- self destruct
	DORDER_RTR			- return to repair
	DORDER_RTB			- return to base
	DORDER_RUN			- run away for a bit (moral failure)
	DORDER_MOVE			- move to location
	DORDER_ATTACK		- attack the object
	DORDER_HELPBUILD	- help construct the object
	DORDER_DEMOLISH		- demolish structure
	DORDER_REPAIR		- repair structure
	DORDER_OBSERVE		- (sensor units) keep a target in sensor range
	DORDER_EMBARK		- get onto a transporter
	DORDER_FIRESUPPORT	- follow this sensor unit and attack anything it DORDER_OBSERVE's
	DORDER_SCOUT		- same as move, but stop if enemy units are encountered.

Unit secondary orders
	DSO_ATTACK_RANGE
	DSO_REPAIR_LEVEL
	DSO_ATTACK_LEVEL
	DSO_RECYCLE,
	DSO_PATROL,					// patrol between current pos and next move target
	DSO_HALTTYPE,				// what to do when stopped
	DSO_RETURN_TO_LOC,			// return to various locations

Unit secondary states
	DSS_ARANGE_SHORT
	DSS_ARANGE_LONG
	DSS_ARANGE_DEFAULT

	DSS_REPLEV_LOW			//Medium Damage Taken
	DSS_REPLEV_HIGH			//Heavy Damage Taken
	DSS_REPLEV_NEVER		//Never Repair

	DSS_ALEV_ALWAYS
	DSS_ALEV_ATTACKED
	DSS_ALEV_NEVER

	DSS_PATROL_SET			(0 to clear)

	DSS_HALT_HOLD
	DSS_HALT_GUARD
	DSS_HALT_PERSUE

	DSS_RECYCLE_SET			(0 to clear)

	DSS_RTL_REPAIR			(0 to clear)
	DSS_RTL_BASE			(0 to clear)
	DSS_RTL_TRANSPORT		(0 to clear)

Button ID's
	IDRET_OPTIONS		// option button
	IDRET_BUILD			// build button
	IDRET_MANUFACTURE	// manufacture button
	IDRET_RESEARCH		// research button
	IDRET_INTEL_MAP		// intelligence map button
	IDRET_DESIGN		// design units button
	IDRET_CANCEL		// central cancel button

Unit types
	DROID_WEAPON,		// Weapon unit
	DROID_SENSOR,		// Sensor unit
	DROID_ECM,			// ECM unit
	DROID_CONSTRUCT,	// Constructor unit
	DROID_PERSON,		// person
	DROID_CYBORG,		// cyborg-type thang
	DROID_TRANSPORTER,	// guess what this is!
	DROID_COMMAND,		// Command unit
	DROID_REPAIR,		// Repair Unit

Structure types
	REF_HQ,
	REF_FACTORY,	
	REF_FACTORY_MODULE,//draw as factory 2	
	REF_POWER_GEN,
	REF_POWER_MODULE,
	REF_RESOURCE_EXTRACTOR,
	REF_DEFENSE,
	REF_WALL,
	REF_WALLCORNER,				//corner wall - no gun
	REF_RESEARCH,	
	REF_RESEARCH_MODULE,	
	REF_REPAIR_FACILITY,
	REF_COMMAND_CONTROL,		//control centre for command units
	REF_CYBORG_FACTORY,
	REF_VTOL_FACTORY,
	REF_REARM_PAD,
	REF_MISSILE_SILO,

Multiplayer Game Types
	SKIRMISH
	DMATCH
	CAMPAIGN
	TEAMPLAY

MultiPlayer Base Configurtations
	CAMP_CLEAN		// build units only
	CAMP_BASE		// small base
	CAMP_WALLS		// defensive base.

Cursor Mode (possible values of cursorType)
	IMAGE_CURSOR_SELECT,
	IMAGE_CURSOR_ATTACK,
	IMAGE_CURSOR_MOVE,
	IMAGE_CURSOR_JAM,
	IMAGE_CURSOR_PICKUP,
	IMAGE_CURSOR_DEFAULT,
	IMAGE_CURSOR_SEEKREPAIR,
	IMAGE_CURSOR_BUILD,
	IMAGE_CURSOR_GUARD,
	IMAGE_CURSOR_BRIDGE,
	IMAGE_CURSOR_ATTACH,
	IMAGE_CURSOR_LOCKON,
	IMAGE_CURSOR_FIX,
	IMAGE_CURSOR_EMBARK,

Game mode - possible values for intMode external variable
	INT_NORMAL,		// Standard mode (just the reticule)
	INT_OPTION,		// Option screen
	INT_EDITSTAT,	// Stat screen up for placing objects
	INT_EDIT,		// Edit mode
	INT_OBJECT,		// Object screen
	INT_STAT,		// Object screen with stat screen
	INT_CMDORDER,	// Object screen with command units and orders screen
	INT_DESIGN,		// Design screen
	INT_INTELMAP,	// Intelligence Map
	INT_ORDER,
	INT_INGAMEOP,	// in game options.
	INT_TRANSPORTER, //Loading/unloading a Transporter
	INT_MISSIONRES,	// Results of a mission display.
	INT_MULTIMENU,	// multiplayer only, player stats etc...

Possible options for getGameStatus()
	STATUS_ReticuleIsOpen			// returns true is the reticule is open
	STATUS_BattleMapViewEnabled		// returns true if we are in battlemap mode

Possible values for targetedObjectType
MT_TERRAIN,
MT_RESOURCE,
MT_BLOCKING,
MT_RIVER,
MT_TRENCH,
MT_OWNSTRDAM,
MT_OWNSTROK,
MT_OWNSTRINCOMP,
MT_REPAIR,
MT_REPAIRDAM,
MT_ENEMYSTR,
MT_TRANDROID,
MT_OWNDROID,
MT_OWNDROIDDAM,
MT_ENEMYDROID,
MT_COMMAND,
MT_ARTIFACT,
MT_DAMFEATURE,
MT_SENSOR,
MT_WRECKFEATURE,

Structure Target preference types
ST_HQ					= 1,
ST_FACTORY				= 2,
ST_POWER_GEN			= 4,
ST_RESOURCE_EXTRACTOR	= 8,
ST_WALL					= 16,
ST_RESEARCH				= 32,
ST_REPAIR_FACILITY		= 64,
ST_COMMAND_CONTROL		= 128,
ST_CYBORG_FACTORY		= 256,
ST_VTOL_FACTORY			= 512,
ST_REARM_PAD			= 1024,
ST_SENSOR				= 2048,
ST_DEF_GROUND			= 4096,
ST_DEF_AIR				= 8192,
ST_DEF_IDF				= 16384,
ST_DEF_ALL				= 28672,	- ground/air/idf structures

Unit target preference types
// turret types
DT_COMMAND				= 1,
DT_SENSOR				= 2,
DT_CONSTRUCT			= 4,
DT_REPAIR				= 8,
DT_WEAP_GROUND			= 16,
DT_WEAP_AIR				= 32,
DT_WEAP_IDF				= 64,
DT_WEAP_ALL				= 112,		- ground/air/idf units

// body types
DT_LIGHT				= 128,
DT_MEDIUM				= 256,
DT_HEAVY				= 512,
DT_SUPER_HEAVY			= 1024,		- transporter only

// propulsion
DT_TRACK				= 2048,
DT_HTRACK				= 4096,
DT_WHEEL				= 8192,
DT_LEGS					= 16384,
DT_GROUND				= 30720,
DT_VTOL					= 32768,
DT_HOVER				= 65536,	- any ground propulsion

SCRIPT FUNCTION EXTERNALS

These represent variables that are defined in the game which can be accessed in the scripts. It will only be possible to set the value that is held for some of the variables. 

mapWidth - (get) - field to hold the width of the map

mapHeight - (get) - field to hold the height of the map

gameInitialised - (get) flag to specify when all initialisation has been performed for the game - use it in place of a bool ie can be considered to equal true or false

selectedPlayer - (get) field to hold the currently selected player

gameTime - (get) the current time in the game (in 1/10 sec)

multiPlayerGameType 	- (get) the type of multiplayer game underway.
multiPlayerMaxPlayers 	- max number of human players in this game.(see constants for return values)
multiPlayerBaseType 	- campaign game base type. (see constants for return values)

scrollX	- (get/set) field to hold the starting x coordinate where the player can scroll
scrollY  - (get/set) field to hold the starting y coordinate where the player can scroll
scrollWidth - (get/set) field to hold the width the player can scroll
scrollHeight - (get/set) field to hold the height the player can scroll

cursorType   - (get)  - Gets the current mode that the cursor is in (e.g. IMAGE_CURSOR_BUILD ... see scriptConstant.txt)
intMode	- (get)		- Get the current game mode (e.g. INT_DESIGN when the design screen is active) ... see scriptConstant.txt)

targetedObjectType - (get) - The type of the object currently under the cursor (one of MT_... see scriptconstants.txt)

BOOL extraVictoryFlag	- use to mark additional victory conditions have been met - reset to FALSE at start of each level
BOOL extraFailFlag		- use to mark additional failure conditions have been met - reset to FALSE at start of each level

GameLevel (get/set) – set single player difficulty.

SCRIPT FUNCTION CALLBACKS

These are used in the place of a trigger and are for events that are to be called at specific times in the game. They will cause the event they are associated with to be called every time unless the trigger for the event is set to inactive.

CALL_GAMEINIT - this is triggered when the game has initialised
CALL_DROIDDESIGNED - this is triggered when the player saves a template design
CALL_RESEARCHCOMPLETED - this is triggered when a research topic is complete - major or minor
CALL_DROIDBUILT - this is triggered when a unit has been built via a factory
CALL_POWERGEN_BUILT - this is triggered when a Power generatot has been built
CALL_RESEX_BUILT - this is triggered when a Resource Extractor has been built
CALL_RESEARCH_BUILT - this is triggered when a Research Facility has been built
CALL_FACTORY_BUILT - this is triggered when a Factory has been built
CALL_MISSION_START - this is triggered when CTRL + 'M' is pressed so that the script can start a mission
CALL_MISSION_END - this is triggered when CTRL + 'B' is pressed so that the script can end a mission
CALL_VIDEO_QUIT - this is triggered when the CURRENT video sequence is over - either end of anim or when 'ESC' has been pressed
CALL_LAUNCH_TRANSPORTER - this is triggered when the 'Launch' button is pressed on the Transporter interface
CALL_START_NEXT_LEVEL - this is triggered when a new level is desired
CALL_TRANSPORTER_REINFORCE - this is triggered when a transporter carrying reinforcements for player 0 enters the map
CALL_MISSION_TIME - this is triggered when the time specified by setMissionTime() has elapsed
CALL_ELECTRONIC_TAKEOVER - triggered when a unit or a structure for the selectedPlayer are taken over using Electronic weapons

Callbacks with parameters:

CALL_NEWDROID player, ref DROID,ref STRUCTURE
triggered when a unit for player is built by a factory.  DROID is the unit that was built
structure is the factory that built it, dont assume that the factory is still there!!

CALL_STRUCT_ATTACKED player, ref STRUCTURE, ref BASEOBJ
triggered when a structure for player is attacked.  STRUCTURE is the attacked structure,
BASEOBJ is the unit that attacked the structure (could be NULLOBJECT)

CALL_DROID_ATTACKED player, ref DROID, ref BASEOBJ
triggered when a unit for player is attacked.  DROID is the attacked unit,
BASEOBJ is the unit that attacked (could be NULLOBJECT)

CALL_ATTACKED player, ref BASEOBJ, ref BASEOBJ
triggered when a structure or unit for player is attacked.  BASEOBJ is the attacked unit,
BASEOBJ is the unit that attacked (could be NULLOBJECT)

CALL_TRANSPORTER_OFFMAP player
triggered when a transporter for player exits the map.

CALL_TRANSPORTER_LANDED GROUP, player
triggered when transporter for player lands; units on transporter are unloaded
into the given GROUP.

Tutorial Callbacks

CALL_BUILDLIST			- Build structures interface up
CALL_BUILDGRID			- Place structure cursor up
CALL_RESEARCHLIST		- Choose research interface up
CALL_MANURUN			- Number of units to manufacture has changed
CALL_MANULIST			- Choose manufacturing interface up

CALL_BUTTON_PRESSED buttonID
triggered when an interface button with id buttonID is pressed

CALL_DESIGN_QUIT
triggered when the design screen is closed

CALL_OBJ_DESTROYED, INT player, ref BASEOBJ object
triggered when either a unit or a structure for player is destroyed

CALL_DROID_DESTROYED, INT player, ref DROID droid
triggered when a unit for player is destroyed

CALL_STRUCT_DESTROYED, INT player, ref STRUCTURE structure
triggered when a structure for player is destroyed

CALL_FEATURE_DESTROYED, ref FEATURE feature
triggered when either a unit or a structure for player is destroyed

CALL_OBJ_SEEN, INT player, ref BASEOBJ object, ref BASEOBJ viewer
triggered when either a unit or a structure is seen by a unit belonging to player.
object is the thing that was seen, viewer is the thing that saw it (may be NULLOBJECT).

CALL_DROID_SEEN, INT player, ref BASEOBJ object, ref BASEOBJ viewer
triggered when a unit is seen by a unit belonging to player.
object is the thing that was seen, viewer is the thing that saw it (may be NULLOBJECT).

CALL_STRUCT_SEEN, INT player, ref BASEOBJ object, ref BASEOBJ viewer
triggered when a structure is seen by a unit belonging to player.
object is the thing that was seen, viewer is the thing that saw it (may be NULLOBJECT).

CALL_NO_REINFORCEMENTS_LEFT - called when the player has transferred all reinforcements from one level to the next

More tutorial callbacks - ALL tutorial only

CALL_DESIGN_WEAPON		- a weapon button pressed
CALL_DESIGN_SYSTEM		- a system (constructor/ecm/sensor/etc) button pressed
CALL_DESIGN_COMMAND		- a command droid turret pressed
CALL_DESIGN_BODY		- a body selected
CALL_DESIGN_PROPULSION	- a propulsion selected

CALL_ALL_ONSCREEN_DROIDS_SELECTED - does exactly when it says on the box

CALL_UNITTAKEOVER, ref unit;
	Unit has been taken over by nexus link…

CALL_PLAYERLEFT,	ref int player;
	Player has left the multiplayer game.

CALL_ALLIANCEOFFER, ref int one, ref int two
	One offers two an alliance.