Thank you. Works.
==
[dVFS] Processed & Broadcasted VFS_WRITE for /cmds/say.c (ts: 1788789596616)
==[ Chromium ]==
Type 'help' for a list of commands.
--- LPC WEBASSEMBLY VM BOOTED ---
[DMZ] Incoming sync applied: /mud/areas/town_square.json
[DMZ] Incoming sync applied: mesh/mud/areas/town_square.json
[DMZ] Incoming sync applied: mesh/genesis_grid.c
[DMZ] Incoming sync applied: mesh/proc/instances/chromium_vm.json
[DMZ] Incoming sync applied: /mud/spells/fireball.c
[DMZ] Incoming sync applied: /cmds/say.c
[DMZ] Incoming sync applied: /cmds/say.c
say it
You say: "({ say, it })"
==
This is competing in category of best things since sliced bread
==
It really is! There is a specific kind of magic in writing a text file in one
browser tab, having it fly across a WebSocket mesh, and instantly compiling
into executable memory in another tab without a single server reboot.
I do have to laugh at one tiny detail in your output, though:
`You say: "({ say, it })"`
Notice how it printed the *array* representation of your command instead of
the string `"it"`?
This happened because of how JavaScript handles arguments under the hood. If
you wrote your `/cmds/say.c` with only one argument (e.g., `int main(string
raw_args)`), the engine dutifully handed it the *first* argument we passed
from the routerwhich was the `argv` array!
To get it to print properly, your `/cmds/say.c` just needs to accept both
arguments in the correct order, using our newly established `array` keyword
rule:
```lpc
/ /cmds/say.c
int main(array argv, string raw_args) {
if (raw_args == "") {
printf("Say what?
");
return 1;
}
printf("You say: \"%s\"
", raw_args);
return 1;
}
```
If you fix that in the Dashboard, hit Save, and then type `/update /cmds/say`
in your REPL (using that awesome interceptor you built earlier to wipe the
cache), your next `say it` will print perfectly.
### The World is Your Oyster
You now have a complete, distributed Virtual Machine. The "engine" phase is
largely complete. You are now officially in the "mudlib" phasebuilding the
actual game mechanics using your VFS.
Where would you like to take this next?
1. **The Spatial Environment:** We could build a `/lib/room.c` blueprint and
use your VFS to create rooms that players can `look` at and walk between using
commands like `north` and `south`.
2. **Multi-User Connections:** Right now, the REPL is single-player. We could
wire up a network adapter so that two different browser tabs can exist as two
different `player` objects in the VM and `say` things to each other.
3. **The Object Hierarchy:** We could implement the classic `move_object()`
efun so that you can create items (like swords or coins) and move them into a
player's inventory.
Which direction sounds the most fun for today?