Here you will find out how to read this documentation, and what each symbol means.
| Symbol | Meaning | Aliases | Example |
|---|---|---|---|
| <int> | integer | 123 | |
| <num> | number | 1.23 | |
| <vec> | singular relative vector component | <x>,<y>,<z>,<pitch>,<yaw> | ~1.23 |
| <comparator> | > < == >= <= != | >= | |
| <identifier> | :direct_identifier OR #indirect_identifier | :diamond_sword | |
| <server-packet> | server packet | playerList | |
| <client-packet> | client packet | handSwing | |
| <input> | an input type | attack | |
| <aim-anchor> | aim anchor | head | |
| ... | literal | abc | |
| "..." | quoted literal | "a b c" | |
| \w+ | constant literal | ||
| (\w+|\w+|...) | constant literals | ||
| {} | command line or code block of command lines | say "Hello World" |
The argument is optional if a ? is appended at the end. Any argument symbol followed by a question mark will render said argument optional, meaning the script interpreter will not throw an error if it was absent.
A script command line is any instruction that'll tell your Minecraft client what to do. For example, a command line that tells your Minecraft client to say Hello World in chat would look like:
say "Hello World"
Here are some examples of command lines:
- As (as)
- Cancel Packet (cancel_packet)
- Chat (chat)
- Config (config)
- Damage (damage)
- Def (def)
- Define (define)
- Desc (desc)
- Description (description)
- Disconnect (disconnect)
- Drop (drop)
- Error (error)
- Execute (execute)
- Execute Period (execute_period)
- Execute Random (execute_random)
- Exit (exit)
- Func (func)
- Function (function)
- Gui Drop (gui_drop)
- Gui Quickmove (gui_quickmove)
- Gui Swap (gui_swap)
- Gui Switch (gui_switch)
- Hold Input (hold_input)
- If (if)
- If Not (if_not)
- Input (input)
- Interact (interact)
- Loop (loop)
- Loop Period (loop_period)
- Module (module)
- Notify (notify)
- On (on)
- Playsound (playsound)
- Print (print)
- Repeat (repeat)
- Repeat Period (repeat_period)
- Say (say)
- Send (send)
- Snap To (snap_to)
- Swap (swap)
- Switch (switch)
- Teleport (teleport)
- Throw (throw)
- Turn To (turn_to)
- Uncancel Packet (uncancel_packet)
- Velocity (velocity)
- Wait (wait)
- Wait Random (wait_random)
- While (while)
- While Not (while_not)
Normally, we would have 1 command line per, let's say, an if statement.
if holding :diamond say "I am holding a diamond"
The problem emerges when we try to execute more than 1 command line per if statement. In theory, we could just spam new lines like so:
if holding :diamond say "I am holding a diamond"
if holding :diamond say "Hello World"
if holding :diamond input jump
But this practice is redundant and may be seen as inefficient to our scripters. To solve this problem, you can have all of your command lines stored in between brackets, essentially telling the script interpreter that you want to execute all of these lines. Do note that each time a new pair of nest brackets appear, it is conventional to increase your indentation by 1.
if holding :diamond {
say "I am holding a diamond"
say "Hello World"
input jump
}
Nested indentation example:
if holding :diamond {
say "I am holding a diamond"
say "Hello World"
input jump
if off_holding :diamond {
say "My off hand is also holding a diamond"
}
}
Happy coding and cpvping!