Skip to main content

API reference

Functions are grouped by domain under nexSys.api. Reads and mutations for a domain live together; data snapshots remain under nexSys.state.

Domains

NamespacePurposeRepresentative methods
api.affsAffliction queries, timing, and prioritieshave, haveAll, timing, setPriority, setDefaultPriority
api.defsDefence queries, priorities, and defuphave, setPriority, setStatic, defup, defoff, parry
api.balancesBalance queries and timinghave, haveAny, elapsedMs, remainingMs, timing
api.limbsLimb lookupget, list
api.targetCurrent targetget, set, is
api.classCharacter class checksget, is, check
api.commandCommand dispatch and output-cycle worksend, sendInline, addOutput, evaluateNow
api.controlRuntime and persisted settingspause, unpause, setSlowMode, applySettings, start, stop
api.queueNamed command queueslist, inspect, get, add, prepend, clearQueue, flush
api.promptPrompt rendering and customizationrender, patchVars, applyPreset, markPromptDirty
api.observeExplicit observed state transitionsAffliction, defence, balance, limb, and mount handles
api.uiConfiguration dialogopenConfig, closeConfig, setConfigOpen
api.lineNexus output-line helpersreplace, replaceHTML, nextLine, prependNotice, say
api.rulesRuntime rule lifecycleadd, remove, enable, load, reorder, bindTransition
api.ssServer-side-only constructsPredictions, manual queue, precache, prioritized affliction, and snapshot sync

Common patterns

// Query a domain
nexSys.api.affs.have("asthma");
nexSys.api.balances.timing("balance");

// Request a mutation
nexSys.api.affs.setPriority("asthma", 5);
nexSys.api.defs.defup();

// Send commands and use a named queue
nexSys.api.command.send("stand");
nexSys.api.queue.free.add("touch tree");

// Update target state through the supported path
nexSys.api.target.set("sarapis");

Return values

Predicate methods return booleans. Timing and lookup methods may return null when an id is unknown. Mutation methods commonly return whether a change was made or a domain-specific result object. Callers should not assume that every mutation is synchronous server confirmation; use state and events to observe the confirmed result.

Events are separate

Listeners do not live below api. External packages attach listeners through the Nexus eventStream global. The events page lists every nexSys4 event available through that interface.