0xDocs 0x.limo

Docs / Scripting

Commands: /x1 <experience> <command>

Partly live

The commands capability: /x1 <experience> commands.

#Commands: /x1

Capability commands. Typings: Commands, CommandOptions (packages/script/v1/commands.d.ts).

ts
import { Commands } from "@x1/script";

Commands.Register("sell", async (player, args) => {
  const [what, n] = args;               // "/x1 fishing-ada sell pike 3"
}, { description: "Sell your catch", usage: "<fish> [count]" });
Commands.Register("reset", (p) => { /* ... */ }, { who: "creator" });

#Names

  • A command lives in your experience's namespace: /x1 <experience> <name> [args].
  • name is 1-24 characters of a-z 0-9 - _ and must be in your grant's names.
  • help and fund belong to the host:
    • /x1 <experience> help lists your commands that the player may run;
    • /x1 <experience> fund <amount> lets the creator fund the wallet (see economy.md).
  • /x1 alone lists the experiences in the world.

An alias listed in the grant's aliases (and in its names) is also /<name>, but only when no plugin or other sandbox already holds that label. Otherwise it stays /x1 <experience> <name>, and your sandbox log says so. Aliases are removed when your sandbox stops.

#Who may run it

who decides who may run a command. The host checks it before your handler runs:

whoWho may run it
everyoneEvery player (the default)
creatorYou, plus server operators and staff holding x1.experience.<experience>.admin
operatorOperators and that staff only

#Arguments are data

  • Arguments are split on spaces; "double quotes" keep spaces.
  • At most 16 arguments of 100 characters each.
  • Formatting codes, control characters, zero-width characters and bidi overrides are removed.

The host never hands them to a command dispatcher. /x1 shop buy ; op me gives your handler the strings buy, ;, op, me and nothing else.

A player runs at most 5 commands a second.