Difference between revisions of "Oolite JavaScript Reference: World script event handlers"
Eric Walch (talk | contribs) (→<code>alertConditionChanged</code>) |
|||
Line 1: | Line 1: | ||
− | This page provides an exhaustive list of event handlers which can be implemented |
+ | This page provides an exhaustive list of event handlers which can be implemented inside world scripts [[Scripting Oolite with JavaScript|JavaScript scripts for Oolite]]. |
− | Most event handlers can be used both in world scripts |
+ | Most event handlers can be used both in world scripts and in ship scripts. Generally speaking, handlers starting with "ship" can be used for both scripts and those starting with "player" are meant only for the player (= can only be used in a world script). Exceptions on this rule are mentioned with the individual handlers below. |
− | World scripts are linked to Oolite over the worldScript.plist and stay always active, while ship scripts are linked to Oolite over the shipData.plist and are only active when the ship is present. When more ships use the same ship script, every ship uses its own individual copy of the sript. |
||
+ | World scripts can be either found inside Config\script.js, or be distinctly named .js files inside the Scripts directory - in the latter case, the worldScript.plist will list the active world scripts. |
||
+ | |||
+ | World scripts are always active. |
||
=== Game State === |
=== Game State === |
||
Line 17: | Line 19: | ||
− | ==== <code>reset</code> ==== |
+ | ==== <code>reset (removed in 1.74)</code> ==== |
The <code>reset</code> handler is called whenever the player is respawned, such as after dying or when loading a saved game. It should be used to reset any local state in the script. (world script only) |
The <code>reset</code> handler is called whenever the player is respawned, such as after dying or when loading a saved game. It should be used to reset any local state in the script. (world script only) |
||
Line 25: | Line 27: | ||
// Your code here |
// Your code here |
||
} |
} |
||
+ | |||
+ | in 1.74 the startUp event is called in its place, eliminating the need for two separate events. |
||
+ | |||
=== Docking === |
=== Docking === |
||
Line 246: | Line 251: | ||
} |
} |
||
− | ==== <code>escortAttack</code> ==== |
||
− | |||
− | The <code>escortAttack</code> handler is send to all escorts of a mothership that are deployed. The mother first changes the escorts AI to interceptAI.plist and also sets the escort target to his own target before sending this handler to the escorts. (ship scripts only) |
||
− | |||
− | this.escortAttack = function(target) |
||
− | { |
||
− | // Your code here |
||
− | } |
||
==== <code>playerTargetedMissile</code> ==== |
==== <code>playerTargetedMissile</code> ==== |
||
Line 277: | Line 274: | ||
The <code>shipBeingAttacked</code> handler is called when a laser shot hits. <code>whom</code> the identity of the ship that attacked. |
The <code>shipBeingAttacked</code> handler is called when a laser shot hits. <code>whom</code> the identity of the ship that attacked. |
||
− | this.shipBeingAttacked = function( |
+ | this.shipBeingAttacked = function(whom) |
{ |
{ |
||
// Your code here |
// Your code here |
||
Line 311: | Line 308: | ||
("cascade weapon" is new in 1.74 and "removed" / "energy damage" were accidentally switched in 1.73) |
("cascade weapon" is new in 1.74 and "removed" / "energy damage" were accidentally switched in 1.73) |
||
− | ==== <code>shipEnergyBecameFull </code> ==== |
||
− | |||
− | The <code>shipEnergyBecameFull </code> handler is called when the energy level reaches it's maximum value again. (Is only send to NPC ships, not to the player) Seems not yet to be working with oolite 1.71 |
||
− | |||
− | this.shipEnergyBecameFull = function() |
||
− | { |
||
− | // Your code here |
||
− | } |
||
− | |||
− | ==== <code>shipEnergyIsLow</code> ==== |
||
− | |||
− | The <code>shipEnergyIsLow</code> handler is called every time when a ship gets energy damage while the energy level lies below 25% of it's maximum value. (Is only send to NPC ships, not to the player) |
||
− | |||
− | this.shipEnergyIsLow = function() |
||
− | { |
||
− | // Your code here |
||
− | } |
||
==== <code>shipFiredMissile</code> ==== |
==== <code>shipFiredMissile</code> ==== |
||
− | |||
+ | {{Oolite-prop-added|1.74}}<br> |
||
− | The <code>shipFiredMissile</code> handler is called when a missile is fired. <code>missile</code> contains the missile entity and <code>target</code> the identity of the target. The handler is send to the ship that launched the missile. |
+ | The <code>shipFiredMissile</code> handler is called when a missile is fired. <code>missile</code> contains the missile entity and <code>target</code> the identity of the target. The handler is send to the ship that launched the missile. |
this.shipFiredMissile = function(missile, target) |
this.shipFiredMissile = function(missile, target) |
||
Line 394: | Line 374: | ||
} |
} |
||
− | === NPC only === |
||
− | ==== <code>escortAccepted</code> ==== |
||
+ | === Other === |
||
− | The <code>escortAccepted</code> handler is called for mother ships that have accepted an escort. The escort simultaneously gets a <code>shipAcceptedEscort</code> event. (ship scripts only) |
||
+ | ==== <code>compassTargetChanged</code> ==== |
||
+ | {{Oolite-prop-added|1.74}}<br> |
||
+ | The <code>compassTargetChanged</code> handler is called when a new target is selected. Mode can be any of the following: |
||
− | this.escortAccepted = function(escortship) |
||
+ | COMPASS_MODE_BASIC |
||
− | { |
||
+ | COMPASS_MODE_PLANET |
||
− | // Your code here |
||
+ | COMPASS_MODE_STATION |
||
− | } |
||
+ | COMPASS_MODE_SUN |
||
+ | COMPASS_MODE_TARGET |
||
+ | COMPASS_MODE_BEACONS |
||
− | ==== <code>escortDock</code> ==== |
||
+ | script example |
||
− | The <code>escortDock</code> handler is called by a mother ships that uses the AI command: <code>dockEscorts</code>. Escorts are instructed to change AI into dockingAI.plist and enter the ABORT state of this AI after a certain delay. Than this event is send to all his escorts, each with a different delay with 3 seconds spacing. (ship scripts only) |
||
+ | this.compassTargetChanged = function(whom, mode) |
||
− | |||
− | this.escortDock = function(delay) |
||
{ |
{ |
||
+ | log(' Now targeting ' + whom); |
||
// Your code here |
// Your code here |
||
} |
} |
||
− | |||
− | ==== <code>offenceCommittedNearby</code> ==== |
||
− | |||
− | The <code>offenceCommittedNearby</code> handler is only send to police ships in scanner range of a hostile action. It transfers the attacker and the victim to the police vessel. (ship scripts only) |
||
− | |||
− | this.offenceCommittedNearby = function(attacker, victim) |
||
− | { |
||
− | // Your code here |
||
− | } |
||
− | |||
− | ==== <code>playerWillEnterWitchspace</code> ==== |
||
− | |||
− | The <code>playerWillEnterWitchspace</code> handler is called just before a witchspace jump starts and after the <code>shipWillEnterWitchspace</code> handler fires. It is send to all ships in the system to signal that the player is about to leave the system. (By jump or by wormhole) (*** This handler is intended for use in shipscripts only. ***) |
||
− | |||
− | this.playerWillEnterWitchspace = function() |
||
− | { |
||
− | // Your code here |
||
− | } |
||
− | |||
− | ==== <code>shipAcceptedEscort</code> ==== |
||
− | |||
− | The <code>shipAcceptedEscort</code> handler is called for ships that are accepted as escort. The mother simultaneously gets a <code>escortAccepted</code> event. (ship scripts only) |
||
− | |||
− | this.shipAcceptedEscort = function(mother) |
||
− | { |
||
− | // Your code here |
||
− | } |
||
− | |||
− | ==== <code>shipExitedWormhole</code> ==== |
||
− | |||
− | The <code>shipExitedWormhole</code> handler is called when a ship exits a wormhole. (ship scripts only) |
||
− | |||
− | this.shipExitedWormhole = function() |
||
− | { |
||
− | // Your code here |
||
− | } |
||
− | |||
− | ==== <code>shipSpawned</code> ==== |
||
− | |||
− | The <code>shipSpawned</code> handler is called for newly added ships. It does not trigger on adding but on the first update after adding. On a witchspace jump it means that first all ships are added and than the shipSpawned() handlers are activated. (ship scripts only) |
||
− | |||
− | this.shipSpawned = function() |
||
− | { |
||
− | // Your code here |
||
− | } |
||
− | |||
− | ==== <code>shipWillEnterWormhole</code> ==== |
||
− | |||
− | The <code>shipWillEnterWormhole</code> handler is called when a ship enters a wormhole. (ship scripts only) |
||
− | |||
− | this.shipWillEnterWormhole = function() |
||
− | { |
||
− | // Your code here |
||
− | } |
||
− | |||
− | ==== <code>spawnedAsEscort</code> ==== |
||
− | |||
− | The <code>spawnedAsEscort</code> handler is called for newly added escort ships. It does trigger on adding the ship and before the shipSpawned() handlers is activated. It has the mothership as argument. (ship scripts only) |
||
− | |||
− | this.spawnedAsEscort = function(mother) |
||
− | { |
||
− | // Your code here |
||
− | } |
||
− | |||
− | === Station only === |
||
− | |||
− | ==== <code>otherShipDocked</code> ==== |
||
− | |||
− | The <code>otherShipDocked</code> handler is called with a station script only, when an ship docks. It has the docking ship as argument. (ship scripts only) |
||
− | |||
− | this.otherShipDocked = function(whom) |
||
− | { |
||
− | // Your code here |
||
− | } |
||
− | |||
− | ==== <code>stationLaunchedShip</code> ==== |
||
− | |||
− | The <code>stationLaunchedShip</code> handler is called with a station script only, when a ship launches. It has the docking ship as argument. (ship scripts only) |
||
− | |||
− | this.stationLaunchedShip = function(whom) |
||
− | { |
||
− | // Your code here |
||
− | } |
||
− | |||
− | === Other === |
||
==== <code>guiScreenChanged</code> ==== |
==== <code>guiScreenChanged</code> ==== |
||
Line 526: | Line 423: | ||
} |
} |
||
− | ==== <code> |
+ | ==== <code>missionScreenOpportunity</code> ==== |
+ | {{Oolite-prop-added|1.74}}<br> |
||
+ | The <code>missionScreenOpportunity</code> handler is called if there are no mission / report screens active, and the player is docked to a station. It gets fired at game startup, upon docking, and after a docking report or previous mission screen has ended. (world script only) |
||
+ | |||
+ | this.missionScreenOpportunity= function() |
||
+ | { |
||
+ | // Your code here |
||
+ | } |
||
− | The <code>reportScreenEnded</code> handler is called when the last arrival-report screen ends. This is a screen that should not be written by a missionscreen. The code should wait until this eventhandler fires. Note that an other script may have put up a new missionscreen in the meantime. (Feature added with Oolite 1.73) (world script only) |
||
+ | ==== <code>reportScreenEnded</code> ==== |
||
+ | {{Oolite-prop-added|1.73}} |
||
+ | The <code>reportScreenEnded</code> handler is called when the last arrival-report screen ends. This is a screen that should not be written by a missionscreen. The code should wait until this eventhandler fires. Note that an other script may have put up a new missionscreen in the meantime. (world script only) |
||
this.reportScreenEnded = function() |
this.reportScreenEnded = function() |
||
Line 562: | Line 461: | ||
} |
} |
||
− | ==== <code>shipWasScooped</code> ==== |
||
− | |||
− | The <code>shipWasScooped</code> handler is send to the cargopod when a ship scoops scripted_cargo. ("cargo_type" = CARGO_SCRIPTED_ITEM) The scooper is transferred as argument. The scooper itself gets a trigger on the handler <code>shipScoopedOther</code>. (ship script only) |
||
− | |||
− | this.shipWasScooped = function(scooper) |
||
− | { |
||
− | // Your code here |
||
− | } |
||
==== <code>tickle</code> ==== |
==== <code>tickle</code> ==== |
||
Line 586: | Line 477: | ||
Handlers do not yet exist for the following events: |
Handlers do not yet exist for the following events: |
||
* Target changed. |
* Target changed. |
||
− | * Advanced space compass mode changed. |
||
* Cloaking device events. |
* Cloaking device events. |
||
If there are other events you would like to be able to respond to, please write a request [http://www.aegidian.org/bb/viewtopic.php?t=3296 on the forum]. |
If there are other events you would like to be able to respond to, please write a request [http://www.aegidian.org/bb/viewtopic.php?t=3296 on the forum]. |
||
+ | |||
+ | '''See also:''' [[Oolite JavaScript Reference: ship_script_event_handlers|ship_script_event_handlers]] |
||
Revision as of 18:11, 11 December 2009
This page provides an exhaustive list of event handlers which can be implemented inside world scripts JavaScript scripts for Oolite.
Most event handlers can be used both in world scripts and in ship scripts. Generally speaking, handlers starting with "ship" can be used for both scripts and those starting with "player" are meant only for the player (= can only be used in a world script). Exceptions on this rule are mentioned with the individual handlers below.
World scripts can be either found inside Config\script.js, or be distinctly named .js files inside the Scripts directory - in the latter case, the worldScript.plist will list the active world scripts.
World scripts are always active.
Contents
Game State
startUp
The startUp
handler is called after all OXPs have been loaded. It can be used to do one-off initialisation such as registering to listen for certain keystrokes etc. (world script only)
this.startUp = function() { // Your code here }
reset (removed in 1.74)
The reset
handler is called whenever the player is respawned, such as after dying or when loading a saved game. It should be used to reset any local state in the script. (world script only)
this.reset = function() { // Your code here }
in 1.74 the startUp event is called in its place, eliminating the need for two separate events.
Docking
shipWillDockWithStation
The shipWillDockWithStation
handler is called at the beginning of the docking tunnel effect.
this.shipWillDockWithStation = function(station) { // Your code here }
At this moment "ship.dockedStation == nil", "ship.status == STATUS_DOCKING"
shipDockedWithStation
The shipDockedWithStation
handler is called at the end of the docking tunnel effect.
this.shipDockedWithStation = function(station) { // Your code here }
At this moment "ship.dockedStation == the station", "ship.status == STATUS_DOCKED" and "gui_screen" is either GUI_SCREEN_STATUS or GUI_SCREEN_REPORT. However, any identical handler from an other oxp could have changed those values. Never count on it but double check when important.
shipWillLaunchFromStation
The shipWillLaunchFromStation
handler is called at the beginning of the launch tunnel effect. (world script only)
this.shipWillLaunchFromStation = function(station) { // Your code here }
shipLaunchedFromStation
The shipLaunchedFromStation
handler is called at the end of the launch tunnel effect. (The station parameter is added at release 1.73)
this.shipLaunchedFromStation = function(station) { // Your code here }
playerStartedAutoPilot
The playerStartedAutoPilot
handler is called when the player starts autopilot docking. It is not called for the instantaneous dock command.
this.playerStartedAutoPilot = function() { // Your code here }
playerCancelledAutoPilot
The playerCancelledAutoPilot
handler is called when the player cancels autopilot docking.
this.playerCancelledAutoPilot = function() { // Your code here }
playerDockingRefused
The playerDockingRefused
handler is called when a station refuses to provide autopilot docking instructions.
this.playerDockingRefused = function() { // Your code here }
playerRequestedDockingClearance
The playerRequestedDockingClearance
handler is called when a station answers on a docking request of the player by targeting the station and pressing L (shift-l).
this.playerRequestedDockingClearance = function(message) { // Your code here }
Message is a string and can take the values: "DOCKING_CLEARANCE_GRANTED", "DOCKING_CLEARANCE_DENIED_TRAFFIC_OUTBOUND", "DOCKING_CLEARANCE_DENIED_TRAFFIC_INBOUND", "DOCKING_CLEARANCE_DENIED_SHIP_FUGITIVE", "DOCKING_CLEARANCE_NOT_REQUIRED", "DOCKING_CLEARANCE_EXTENDED" or "DOCKING_CLEARANCE_CANCELLED". (Feature is added with Oolite 1.72)
Witchspace Jumps
playerStartedJumpCountdown
The playerStartedJumpCountdown
handler is called when the user starts a witchspace or galactic witchspace jump countdown. The type
parameter is a string specifying which type of jump is occuring; currently, the possible values are “standard” and “galactic”. Other values may be added in future.
this.playerStartedJumpCountdown = function(type) { // Your code here }
playerCancelledJumpCountdown
The playerCancelledJumpCountdown
handler is called when the user cancels a witchspace or galactic witchspace jump countdown.
this.playerCancelledJumpCountdown = function() { // Your code here }
playerJumpFailed
The playerJumpFailed
handler is called at the end of a witchspace or galactic witchspace countdown, if the jump is not possible. The reason
parameter is a string specifying why the jump failed; currently, the possible values are “blocked”, “too far” and “insufficient fuel”. Other values may be added in future.
this.playerJumpFailed = function(reason) { // Your code here }
shipWillEnterWitchspace
The shipWillEnterWitchspace
handler is called immediately before a witchspace jump, while the player is still in the starting system. The cause
parameter is a string specifying what sort of jump is occuring; currently, the possible values are “standard jump”, “galactic jump” and “wormhole”. Other values may be added in future.
this.shipWillEnterWitchspace = function(cause) { // Your code here }
shipWillExitWitchspace
The shipWillExitWitchspace
handler is called as a witchspace jump concludes. When it is called, the player is (from a program perspective) in the destination system, but the tunnel effect has not yet been shown. This is the reccomended time to set up elements which, so to speak, were already there when the player arrived.
this.shipWillExitWitchspace = function() { // Your code here }
shipExitedWitchspace
The shipExitedWitchspace
handler is called after a witchspace jump has concluded and the tunnel effect has been shown.
this.shipExitedWitchspace = function() { // Your code here }
playerEnteredNewGalaxy
The playerEnteredNewGalaxy
handler is called just before a witchspace jump starts.
this.playerEnteredNewGalaxy = function(galaxyNumber) { // Your code here }
Enter/Exit Aegis
shipEnteredStationAegis
The shipEnteredStationAegis
handler is called when the player enters the aegis of the main-station (2x scanner range from main-station). Other stations than the main-station don't give aegis messages.
this.shipEnteredStationAegis = function(station) { // Your code here }
shipExitedStationAegis
The shipExitedStationAegis
handler is called when the player leaves the aegis of the main-station (2x scanner range from main-station).
this.shipExitedStationAegis = function(station) { // Your code here }
shipEnteredPlanetaryVicinity
The shipEnteredPlanetaryVicinity
handler is called when the player enters the planet aegis (3x planet radius).
this.shipEnteredPlanetaryVicinity = function(planet) { // Your code here }
shipExitedPlanetaryVicinity
The shipExitedPlanetaryVicinity
handler is called when the player leaves the planet aegis (3x planet radius).
this.shipExitedPlanetaryVicinity = function(planet) { // Your code here }
shipApproachingPlanetSurface
The shipApproachingPlanetSurface
handler is called when the player is very close to the planet (crosses a border ± 500 meter above the surface).
this.shipApproachingPlanetSurface = function(planet) { // Your code here }
shipLeavingPlanetSurface
The shipLeavingPlanetSurface
handler is called when the player leaves the planet (crosses a border ± 500 meter above the surface).
this.shipLeavingPlanetSurface = function(planet) { // Your code here }
Combat
alertConditionChanged
The alertConditionChanged
handler is called when the player’s alert status (player.alertCondition
) changes. Only the player and stations have an alert condition. (world script and station scripts)
this.alertConditionChanged = function(newCondition, oldCondition) { // Your code here }
playerTargetedMissile
The playerTargetedMissile
handler is called when the player targets the nearest missile by pressing T (shift-t) on the keybord.
this.playerTargetedMissile = function(missile) { // Your code here }
shipAttackedWithMissile
The shipAttackedWithMissile
handler is called when a missile is fired. missile
contains the missile entity and whom
the identity of the ship that launched the missile.
this.shipAttackedWithMissile = function(missile, whom) { // Your code here }
shipBeingAttacked
The shipBeingAttacked
handler is called when a laser shot hits. whom
the identity of the ship that attacked.
this.shipBeingAttacked = function(whom) { // Your code here }
shipBeingAttackedByCloaked
The shipBeingAttackedByCloaked
handler is called when a laser shot from a cloaked ship hits. Guess what, there is no parameter because he is cloaked!
this.shipBeingAttackedByCloaked = function() { // Your code here }
shipDestroyedTarget
The shipDestroyedTarget
handler is called when the target gets destroyed. target
contains the destroyed target entity. This command is always preceded by the shipLostTarget
handler.
this.shipDestroyedTarget = function(target) { // Your code here }
shipDied
The shipDied
handler is called when the ship or player dies. Expect a reset()
shortly when it is the player ship.
this.shipDied = function(whom, why) { // Your code here }
whom contains the entity that caused the kill. why is the cause written as string and is one of: "removed", "hit a planet", "energy damage", "scrape damage", "heat damage", "cascade weapon".
("cascade weapon" is new in 1.74 and "removed" / "energy damage" were accidentally switched in 1.73)
shipFiredMissile
This property was added in Oolite test release 1.74.
The shipFiredMissile
handler is called when a missile is fired. missile
contains the missile entity and target
the identity of the target. The handler is send to the ship that launched the missile.
this.shipFiredMissile = function(missile, target) { // Your code here }
shipLostTarget
The shipLostTarget
handler is called when the target gets lost. target
contains the lost target entity.
(As with Oolite 1.71 this is not yet working properly. It returns not the right target but just "unknown". It does nothing when target lost because of "out of range")
this.shipLostTarget = function(target) { // Your code here }
shipTargetCloaked
The shipTargetCloaked
handler is called when the target cloakes.
this.shipTargetCloaked = function() { // Your code here }
Equipment
equipmentDestroyed
The equipmentDestroyed
handler is called when equipment gets destroyed completely beyond repair. (in strict mode) (world script only)
this.equipmentDestroyed = function(equipment) { // Your code here }
equipmentDamaged
The equipmentDamaged
handler is called when equipment get damaged. (world script only)
this.equipmentDamaged = function(equipment) { // Your code here }
playerBoughtEquipment
The playerBoughtEquipment
handler is called when equipment is bought at the outfit screen.
this.playerBoughtEquipment = function(equipment) { // Your code here }
playerBoughtNewShip
The playerBoughtNewShip
handler is called when a new ship is bought. May be needed to re-evaluate the old equipment as buying a new ship does not trigger equipment removal.
this.playerBoughtNewShip = function(ship) { // Your code here }
Other
compassTargetChanged
This property was added in Oolite test release 1.74.
The compassTargetChanged
handler is called when a new target is selected. Mode can be any of the following:
COMPASS_MODE_BASIC COMPASS_MODE_PLANET COMPASS_MODE_STATION COMPASS_MODE_SUN COMPASS_MODE_TARGET COMPASS_MODE_BEACONS
script example
this.compassTargetChanged = function(whom, mode) { log(' Now targeting ' + whom); // Your code here }
guiScreenChanged
The guiScreenChanged
handler is called when the guiScreen changes. 1.71 only transfers the "to" screen. 1.72 will also transfer the "from" screen. Note that the screen can have changed again in the meantime. (world script only)
this.guiScreenChanged = function(to, from) { // Your code here }
missionChoiceWasReset
The missionChoiceWasReset
handler is called when the mission choice is set to null via script (either using the legacy script method resetMissionChice, or using mission.choice = null; in javascript)
this.missionChoiceWasReset= function() { // Your code here }
missionScreenEnded
The missionScreenEnded
handler is called when the missionscreen ends. Note that an other script may have put up a new missionscreen in the meantime. (world script only)
this.missionScreenEnded = function() { // Your code here }
missionScreenOpportunity
This property was added in Oolite test release 1.74.
The missionScreenOpportunity
handler is called if there are no mission / report screens active, and the player is docked to a station. It gets fired at game startup, upon docking, and after a docking report or previous mission screen has ended. (world script only)
this.missionScreenOpportunity= function() { // Your code here }
reportScreenEnded
This property was added in Oolite test release 1.73.
The reportScreenEnded
handler is called when the last arrival-report screen ends. This is a screen that should not be written by a missionscreen. The code should wait until this eventhandler fires. Note that an other script may have put up a new missionscreen in the meantime. (world script only)
this.reportScreenEnded = function() { // Your code here }
shipCollided
The shipCollided
handler is send after a collision with otherShip.
this.shipCollided = function(otherShip) { // Your code here }
shipScoopedOther
The shipScoopedOther
handler is called when a ship scoops scripted_cargo. ("cargo_type" = CARGO_SCRIPTED_ITEM) Other cargo, even scooping escapepods, doesn't trigger a handler.
The scooped item is transferred as argument. The scooped cargo itselfs gets the handler: shipWasScooped
with the scooper as argument.
this.shipScoopedOther = function(whom) { // Your code here }
shipLaunchedEscapePod
The shipLaunchedEscapePod
handler is called when the player bails out. This will be followed by a shipWillDockWithStation()
/shipDockedWithStation()
pair after a few seconds.
this.shipLaunchedEscapePod = function(escapepod) { // Your code here }
tickle
The tickle
handler is called periodically-ish, whenever the old plist scripts are updated. For performance reasons, it is reccomended that you avoid using this if possible, but it may be needed until the planned timer mechanism is implemented. (world script and ship scripts)
The status
parameter is a string containing the player’s current status - “STATUS_IN_FLIGHT” and “STATUS_DOCKED” being commonly-seen examples.
this.tickle = function(status) { // Your code here }
Not Yet Implemented
Handlers do not yet exist for the following events:
- Target changed.
- Cloaking device events.
If there are other events you would like to be able to respond to, please write a request on the forum.
See also: ship_script_event_handlers