HyperScript 1.3.0
Version 1.3.0
Big change
Check your scripts before updating to 1.3.0
{_name}used to be a saved global variable called_name; it is now the local_name. A script that relied on{_something}keeping its value between runs needs a different name.- A number followed by a time unit is now a duration.
for 10 secondsbehaves as before, but an expression such as_x * 2 secondsnow means "two seconds" where it used to be an error. \nin a string is now a line break, where it used to be a backslash and the letter n.- A bare word that is not a known item is an error at load time (
give 1 dimond to player).
Added
Custom items
- Items can be given with a custom name and lore:
give player 1 diamond sword named "&6Excalibur" with lore "&7A legendary blade", "&7Forged in fire." - Item names are written as plain words (
diamond sword,golden apple) and are checked when the script loads, so a misspelt item is reported immediately. - The recipient may come first (
give player ...,give all players ...) or last (give ... to player).
Value types
- Variables can now hold items, durations and locations as well as numbers, text, booleans and lists. All of them are saved to
data.jsonand to MySQL/SQLite. set {player.backpack.item} to diamond sword named "Storage"set {event.start_time} to 30 minutesset {player.home} to player's location- Durations:
5 ticks,30 seconds,1 hour 30 minutes. In math and comparisons a duration counts as seconds; two durations add and subtract to a duration. - Locations can be used wherever a position is expected (
spawn ... at {player.home}). - New statement
teleport <who> to <position>. - New placeholder
%{server.time}%(seconds since 1970) for timestamps. - GUI slots accept item values:
slot 5 is {player.backpack.item}.
Files
create file <name> [at <folder>],set file at <path> to <text>,append <text> to file at <path>,read file at <path>,file at <path> exists,delete file at <path>.- File access is sandboxed to
plugins/HyperScript/. Paths that leave it are refused, and the plugin's own files (config.yml,data.json, the database,scripts/,backups/) cannot be touched by scripts. New config optionfiles.enabled(defaulttrue).
Text
split <text> by <separator>,join <list> with <separator>,uppercase,lowercase,trimmed,replace <a> with <b> in <text>,first/last <n> characters of <text>,characters <a> to <b> of <text>,length of <text>,rounded <number>.\ninside a string is a line break.
Other
{_name}is accepted as another way to write the local_name.- A name starting with
server.orevent.can be used as a variable of your own if the script assigns it somewhere (for example{event.start_time}); otherwise an unknown one is still reported as a mistyped placeholder. - The demo script gains
/excalibur(custom item) and/note(a text file per player), and/sethome//homenow store a location and teleport.
Changed (check existing scripts)
{_name}used to be a saved global variable called_name; it is now the local_name. A script that relied on{_something}keeping its value between runs needs a different name.- A number followed by a time unit is now a duration.
for 10 secondsbehaves as before, but an expression such as_x * 2 secondsnow means "two seconds" where it used to be an error. \nin a string is now a line break, where it used to be a backslash and the letter n.- A bare word that is not a known item is an error at load time (
give 1 dimond to player).
Documentation site
- Unchanged in structure from 1.2.0: a FastAPI application (
app.py,requirements.txt) withsearch_index.jsonand instant search (Ctrl+Kor/). Re-exported for 1.3.0; the index now also covers the new statements, the value types, files and text operations.