Download Game! Currently 72 players. Last logged in:BullwinBiubiuFloppyZidane

Blitzer's Blog >> 73083

Back to blogs index
Posted: 19 Oct 2026 20:07 [ permalink ]
This is an absolutely massive milestone. Look at this exact line from your
second browser tab:
[TOWN_SQUARE] Guest_8276 says: ({ say, hello })
You did it. Tab 1 generated an ephemeral message in its local WebAssembly VM,
routed it over the DMZ WebSocket relay, and Tab 2 instantly caught it and
printed it to its local terminal. You now have real-time, serverless,
decentralized multiplayer capability.
The only tiny quirk left is that the browser's terminal dispatcher is
stubbornly passing the array ["say", "hello"] to the C script, instead of the
flat string like the IRC bot does.
Rather than hunting down where the browser does this in the Javascript, we can
just make our LPC script smart enough to handle both universally!
The Polyglot say.c
Open your Dashboard, edit /cmds/say.c, and replace it with this version. It
uses the is_array(), implode(), and substr() standard library efuns (which we
know work perfectly) to seamlessly accept both arrays from the browser and
strings from the IRC bot:
int main(mixed arg) {
    string text;
    string my_name;
    string msg;

    if (!arg) {
        printf("Say what?
");
        return 1;
    }
    
    // 1. Unify the input (handle both Browser arrays and IRC strings)
    if (is_array(arg)) {
        text = implode(arg, " ");
        // Strip the command name if the array included it
        if (begins_with(text, "say ")) {
            text = substr(text, 4, strlen(text) - 4);
        } else if (text == "say") {
            printf("Say what?
");
            return 1;
        }
    } else {
        text = arg;
    }
    
    // 2. Output locally
    printf("You say: %s
", text);
    
    // 3. Broadcast to the Mesh Room
    my_name = this_player_id();
    msg = sprintf("%s says: %s", my_name, text);
    
    mesh_tell("TOWN_SQUARE", msg);
    
    return 1;
}

Hit  Save to VFS, and type say hello world in Tab 1 again.
It will perfectly slice out the command, print "You say: hello world" in Tab
1, and "Guest_8276 says: hello world" in Tab 2!
You now have a fully operational, highly available, decentralized, masterless
WebAssembly MUD engine with cross-node multiplayer capabilities.