Skip to main content

API reference

Functions are grouped by domain under nexMap.api. Most methods are thin, documented wrappers over the command surface: they dispatch a command by id and return its result. Data snapshots remain under nexMap.state; persisted options live under nexMap.settings.

Domains

NamespacePurposeRepresentative methods
api.travelRouting and travel-class togglesgoto, toRoom, toArea, toLandmark, stop, planRoute, enable, disable, toggle, isEnabled
api.mapMap viewport and room readsshowRoom, selectRoom, showArea, center, fit, zoom, refresh, roomInfo, getNode
api.landmarksSaved landmarksadd, list, remove
api.searchGraph + denizen searchrooms, area, areas, gameArea, denizens
api.trackingLive subject overlayssubject, clear, list
api.intelFarsee / fullsense overlaysfarsee, farseeArea, fullsense
api.wormholesRemote wormhole edgeslist, refresh, add, remove, probe
api.overlaysArbitrary per-room badges/halosset, clear
api.systemDialogs and noticesopenSettings, closeSettings, openShell, closeShell, notice, showResults, closeResults
api.commandsRaw command dispatchexecute, get, list, menu, parseAndExecute, version

Common patterns

// Travel
nexMap.api.travel.goto("315"); // room id, landmark, or area name
nexMap.api.travel.toArea(42); // nearest reachable room in an area
nexMap.api.travel.toLandmark("home");
nexMap.api.travel.stop();

// Plan without executing (synchronous, deterministic)
const plan = nexMap.api.travel.planRoute(315);
// → { commands, rooms, segments, totalWeight, sourceRoomId, targetRoomId } | null

// Map viewport
nexMap.api.map.showArea(42, { fit: true });
nexMap.api.map.zoom(1.5);
nexMap.api.map.getNode(315); // read a room record, no I/O

// Landmarks
nexMap.api.landmarks.add("home");
nexMap.api.landmarks.remove("home");

// Search
nexMap.api.search.rooms("temple", { showResults: true });
nexMap.api.search.denizens("Orinula", { showResults: true });

Travel-class toggles

Fast-travel methods are persisted options, not per-call flags. The travel namespace edits them through nexMap.settings:

nexMap.api.travel.disable("wormholes"); // accepts aliases (clouds, wings, grates…)
nexMap.api.travel.enable("clouds"); // eagleWings + atavianWings
nexMap.api.travel.toggle("universe");
nexMap.api.travel.isEnabled("wormholes"); // → boolean

Disabled classes are pruned from pathfinding (their edges get infinite weight). See Travel for the class list and aliases.

The command surface

Every domain method ultimately dispatches a command id (for example travel.toRoom, map.showArea, landmark.add). You can call commands directly when you need an id that has no dedicated wrapper, or to build menus:

nexMap.api.commands.execute("map.showArea", { areaId: 42 }, options);
nexMap.api.commands.get("travel.toRoom"); // metadata for one command
nexMap.api.commands.list(); // all command metadata
nexMap.api.commands.menu(); // grouped menu structure
nexMap.api.commands.version; // command-surface contract version

parseAndExecute parses a raw nm-style string and runs the routed command — the same path the in-client nm aliases take:

nexMap.api.commands.parseAndExecute("goto 315");
nexMap.api.commands.parseAndExecute("wormholes on");

Unknown-but-newer command ids degrade to a friendly "update nexMap4" notice rather than throwing, so a stale install never hard-fails on a command it doesn't yet know.

Return values and async

  • Read/predicate methods (getNode, isEnabled, …) return synchronously.
  • planRoute is guaranteed synchronous and returns a frozen plan or null.
  • Travel and search methods that touch the renderer or remote services may return a result object or a promise; do not assume a mutation is confirmed synchronously. Use nexMap.state and the event surfaces to observe the confirmed result.

Overlays

api.overlays.set(key, overlay) paints a keyed layer of per-room badges or halos; re-painting the full set under the same key replaces the prior layer, so no separate clear step is needed each cycle. api.overlays.clear(key) removes one layer (or all layers when called with no key). Both return false when no renderer is connected.

Connecting renderer clicks

nexMap.connectRendererActions(options) binds map room-clicks to a command — by default travel.toRoom, so clicking a room walks there. Pass a different commandId / createInput to repurpose clicks (for example, "select room" instead of "travel").