HyperScript
Docs

← All of the Docs Players

Parties and queues

expressioninvite <who> to partysince 1.7.17

The player invites someone. Whoever invites without a party becomes the leader of a new one when the first invitation is accepted. An invitation stands for a minute

command /invite <player>:
    players only: true
    trigger:
        invite arg.1 to party
        send "&7%player% invites you to a party." to arg.1
Try it
expressionaccept party invite / decline party invitesince 1.7.17

The player answers the newest invitation they have; add from <who> to answer a particular one

command /accept:
    players only: true
    trigger:
        accept party invite
        if player is in a party:
            send "&a%player% joined." to party of player
Try it
expressionleave partysince 1.7.17

The player leaves. If they led it, whoever joined after them leads; a party of one is no party

command /leaveparty:
    players only: true
    trigger:
        leave party
        send "&7You left the party."
Try it
effectremove <who> from partysince 1.7.17

The leader takes someone out

command /partykick <player>:
    players only: true
    trigger:
        remove arg.1 from party
Try it
expressiondisband partysince 1.7.17

The leader ends it

command /disbandparty:
    players only: true
    trigger:
        send "&cThe party was ended." to party of player
        disband party
Try it
expressionparty of <who>since 1.7.17

A list of the names of everyone in their party, the leader first; empty for someone without one. It can be sent to: send "..." to party of player reaches every member who is online

on chat:
    if message starts with "!":
        cancel event
        send "&d[Party] &f%player%: %message%" to party of player
Try it
expressionparty leader of <who>since 1.7.17

The leader's name; unset without a party

command /leader:
    trigger:
        if player is in a party:
            send "&7Your party is led by &f" + party leader of player
Try it
expressionparty invites of <who>since 1.7.17

The names of those who have invited them

command /invites:
    trigger:
        send "&7Invited by: &f" + party invites of player
Try it
condition<who> is in a partysince 1.7.17

A condition; is not in a party likewise

on hit:
    if attacker is in a party:
        if party of attacker contains victim:
            cancel event
Try it
structureon queue <name> of <n>:since 1.7.17

At the left margin: runs each time n players are waiting. They are taken out of the queue and handed over as the list {_players}, first come first

on queue "duels" of 2:
    for each {_name} in {_players}:
        send "&aA match was found!" to {_name}
Try it
effectadd <who> to queue <name>since 1.7.17

Put someone in the line; nothing happens if they are in it already

command /duel:
    players only: true
    trigger:
        add player to queue "duels"
        send "&7Waiting for an opponent..."
Try it
effectremove <who> from queue <name>since 1.7.17

Take them out. remove <who> from all queues for every queue at once

command /leavequeue:
    players only: true
    trigger:
        remove player from all queues
        send "&7You are no longer waiting."
Try it
expressionqueue <name>since 1.7.17

A list of the names of those waiting

command /waiting:
    trigger:
        send "&7In line: &f" + size of queue "duels"
Try it
condition<who> is in queue <name>since 1.7.17

A condition

command /duel2:
    players only: true
    trigger:
        if player is in queue "duels":
            send "&cYou are already waiting."
            stop
        add player to queue "duels"
Try it
Guide and examples

A party is a group of players with a leader. HyperScript keeps track of who is in which; what being in one means (a shared chat, teleporting together, friendly fire) is up to your scripts.

command /party <invite|accept|leave> [player]:
    players only: true
    trigger:
        if arg.1 is "invite":
            invite arg.2 to party
            send "&7%player% invites you to a party. &f/party accept" to arg.2
        else if arg.1 is "accept":
            accept party invite
            send "&a%player% joined the party." to party of player
        else:
            leave party
SyntaxMeaning
invite <who> to partyThe player invites someone. Whoever invites without a party becomes the leader of a new one when the first invitation is accepted. An invitation stands for a minute
accept party invite / decline party inviteThe player answers the newest invitation they have; add from <who> to answer a particular one
leave partyThe player leaves. If they led it, whoever joined after them leads; a party of one is no party
remove <who> from partyThe leader takes someone out
disband partyThe leader ends it
party of <who>A list of the names of everyone in their party, the leader first; empty for someone without one. It can be sent to: send "..." to party of player reaches every member who is online
party leader of <who>The leader's name; unset without a party
party invites of <who>The names of those who have invited them
<who> is in a partyA condition; is not in a party likewise

A queue collects players until there are enough, and then runs a block with them:

on queue "duels" of 2:
    set {_a} to item 1 of {_players}
    set {_b} to item 2 of {_players}
    broadcast "&6%{_a}% &7fights &6%{_b}%&7!"

command /duel:
    players only: true
    trigger:
        add player to queue "duels"
        send "&7Waiting for an opponent..."
SyntaxMeaning
on queue <name> of <n>:At the left margin: runs each time n players are waiting. They are taken out of the queue and handed over as the list {_players}, first come first
add <who> to queue <name>Put someone in the line; nothing happens if they are in it already
remove <who> from queue <name>Take them out. remove <who> from all queues for every queue at once
queue <name>A list of the names of those waiting
<who> is in queue <name>A condition
  • Parties and queues last while the server runs. A player who leaves the server leaves their party and every queue.
  • A queue's block runs as the console, since it is about several players: say who a line is for (send "..." to {_a}, or loop over {_players}).