Skip to content

Latest commit

 

History

History
129 lines (114 loc) · 5.93 KB

File metadata and controls

129 lines (114 loc) · 5.93 KB

Documentation Legend

Here you will find out how to read this documentation, and what each symbol means.

Legend Table

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"

Optional Argument Symbols

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.

What is a Command Line?

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:

What is a Code Block?

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!