REDNODE / DOCS

Counter service

Example apps / counter-service / v0.3.0

Node mod

A service with no window: other packages read and change its count through REDnode's mod services.

Simulated game starting
Mod log

    In the game this package has no window. Here the preview lists the functions it offers.

    How it works

    Its rednode-app.json names a service file, "service": "service.mjs", and no main: the service is the whole package. Every function service.mjs exports can be called by other packages, by this package's id, through the REDnode host.

    service.emit("changed", ...) tells every package that connected. service.caller() says who is calling, and service.signal() aborts when the caller gives up, which wait uses.

    The JSDoc on each function is its description: from SV2 the host reads it, and functions marked @tool become tools an AI assistant can call.

    Its rednode-app.json also says "provides": ["counter"]: a package that does not know its id can find it with use("counter") (REDnode 0.44.0 or later), as Roles test does.

    What it uses

    service file service.emit service.caller service.signal JSDoc

    Try this

    Use it

    Copy the files into red4ext/plugins/REDnode/apps/counter-service/ in the game folder, or start your own package from them: change id and name in the manifest first. The whole folder is on GitHub.