Infiltrate commonly used Warzone JS API events. |
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. |
Two custom tasks are defined for object transfers:
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:
Assuming you've installed NEXUS.classify.js and NEXUS.suffix.js, you can register event listeners as follows:
// example to follow |
Requires latest version of Util.js to be included prior to including this file. |
ContentsAssimilate: |
SubroutinesAbsorb: |
Memory BanksObserve: |