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.

init - seems to be a special one, must work similiar to CALL_GAMEINIT
CALL_GAMEINIT - this is triggered when the game has initialised
CALL_DROIDDESIGNED - this is triggered when the player saves a template design
CALL_RESEARCHCOMPLETED(REF RESEARCH) - this is triggered when a research topic is complete - major or minor, ref Research might only work if inTutorial is set to TRUE.
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
CALL_UNITTAKEOVER, ref Droid

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.
Units don’t seem to be added to the GROUP when transporter has landed.
?: When player is public then the trigger is only triggered for this player and when player is private then player is passed as a reference (not sure)

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.

BOOL isVtol(DROID) //Checks if droid is a VTOL
pause(INT time) //Waits before executing the next statement (in 1/10 of a second). NOTE: pause() cannot be used inside of while() scope, otherwise event is deactivated.

setPlayCountDown(BOOL) //Turns coded countdown on or off
refTest()
DROID getDroid(COMPONENT,PLAYER) //Returns a first droid on that battlefield, that has this component
eventTraceLevel(INT) //?
debugBox(0); //?
numMessageBox(23) //?
setEventTrigger(EVENT, TRIGGER)
playVideo(RPL_FILE video, STRING ?)
tutorialTemplates(); - Gives Tutorual templates, but doesn’t seem to work in skirmish
setCampaignNumber(INI Campaign_Number)
setDroidsToSafetyFlag(true) //set up so that when Transporter gets to the edge of the map, it will empty and return
setDroidsToSafetyFlag(false) //reset the flag so that the Transporters leave the map when they have been emptied
attackLocation(INT, INT, INT) //???
DROID addDroidToMissionList(TEMPLATE, PLAYER) //Virtually adds a droid to the droid list (not visible, can be loaded into transporter)
addDroidToTransporter(DROID Transporter, DROID Droid_to_load) //Adds droid to the transporter
setVTOLReturnPos(player, x, y)
clearConsole() //Clears console, doesn’t unlock it, after addConsoleText() or tagConsoleText() was used
gameOverMessage(INTMESSAGE, MESSAGETYPE (like MISS_MSG), INT player, BOOL PLAY_IMMEDIATE) //Similar to addMessage()
playCDAudio(INT track_number)
stopCDAudio()
pauseCDAudio()
resumeCDAudio()
playBackgroundAudio(?)
- doesn't seem to work

********************************************************************************pre-defined in-game Variables:

inTutorial = BOOL; //Set the flag to say we're in the tutorial - C Variable
trackTransporter //?

********************************************************************************

CALLBACKS:



CALL_DROID_SELECTED, ref DROID //Returns the selected droid, ONLY WORKS IF inTutorial IS SET TO TRUE (do it at CALL_GAMEINIT)
CALL_DROIDBUILT() //Called when any droid is built
CALL_OBJECTOPEN() //Is called when a menu is opened (build, design menu etc) WORKS ONLY IF inTutorial IS SET TO TRUE;
CALL_OBJECTCLOSE() //?
CALL_VTOL_OFF_MAP, Player, ref droid
CALL_DELIVPOINTMOVED() //Might work only if inTutorial is set to true
CALL_CLUSTER_EMPTY, ref INT clusterID







This file is full of unresolved questions.. would be great if someone would do an iteration on it and clean it up.
- Karmazilla.