close
Options
Projects
Show All
Save as New Project
All Projects
Reference Guide
Feature Reference:
Basic use
How to use this tool:

This generator allows you to easily create complex command block mechanics using a programming-like syntax, making many different types of logic, effects, and control flow easier to create!

A good first step towards understanding how to use this tool effectively would be to check out the list of example projects below! Each one is filled with comments, helping you understand why each line is important.

Variables
How to use variables:

There are 2 different types of variables that you can define and use in your code. The type of variable that you use will affect they way that they are compiled and react to changes!

Hard-coded variables:

The first type of variable is a hard-coded variable. This type of variable cannot be changed during "run-time" (in-game). These are mostly useful for values that are used often throughout your code, but that you may need to change periodically. Hard-coded variables can hold any value, such as a string or number. If a hard-coded variable is set equal to a command, then it will hold the coordinates of the command block that is generated for the command.

$displayText = "This is some text"
say $displayText

Dynamic variables:

The second type of variable is a dynamic variable. This type of variable can be changed during "run-time" (in-game). This type of variable holds integer values, and can be used in math operations.

$_result = $_first + 6
tellraw @a ["The result is ", $_result]

Dynamic variables can be used in if-statements, function calls, and built-in functions as well.

if ($_scoretest > 10 and $_scoretest < 20) {
     say The variable is bigger than 10 but less than 20
}
User-declared Functions
How to define functions:

A function allows you to reuse a block of code as many times as you need. A function can be declared with arguments to allow information to be passed and used inside it when it is called.

function exampleFunction() {
    say I am a simple function
}

repeat 10 times {
    exampleFunction()
}

To declare a function that takes arguments when called, list them inside the parentheses separated by commas.

function tellMessage($player, $message) {
    tellraw $player ["The message is: ", "$message"]
}

repeat 10 times {
    tellMessage(@a, "I am spamming your chat")
}
Using the "instant" keyword:

The instant keyword makes a function call run exactly on the line it is called from in-game, instead of running at the end of the current tick. Though this may be necessary for certain things, it is recommended to not use this when it is not needed, as it will cause slightly more lag than a non-instant call if you have called it many times in your code. In addition to making function calls run instantly, you can make a conditional repeating block of code run instantly with the instant keyword. If it were not instant, then the code would run a tick after the condition is found to be true (same with the "else" block if there is one).

instant repeat (@a[m=1]) {
    instant sayWords("Someone is in creative mode!")
} else {
    say Nobody is in creative mode.
}

function sayWords($text) {
    say $text
}
Built-in Functions
What are built-in functions?

Built-in functions allow you to do certain tasks and calculations easily, such as sine, cosine, random number generators, doing something where the player is looking, and moving one entity towards or away from another.

Sine and cosine:

These trignomic functions allow you to easily implement useful sine/cosine waves in your code. The angle you pass to these must be in degrees.
Tip: If you must use multiple sines and/or cosines in the same line of code, pass the same variable as the argument into all of them to minimize the amount of lag in-game! Each new variable that is passed on a new line forces the amount of generated code to increase exponentially.

$_test = 0
repeat main {
    execute @a ~ ~2 ~ particle flame ~$sin($_test) ~$sin($_test) ~$cos($_test) 0 0 0 0.001 1

    $_test += 8
}
Random number generators:

The random built-in function returns a random integer each time it is called. This integer will always be between the min and max values that you pass to it.

say $random(0, 10)

You can use this value in scoreboard commands to make it useful in mechanics.

repeat main {
    scoreboard players set @p test $random(0, 10)
}
Do something where the player is looking:

Do you need to spawn an entity, create a particle effect, or do anything else at the location a player or entity is looking at? Use the facingDirection or facingPoint built-in functions! facingDirection only checks the player or entity's horizontal rotation, while facingPoint takes the vertical rotation into account as well.

The arguments for facingDirection and facingPoint are in the order as follows:
distance, x-offset, y-offset, z-offset, degreeOffset, overrideAccuracy

repeat main {
    particle flame $facingDirection(1, 0, 1, 0) 0 0 0 0.1
}
repeat main {
    particle flame $facingPoint(1, 0, 1, 0) 0 0 0 0.1
}
Move an entity/player towards or away from another:

You can move one player or entity towards another by using the moveToward built-in function. The arguments for this function are in the order as follows (? = optional):
movingEntity, targetEntity, ?speed, ?walkUpBlocks, ?minDistance, ?useTp, ?flySpeed, ?overrideAccuracy

The rotation accuracy of these can be set in your options, by changing the Sine/Cosine accuracy. Decrease the accuracy to reduce the number of generated command blocks, making it less laggy but also making the movingEntity's movement more jagged.

repeat main {
    $moveToward(@e[type=Villager], @a, 0.3, true, 2)
}

The opposite of the moveToward function is moveAway. The arguments for it are as follows:
movingEntity, awayFromEntity, ?speed, ?walkUpBlocks, ?maxDistance, ?useTp, ?flySpeed, ?overrideAccuracy

repeat main {
    $moveAway(@e[type=Chicken], @a, 0.25, true, 12)
}
If Statements
How to create an if statement:

If statements run one block of code if the condition is found to be true, and another one if it is not.

if ($_scoretest > 10) {
    say The variable is bigger than 10
}

To run a block of code when the if statement's condition is found to be false, use the else keyword.

if ($_scoretest > 10 and $_scoretest < 20) {
    say The variable is bigger than 10 but less than 20
} else {
    say The variable did not fit the condition
}
Repeating and delayed sections
How to make code repeat continuously:

To make a certain chunk of code repeat until stopped with the stop keyword, you can create a repeating section of code.

repeat main {
    say This will spam your chat!
}

The word main in the code snippet above can be changed to any word that you want to use as the name of the repeating section. This name must be unique from any other repeating section since it will be used when you want to start or stop the repeating section.

stop main

delay 100 {
    start main
}
Make code run after a certain amount of time:

The delay keyword makes a chunk of code run after a certain number of ticks. (1 tick = 1/20th of a second)

delay 45 {
    say It has been 2.5 seconds
}

Any code after the closing bracket of the delay block will not be delayed; it will run normally.

Example Projects: (Save your current project first!)
Multiple Commands Generated
Example Projects