Skip to main content

State reference

nexSys.state is nexSys's read-only data. It holds no functions. Each branch returns a fresh, frozen snapshot every time you read it.

if (nexSys.state.affs.asthma.have) {
// you have asthma right now
}

Branches​

BranchContents
state.systemSettings, runtime status, character, and target
state.classYour current class, such as "Occultist"
state.targetYour current target. The same as state.system.target.
state.roomThe current room: identity, exits, walls, and frozen ground
state.affsAfflictions, keyed by name
state.defsDefences, keyed by name
state.balancesBalances and cooldowns, keyed by name
state.limbsYour limbs, keyed by limb
state.trackablesTracked effects, keyed by name
state.queueCommand queues, keyed by queue id
state.cacheCurative counts and precache amounts
state.promptThe prompt's vars, affs, and cureColors. See Custom prompt.
state.serversideServer-side curing, as nexSys sees it
state.rulesThe combined changes from active rules

Snapshots​

The whole tree can be turned into JSON, which makes a complete copy for bug reports or debugging:

const report = JSON.parse(JSON.stringify(nexSys.state));

A snapshot you keep doesn't update. Read the branch again to see newer state, and use events to find out when to re-read:

const before = nexSys.state.affs;
// ...an affliction is gained...
const after = nexSys.state.affs; // a new snapshot; `before` is unchanged

Snapshots are frozen. To change anything, call a function under nexSys.api.

Timestamp fields such as since, lastChangeAt, and lastLostAtMs are readings of nexSys's internal clocks, not times of day. To measure time, use the elapsedMs(), remainingMs(), and timing() functions in the API.

state.system​

KeyContents
settingsYour current settings. See below.
baselineIntentThe saved settings that nexSys reconciles against
runtimepaused, slowMode, aeonLocked, rulesSuspended, phase, startupFailureMessage
charname, class, race, hp, maxhp, mp, maxmp, ep, maxep, wp, maxwp, bleed, rage, dead, mount, wielded, plus class resources such as karma while your class has them
targetid, text (the name), isPlayer, and hp

runtime.phase is RUNNING once startup has finished. During startup it moves through PROBING_SEPARATOR, BOOTING, PROVISIONING_CURINGSET, AWAITING_SNAPSHOTS, and CAPTURING_SNAPSHOTS, and it's FAILED, with startupFailureMessage set, if startup couldn't finish.

Settings​

settings mirrors the configuration window. Use these names with nexSys.api.control.applySettings():

KeySetting
loadOnLogin, queueWhilePaused, overrideTab, customPrompt, debugThe nexSys Config switches
notices.affGot, notices.affLost, notices.defGot, notices.defLost, notices.balanceLost, notices.balanceRecovered, notices.trackableGot, notices.trackableLost, notices.priority, notices.outputThe notice switches
ss.transmutation, ss.sipPriority, ss.batch, ss.tree, ss.focus, ss.focusOverHerbs, ss.focusWithGuilt, ss.focusWithFulminated, ss.clot, ss.clotAt, ss.clotToCuring method
ss.sipHealthAt, ss.sipManaAt, ss.mossHealthAt, ss.mossManaAt, ss.fracturesAbove, ss.manaThresholdThresholds
nexSys.api.control.applySettings({ notices: { balanceLost: true } });
nexSys.api.control.applySettings({ ss: { sipPriority: "mana" } });

Rules use the ss names without the ss. prefix, as in { settings: { batch: false } }.

state.room​

{
id: 12345,
name: "A dusty road",
exits: { n: 12346, s: 12344 },
walls: { e: { icewall: { type: "icewall" } } },
frozenGround: false,
featuresKnown: true,
}

featuresKnown is true when nexSys has seen a complete description of the room's walls and ground. Room contents aren't copied here; use nexSys.api.room.items to check them.

state.affs​

One record per affliction nexSys knows, whether or not you have it:

FieldMeaning
havetrue while you have it
count, min, maxCurrent stacks, for afflictions that stack
sinceWhen you gained it
lastChangeAtWhen it was last gained or lost
defaultPriorityYour saved priority
priorityOverrideA priority set for this session, or null

Use nexSys.api.affs.timing() for elapsed and remaining times.

state.defs​

One record per defence. The most useful fields:

FieldMeaning
havetrue while the defence is up
priorityThe priority nexSys is using now
defaultPriorityYour saved priority
statictrue for Defup defences, raised only by defup
staticRequestedtrue while a defup is waiting to raise it
serversidetrue if server-side curing raises it, false if nexSys does
commandThe command used to raise it
bals_req, bals_usedThe balances it needs, and the ones it uses up
skillsThe classes that have it. Empty means every class.
oppsDefences that can't be held at the same time

state.balances​

Keyed by balance name, such as balance, equilibrium, herb, salve, smoke, focus, tree, sip, moss, writhe, voice, and class cooldowns such as fitness and dragonheal.

FieldMeaning
havetrue while the balance is available
lastLostAtMs, lastGotAtMsWhen it was last used and last recovered
expectedReadyAtMsWhen nexSys expects it back
activeDurationMsHow long the current loss is expected to last
activeDurationReportedtrue if the game reported that length (Balance used:) rather than nexSys estimating it
baseDurationMsThe usual length of a loss

state.limbs​

Keyed by head, torso, leftarm, rightarm, leftleg, and rightleg:

FieldMeaning
percentDamage toward the next stage, from 0 to 100
hitsHits counted since the limb last reset
stage"healthy", "damaged", or "mangled"
brokentrue while an arm or leg is broken

Torso damage is tracked by nexSys from the hits you take, because torso trauma isn't shown when it lands. The other stages follow the game's afflictions.

state.trackables​

Short-lived effects nexSys times itself, such as snapTrack, which lasts 8 seconds after you're snapped. Each record has have, label, since, expiresAt, and durationMs.

state.queue​

Keyed by queue id (freeQueue, classQueue, and so on). See Queues.

FieldMeaning
name, typeThe short name, such as free, and the Achaea queue type
itemsYour queued commands
prependCommands added to the front
plannerCommandsnexSys's own automatic actions, which run first
pendingtrue while waiting for the game to accept the queue
deferredtrue while held because nexSys is paused or starting
exclusionsQueues cleared when this one is sent

state.cache​

KeyContents
inventoryCuratives in your inventory, by name
riftCuratives in your rift, by name
desiredPrecacheYour precache amounts
riftCapacityHow much of one curative your rift holds
hydrationinventoryKnown and riftKnown: whether nexSys has read each yet

Irid moss uses the curative key irid in these buckets. Incoming GMCP calls it moss; nexSys normalizes that name to irid. The balance remains state.balances.moss.

state.serverside​

KeyContents
baselineYour saved curing configuration
sessionBaselineYour configuration plus changes you made in game this session
desiredWhat nexSys wants the server to have, including active rule changes
observedWhat the game has confirmed: settings, affPriorities, defPriorities, prioAff, manualQueue, predictions, and prioritySet
transientOne-off requests: prioAff, manualQueue, and predictions
pendingCommands sent and awaiting confirmation
curingsetsYour curing sets: sets, activeSet, priorSet, used, and limit
startupWhat startup has captured so far

Curing and priorities explains how these fit together.

state.rules​

KeyContents
overlayThe combined changes from every active rule
provenanceFor each changed key, the rule that won
policyThe class cures currently turned on
appliedThe ids of the rules active in the last check
suspendingRulesRules currently holding curing off
registryEvery rule, in evaluation order

nexSys.api.rules.list() gives the same rules in a simpler form. See Rules.