HyperScript
Docs

Installation and setup

  1. Get the jar, HyperScript-1.7.71.jar.
  2. Stop the server, then copy the jar into the server's plugins/ folder.
  3. Start the server. HyperScript creates its folder, a config.yml, and an example script.
  4. Write a script. Create a file ending in .hs inside plugins/HyperScript/scripts/, for example main.hs. Save it as UTF-8. Or start from a ready-made one: the Scripts page of the documentation site has scripts to set a server up with (a sidebar, a tab list, ranks, chat prefixes and join messages) to copy or download into that folder, and scripts other people have made.
  5. Save the file. With hot reloading on (the default) the script is live a moment later, and the console says what was loaded. /hyperscript reload does the same by hand.
  6. Check on things with /hyperscript list (loaded and disabled scripts) and /hyperscript status (storage, hot reloading, Discord bot).
  7. Check a script before using it: /hyperscript check <file> reads the file and reports any mistake without loading it, so nothing that is running changes. It works on disabled files too.
  8. Switch a script off without deleting it: /hyperscript disable <file>, and /hyperscript enable <file> to bring it back. Press Tab to pick from the files.

After the first start the folder looks like this:

plugins/
└── HyperScript/
    ├── config.yml
    ├── analytics-id.txt   <- a random id for the usage numbers, unless they are switched off
    ├── data.json          <- saved variables, created on the first save
    ├── scripts/           <- every .hs file in here is loaded, subfolders included
    │   └── disabled_demo.hs   <- example script, switched off; /hyperscript enable demo
    └── Backups/           <- copies of data.json, created on the first backup

Scripts are loaded a moment after the server has finished starting, once every plugin is enabled, so that addons have had the chance to add their syntax first.

If a file has a mistake, that file is not loaded and you are told the file, line and reason:

[HyperScript] main.hs:12 Expected 'to' but found end of line

The message goes to the console and to whoever ran /hyperscript reload. When a hot reload finds the mistake, it is sent to every online player with the hyperscript.admin permission instead, so you see it in game right after saving the file.

/hyperscript remake demo writes the example script demo.hs again, as it ships with the installed version of the plugin, and reloads. It replaces any demo.hs that is there, including your edits to it. A demo that is switched off stays switched off.

Subfolders. Scripts may be sorted into folders inside scripts/, up to eight folders deep: scripts/minigames/spleef.hs, scripts/staff/tools.hs. Every .hs file under scripts/ is loaded, in alphabetical order of its path, and is named by that path in messages and commands: /hyperscript check minigames/spleef.hs. A local function belongs to its own file, wherever the file is, and a plain function can be called from any folder.

Disabling a script renames it to disabled_<name>.hs, and any file with that prefix is skipped when scripts load. Renaming a file that way by hand does the same thing.

The bundled demo.hs is there to read and to try, and it is switched off on a new server: the file is disabled_demo.hs. /hyperscript enable demo switches it on. It then adds /coins, /gamble, /shop and several other commands and reacts to joins, block breaks and chat, so switch it off again (/hyperscript disable demo) or delete it before the server goes public.

The first start downloads the Discord library (JDA, about 10 MB with its dependencies) through the server's own library loader, whether or not the bot is enabled. On a server without internet access, remove the libraries section from src/main/resources/plugin.yml and rebuild; everything except the Discord bot (slash commands and channel messages) works without it.