HyperScript 1.5.6
Version 1.5.6
Big change
Check your scripts before updating to 1.5.6
Variables: there are now just two kinds, and a name that starts with a player belongs to that player.
| Written as | Kind |
|---|---|
{something} | Global: saved, and shared by every script |
{_something} or _something | Local: one run of one trigger, never saved, seen by nothing else |
- The
global.prefix is gone from the documentation and the demo.{global.event_active}is now written{event_active}. The old spelling still loads, but it is simply a variable whose name happens to begin with "global.":{global.scores}and{scores}are two different variables, so rename them in your scripts in one go. Values saved under the old names stay where they were. - A name whose first part is a player is that player's own variable.
{%arg.1%.coins}and{%_target%.coins}used to be ordinary globals named after the text (alex.coins). They now read and write the same value as that player's{%player%.coins}, online or offline. If the first part is not the name of someone who has played on the server, the variable is a global as before. - So for tables that are not about players, start the name with a fixed word:
{warp.%arg.1%}rather than{%arg.1%.warp}. Otherwise a warp called "Alex" would land in the data of the player Alex. {%player%.name}is unchanged.
Changed (check existing scripts)
Variables: there are now just two kinds, and a name that starts with a player belongs to that player.
| Written as | Kind |
|---|---|
{something} | Global: saved, and shared by every script |
{_something} or _something | Local: one run of one trigger, never saved, seen by nothing else |
- The
global.prefix is gone from the documentation and the demo.{global.event_active}is now written{event_active}. The old spelling still loads, but it is simply a variable whose name happens to begin with "global.":{global.scores}and{scores}are two different variables, so rename them in your scripts in one go. Values saved under the old names stay where they were. - A name whose first part is a player is that player's own variable.
{%arg.1%.coins}and{%_target%.coins}used to be ordinary globals named after the text (alex.coins). They now read and write the same value as that player's{%player%.coins}, online or offline. If the first part is not the name of someone who has played on the server, the variable is a global as before. - So for tables that are not about players, start the name with a fixed word:
{warp.%arg.1%}rather than{%arg.1%.warp}. Otherwise a warp called "Alex" would land in the data of the player Alex. {%player%.name}is unchanged.
Added
- Functions.
function reward(_who, _amount):defines a block that any script can call, as a statement (reward(player.name, 50)) or for its value (set _total to reward(player.name, 50)).return <value>hands a value back.local functiondefines one that only the file it is written in can use. Functions may call each other across files in any order, and may call themselves up to 64 levels deep. parse <text> as numberturns text such as"52"into the number 52, and gives unset when the text is not a number, so input can be checked withis not set. Alsoparse ... as integer(rounded down) andparse ... as text.loop all players:runs a block for everyone online. Inside itlooped-player(%looped-player%in text) is the player the loop is on, whileplayeris still whoever ran the command.send "..." to all playersmessages everyone online.send "..."andsend "..." to playergo to whoever ran the command, andsend "..." to <name>to a named player, as before.- Other players' variables:
{%arg.1%.coins},{%looped-player%.coins},{%_name%.coins}, for anyone who is online or has played before. - Inventory checks:
if player has 5 diamond:,if player does not have 1 iron pickaxe:, andremove 5 diamond from playerto take items away. They work with a name orall playerstoo. - Six events:
on player death:(withset death message toandhide death message),on player respawn:,on item pickup:,on item drop:,on world change:andon player command:, which sees every command a player types and can cancel it. New values:command,amount,%event.from%, andmessage/cause/killerfor deaths. - Vault: with Vault and an economy plugin,
balance of playeris a player's money, andadd 100 to balance of player,subtract ...andset balance of ... tochange it. - PlaceholderAPI, both ways:
placeholder "%vault_rank%"fills in other plugins' placeholders, and other plugins can show script variables as%hyperscript_<name>%(a global) and%hyperscript_player_<name>%(the viewing player's own). Neither plugin is required. /hyperscript check <file>reads a script and reports any mistake without loading it, so nothing that is running changes. It works on disabled files and suggests file names on Tab.- The bundled
demo.hsgained/pay,/bonus,/selland a death handler that show the above. A copy already on a server is not replaced automatically;/hyperscript remake demowrites the new one.
Documentation website
- A red "Big change" mark now sits beside the version name of every release that changes how existing scripts work. Clicking it shows what changed. Versions 1.5.4 and 1.5.5 carry it as well.
- The Docs page lists the new syntax and events, each with an example.