Skip to main content

Events

nexSys announces changes as they happen, such as an affliction gained, a balance recovered, or a queue firing. Your scripts and other packages can listen and react.

Listening​

Packages and Nexus reflex scripts listen through the Nexus eventStream global:

eventStream.registerEvent(
"nexsys4.aff.got",
(payload) => {
console.log(payload.name);
},
{ id: "my-package:aff-got", tags: ["my-package"] },
);

Remove it again with eventStream.removeListener("nexsys4.aff.got", "my-package:aff-got"). To run setup code once nexSys is ready, listen for nexsys4.system.loaded, or see Customizing nexSys.

Every payload includes topic and at, the time it was published. Events with a scoped variant can also be targeted by appending the value shown in angle brackets. For example, nexsys4.aff.got.asthma fires only for asthma, while nexsys4.aff.got fires for every affliction gained.

From JavaScript you can also listen with nexSys.events.on(topic, listener). It carries these events plus a few JavaScript-only ones, listed in All event topics.

The tables below are generated from nexSys's topic registry. If an event isn't listed here, it isn't part of nexSys's EventStream contract.

Runtime and system​

EventScoped variantsDescription
nexsys4.runtime.startednoneRuntime startup completed.
nexsys4.runtime.stoppednoneRuntime shutdown completed.
nexsys4.raw.gmcpnoneRaw GMCP payload observed at the adapter boundary.
nexsys4.system.vitals.changednoneCharacter vitals changed.
nexsys4.system.health.changednoneHealth changed.
nexsys4.system.mana.changednoneMana changed.
nexsys4.system.rage.changednoneRage changed.
nexsys4.system.bleed.changednoneBleed changed.
nexsys4.system.status.changednoneCharacter status snapshot changed.
nexsys4.system.class.changednoneCharacter class changed.
nexsys4.system.target.changednoneCurrent target changed.
nexsys4.system.pause.changednoneRuntime pause state changed.
nexsys4.system.pausednoneRuntime paused.
nexsys4.system.unpausednoneRuntime unpaused.
nexsys4.system.loadednoneStartup game-state initialization completed.
nexsys4.system.death.detectednoneDeath was detected from character state.
nexsys4.system.mount.changednoneMounted state changed.
nexsys4.system.wielded.changednoneWielded equipment changed.

Afflictions, defences, balances, and limbs​

EventScoped variantsDescription
nexsys4.aff.gotnexsys4.aff.got.<name>Affliction became active.
nexsys4.aff.lostnexsys4.aff.lost.<name>Affliction was cured or removed.
nexsys4.aff.stack.changednexsys4.aff.stack.changed.<name>Affliction stack count changed.
nexsys4.def.gotnexsys4.def.got.<id>Defence became active.
nexsys4.def.lostnexsys4.def.lost.<id>Defence expired or was removed.
nexsys4.balance.gotnexsys4.balance.got.<id>Balance became available.
nexsys4.balance.lostnexsys4.balance.lost.<id>Balance was consumed or lost.
nexsys4.balance.resetnexsys4.balance.reset.<id>Balance timing was reset.
nexsys4.balance.duration.observednexsys4.balance.duration.observed.<id>Observed balance recovery duration changed.
nexsys4.eqbal.gotnoneBalance and equilibrium are both available.
nexsys4.limb.updatednexsys4.limb.updated.<limb>Limb damage or break state changed.

Room and items​

EventScoped variantsDescription
nexsys4.room.changednoneCurrent room identity changed synchronously at ingestion (id, name, exits).
nexsys4.room.features.changednoneCurrent room walls, frozen ground, or catalog-relative completeness changed synchronously.
nexsys4.item.room.addednoneAn item appeared in the current room.
nexsys4.item.room.removednoneAn item left the current room.
nexsys4.item.room.updatednoneA current-room item changed.
nexsys4.item.room.listnoneCurrent-room item list snapshot received.
nexsys4.item.inv.addednoneAn item was added to inventory.
nexsys4.item.inv.removednoneAn item was removed from inventory.
nexsys4.item.inv.updatednoneAn inventory item changed.
nexsys4.item.inv.listnoneInventory item list snapshot received.

Cache, queues, rules, and serverside​

EventScoped variantsDescription
nexsys4.cache.amount.changednoneCached item counts changed.
nexsys4.cache.inventory.listnoneInventory cache snapshot applied.
nexsys4.cache.rift.listnoneRift cache snapshot applied.
nexsys4.queue.sentnexsys4.queue.sent.<queueName>A queue submission was accepted by the server.
nexsys4.queue.firednexsys4.queue.fired.<queueName>A queue fire was acknowledged for a named queue.
nexsys4.queue.fired.acknoneQueue fire acknowledgement was recorded.
nexsys4.serverside.aff.priority.setnexsys4.serverside.aff.priority.set.<id>Live serverside affliction priority confirmation was observed.
nexsys4.serverside.def.priority.setnexsys4.serverside.def.priority.set.<id>Live serverside defence priority confirmation was observed.
nexsys4.rule.activatednexsys4.rule.activated.<id>Declarative rule became active.
nexsys4.rule.deactivatednexsys4.rule.deactivated.<id>Declarative rule stopped being active.

Contract notes​

  • Base and scoped events receive the same payload object.
  • Scoped events are available only where a scoped variant is listed.
  • nexsys4.raw.gmcp is emitted only when nexSys is started with the publishRawGmcp option.
  • Adapter-local events such as PromptEvent, NoticeEvent, TargetSetEvent, and TargetChanged are not nexSys4 events.