Looking for info on the NEXUS faction in the game? It's in the Warzone Encyclopaedia
NEXUS.infiltrate.js
Infiltrations
This subroutine will infiltrate the following standard JS API Events & Timers, triggering a task whenever the infiltrated event is triggered.
Task IDs are determined with the following formula:
taskID = prefix + objectKey
The 'prefix' associated with an event is shown in the table below.
The 'objectKey' is optional – if you have installed a Classify Subroutine it will be whatever the routine returns, otherwise it will be omitted.
Infiltrated Event | Automatic | Task ID prefix | Notes |
---|---|---|---|
eventAttacked() | attacked | ||
eventDestroyed() | destroyed | It should be noted that the ".player" property for destroyed FEATURE objects will always be the value of "me". | |
eventDroidBuilt() | droidBuilt | ||
eventGameInit() | gameInit | Will only be called once, when the scripting engine is initialised. NEXUS must infiltrate the event prior to this point for the event to be absorbed. | |
eventObjectSeen() | objectSeen | ||
eventObjectTransfer() | objectTransfer | A custom taskID is used for this event (see below). | |
eventResearched() | researched | ||
eventStartLevel() | startLevel | Will only be called once, when all players are ready to engage in battle. NEXUS must infiltrate the event prior to this point for the event to be absorbed. | |
eventStructureBuilt() | structureBuilt | ||
eventStructureReady() | structureReady | This usually refers to the Laser Satellite being ready for action. |
Custom events
Two custom tasks are defined for object transfers:
- objectTransfer.droid.from – you have gained a droid
- objectTransfer.droid.to – you have lost a droid
The .player
property of the object associated with the event will indicate who the droid was taken from or who it was given to. There is no separate "from" argument (like there is in the JS API) because the event key in combination with the .player
property provides all required information about the transfer.
Note that the droid object will not be further classified, even if you have a Classify Subroutine installed. If you want to get the object key for the transferred droid, you can call .classify() separately.
If you have installed NEXUS.suffix.js, or some other similar suffix, you will get more descriptive event keys such as:
- objectTransfer.droid.from.Enemy – you stole a droid from an enemy using Nexus Link. Dr. Reed will be pleased.
- objectTransfer.droid.from.Ally – an ally gifted you a droid
- objectTransfer.droid.to.Enemy – an enemy stone a droid from you using Nexus link
- objectTransfer.droid.to.Ally – you gifted an ally a droid
Examples
Assuming you've installed NEXUS.classify.js and NEXUS.suffix.js, you can register event listeners as follows:
// example to follow
Contents
Assimilate:
Memory Banks
Observe:
- Classify Subroutines — Generates an "Object Key".
- Fn Subroutines — Shared helper functions.
- Infiltrate Subroutines — Hook in to external events and functions.
- Process Subroutines — Process an "Action Object".
- Suffix Subroutines — Add a suffix to Task IDs.