HyperScript
Docs

← All of the Docs Data and the outside

Other plugins

expression%hyperscript_<name>%since 1.5.6

The global {<name>}

set {event_active} to true
# Any plugin that uses PlaceholderAPI can now show it:
# "Event running: %hyperscript_event_active%"
Try it
expression%hyperscript_player_<name>%since 1.5.6

The viewing player's own {%player%.<name>}

set {%player%.coins} to 100
# Any plugin that uses PlaceholderAPI can now show it to that player:
# "Coins: %hyperscript_player_coins%"
Try it
structureplaceholder "<name>":since 1.7.28

At the left margin of a script: a value worked out for whoever looks, shown by other plugins as %hyperscript_<name>%

placeholder "visits":
    return {%player%.joins}
Try it
Guide and examples

HyperScript works with two widely used plugins when they are installed. Neither is required.

Vault (money). With Vault and an economy plugin, balance of <who> is a player's money, and it can be changed like a variable:

if balance of player >= 500:
    subtract 500 from balance of player
    give player 1 diamond
add 100 to balance of arg.1
set balance of player to 0

PlaceholderAPI. With PlaceholderAPI, placeholder <text> fills in other plugins' placeholders:

set {_rank} to placeholder "%vault_rank%"
send placeholder "&7Your rank: %vault_rank% &8| &7Playtime: %statistic_time_played%"
set {_theirs} to placeholder "%player_level%" for arg.1

It also works the other way round. Any plugin that understands PlaceholderAPI can show script variables:

PlaceholderShows
%hyperscript_<name>%The global {<name>}
%hyperscript_player_<name>%The viewing player's own {%player%.<name>}
placeholder "<name>":At the left margin of a script: a value worked out for whoever looks, shown by other plugins as %hyperscript_<name>%
placeholder "rank_colour":
    if player has permission "rank.vip":
        return "&6"
    return "&7"

placeholder "coins_short":
    if {%player%.coins} >= 1000:
        set {_thousands} to round({%player%.coins} / 1000)
        return "%{_thousands}%k"
    return {%player%.coins}

A placeholder block is a function without anything handed to it. It runs each time another plugin asks, with player as the player the text is shown to, and what it returns is what is shown; colour codes work. A scoreboard or chat plugin may ask many times a second and not always from the server's own thread, so keep the block to reading values and working something out: no wait, and nothing that changes the world.

  • balance of and placeholder ... for take player or a name, and work for players who are offline. Without Vault and an economy plugin a balance is unset and cannot be changed; without PlaceholderAPI the text comes back unchanged. Either case is reported once in the console.
  • A balance never goes below zero: taking more than a player has leaves them with nothing.
  • Write another plugin's placeholders inside placeholder "..." only. In ordinary text HyperScript leaves an unknown %name% exactly as written.