REDNODE / DOCS

Roles test

Example apps / roles-test / v0.1.0

Node modneeds rednode

Finds a service by its role with use("counter"), plays a sound it writes into its data folder, and hides a key typed into a password field.

Simulated game starting
Mod log

    Here Counter service runs in the same preview. The tone buttons fail: a preview cannot write files.

    How it works

    use("counter") asks the host for the package that provides the counter role (Counter service says "provides": ["counter"]) and answers the same handle as service.connect. With two providers, the player picks one in the Mod Manager's Provides section.

    The tone buttons write a WAV file into pkg.dataDir and play it with its full path. The second writes the same file again at another pitch: the engine reads the file at each play.

    ui.input({ password: true }) shows dots as the player types; keep such a value with secrets.

    What it uses

    use provides audio.play from pkg.dataDir ui.input password

    Try this

    Use it

    Copy the files into red4ext/plugins/REDnode/apps/roles-test/ 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.