DocsMegalithReference

Test and share

  1. Run mode-check with the version you'll host. Then refresh and reselect the mode.
  2. On the intended map, verify scoring, the timer or score limit, deaths and respawns, and a second round. Check that your variables reset as intended.
  3. For teams, check joining, leaving, changing teams and a team becoming empty. For objects and zones, check their positions and any assets they need.
  4. Join with another PC, then test a late join. Check traits, bodies, objects and HUD on the joining player's screen, and for a script menu, click its widgets from the joined player's PC.

See the full checklist. To share a mode, share your .rmeg with other hosts, and state the map and assets it needs. Joining players only need the map's content; they don't install the script. A saved .json game type holds your source text too, so it isn't a way to hide your script. See install, share and host.

The Megalith console

A console in the running game, so you can try a script and fix it without loading the map again. It's the chat line's /megalith command, and it works only while you host on this PC alone:

  1. Turn it onIn Host Settings, set Network to Local and turn on Megalith console, under GAME MODES. It's off by default, and text chat must be on.
  2. Start your modeHost it as usual and start the game.
  3. Type a lineOpen the chat line and type /megalith and a line of Megalith, or one of the commands below.
/megalith STATEMENTS
Runs the statements once, now, in the running script, with its variables, aliases and functions: /megalith for each player do current_player.score += 5 end, or /megalith reward() for a function of the script's. No time passes: timers stand as they were.
/megalith reload
Reads the mode's file again and starts its script afresh, as a new round's script, without loading the map: its variables as declared, and what it made in the world gone. The lobby's settings of the mode stay; its header's game options are read at the next game.
/megalith restart
Starts the script afresh as it is: for one that stopped on an error.
  • Answers show in the chat: done, the messages the line showed players, or its error, which names the place in the line you typed. game.show_message_to(current_player, none, "bonus %n", current_player.bonus) reads a value. A line that doesn't compile, or fails as it runs, changes nothing and never stops the script.
  • The entry stays open on /megalith for the next line; Escape closes it.
  • A line is one chat line, 360 characters, and has no current_player of its own: loop over the players, or name one. The script's init runs again only with reload and restart.
  • A line reads only what the mode already reads. Under a script that never touches an object, a line that loops over objects is refused, and says so: add such a read to the source and reload.
  • A script that stopped takes no statements until it's reloaded or restarted.
  • It's off in any game other players can join, and a film being played takes no lines. A film of a game whose script was reloaded or restarted plays the script it began with: don't count on it.
  • The command's former name, /megalo, still works.