HyperScript 1.7.0
Version 1.7.0
Big change
Check your scripts before updating to 1.7.0
A few words now mean something after is, and one statement was split in two.
is empty,is text,is day,is night,is raining,is solid,is loaded,is online,is op,is between ...,is in ...,is within ...,is holding ...andis wearing ...are now tests of their own. A script that compared a value with a variable or item of one of those names (if {mode} is day:) must put the word in quotes:if {mode} is "day":.break block at <location>breaks a block.breakon a line of its own still leaves a loop.- Directly after
send,title casecannot be told fromsend title. Put it in a variable first, or in brackets:send (title case _item). - Local variables written with a dot, such as
{_data.name}, are now fields of a local table. They used to be saved globals with an odd name; nothing in the documentation used them.
The biggest release so far: the language roughly doubles in size.
Changed (check existing scripts)
A few words now mean something after is, and one statement was split in two.
is empty,is text,is day,is night,is raining,is solid,is loaded,is online,is op,is between ...,is in ...,is within ...,is holding ...andis wearing ...are now tests of their own. A script that compared a value with a variable or item of one of those names (if {mode} is day:) must put the word in quotes:if {mode} is "day":.break block at <location>breaks a block.breakon a line of its own still leaves a loop.- Directly after
send,title casecannot be told fromsend title. Put it in a variable first, or in brackets:send (title case _item). - Local variables written with a dot, such as
{_data.name}, are now fields of a local table. They used to be saved globals with an odd name; nothing in the documentation used them.
Added
Events: 39 more
- Player actions:
left click,player sneak,player sprint,player swim,flight toggle,hand swap,slot change,item break,book edit. - Player state:
gamemode change,hunger change,player heal,experience gain,effect gained,effect ended,player kick,advancement. - Combat:
player kill(one player kills another),projectile shoot,projectile hit,totem use. - Blocks and world:
block burn,explosion,leaves decay,crop grow,bucket fill,bucket empty,weather change. - Entities:
entity tame,entity breed,shear,mob target,vehicle enter,vehicle exit. - Inventories:
inventory open,inventory close,enchant item,furnace smelt. - Server:
console command, andon server start:/on server stop:, which run once when the server comes up and goes down.
Types
- Dates:
now,today,tomorrow;now + 1 day; one date minus another is a duration;time since,time until;<date> formatted as "d MMMM yyyy". Dates can be saved and compared. - Entities:
last summoned entity,event entity,victim entity,attacker entity,clicked entityandtarget entity of playerare creatures a script can keep in a local variable and act on. - Local tables:
{_data.name}is a named value inside the local_data.
Conditions
- Players:
is sneaking,sprinting,swimming,blocking,sleeping,on ground,in water,is op,is online,has played before,is holding <item>,is wearing <item>,can see <player>. - World:
<world> is raining,is day,is night;<block> is solid;<location> is loaded;<location> is within <n> blocks of <location>. - Values:
is between,is in <list>,is empty,is alphanumeric,is a list,a location,an item,a date,an entity,a table,a player,is text. unless <condition>:, the opposite ofif.
Effects
- Creatures:
kill,damage <who> by <n>,push <who> upward / forward / towards <location>,make <who> say <text>,make <mob> target <who>,remove entity,remove all zombies within 20 blocks of ..., andset name of/set health offor a mob. - Players:
open workbench for,open enderchest for, and settablefly speed,walk speed,saturation,air,held slot,compass target,bed spawn,yawandpitch. - Tools:
damage tool of player by <n>,repair tool of player,enchant tool of player with <enchantment> <level>. - World:
strike lightning at(andstrike fake lightning at),create explosion at ... with power <n>(optionallywithout breaking blocks,with fire),fill from ... to ... with <block>,break block at,grow tree at,drop <item> at,set spawn of world, andset world border of world ... to <size> over <time>. - Flow:
wait until <condition> for at most <duration>,run <function>(...) in <duration>, andrepeat every <duration> for <duration>:.
Expressions
- Players:
ip of,locale of,first join date of,last seen of,time played of,bed location of,target block of,direction of,yaw of,pitch of,held slot of,saturation of,air of,fall distance of,fly speed of,walk speed of. - Places:
<location> offset by x, y, z,location above/below,location <n> blocks in front of <who>,midpoint between,highest block at,biome at,light level at. Coordinates can be written out at the end of asetline:set {spawn} to 0, 64, 0 in "world". - Lists:
first <n> of,last <n> of,numbers from <a> to <b>,count of <value> in,min of,max of. - Text:
capitalized,title case,uncoloured,word <n> of,<text> repeated <n> times, and exact colours with<#ff8800>. - Numbers:
pow(a, b),round(n, places),percent(part, whole),commas(n),ordinal(n),roman(n). - Server:
%server.worlds%,%server.operators%,%server.banned%,%server.whitelist%,%server.plugins%,%server.uptime%,%server.memory_used%,%server.memory_max%.
Functions and structures
- Default values for parameters:
function reward(_who, _amount = 10):. try:/on error:lets a script deal with a line that fails instead of stopping.loop 5 times with _i:gives the loop a counter.for each _name, _value in {table}:goes through a table's names and values together.- Commands:
players only: true,console only: true, and checked arguments such as<target:player>and<amount:number>, which answer with the usage line when they are missing or wrong. # Addons: HyperPermsin a script's notes refuses the file, with a clear message, on a server that does not have that addon.
Addons
- HyperPerms 1.0.0, a new addon for LuckPerms:
group of player,add player to group "vip" for 30 days,set group of player to "member",on group change:. See the Addons page.
Documentation website
- The home page shows how many events, conditions, effects, expressions and functions the language has; each number opens the Docs filtered to that kind.
- A Cheat sheet page with the most-used syntax on one screen.
- Three more scripts:
Chat.hs(format, mentions, slow mode, word filter),Duels.hs(challenges, score and a top list) andRankUp.hs(a rank ladder, for HyperPerms). - Scripts that need an addon say so on their card.
Not done from the plan
- No
any of/all of/none of;and,orandnotalready cover them. - Blocks are still their type as text rather than a value of their own.
- No
shield block,redstone change,piston move,entity mount,anvil use, villagertradeorplayer count changeevents. Some fire too often to be useful from a script, and the mount events moved between packages across Minecraft versions. - No books, toasts, biome setting, list
without,sorted byormap each, text padding, or cancelling a pendingrun. - The second addon, HyperGuard for WorldGuard, was not started.