Getting Started

What is CommandStudio?

CommandStudio is a code editor with a compilation engine that translates code into command blocks. These blocks are imported into Minecraft via a one-command.
CommandStudio also offers a lot of convenient tools that make writing commands a lot less simpler. All these features are explained in this manual.

Commands

CommandStudio works with code, each line of this code represents a command. Once compiled, a one-command is generated. When imported in Minecraft, all the commands are executed.

Example

Code
say hello say world summon Zombie ~2 ~-3 ~
Demo

Command blocks

CommandStudio also can generate command blocks. The chain keyword is used to specify to the compiler that the following lines represent a chain of command blocks. This chain will be placed at the position specified with its declaration.
Each line of a chain section represents a command block.

Example

Code
chain ~2 ~ ~: say hello say world summon Zombie ~2 ~-3 ~
Demo

Reference

Command block attributes

By default, all command blocks will be chained command blocks and will be in the always active mode. Inserting attributes at the beginning of a line will change the current command block attributes. Those attributes can be combined.

List of available attributes:

Attribute Effect
i Impulse command block
r Repeating command block
c Chain command block
0 Needs redstone
1 Always active
? Conditionnal
! Not unconditionnal

Example

Code
chain ~2 ~ ~: i0:say I'm an impulse command block and I need redstone ?:say I'm a chain command block and I'm conditional r:say I'm a repeating command block and I'm always active
Output
say I'm an impulse command block and I need redstone
say I'm a chain command block and I'm conditional
say I'm a repeating command block and I'm always active

Orienting chains

A command block chain will be orientated in the direction that follows its position. If no direction is specified, the command block chain will be vertical (+y).

Example

Code
chain ~2 ~ ~, +x: say hello say world chain ~ ~ ~-2, -z: say I love say Minecraft
Demo

Commands on multiple lines

If you write very long commands you might want to split them on multiple lines. You can do it by adding spaces at the beginning of lines you want to join.

Code
execute @r ~ ~ ~ setblock minecraft:chest 0 replace {Items:[{id:"minecraft:potato",Count:2}]}
Output
execute @r ~ ~ ~ setblock minecraft:chest 0 replace {Items:[{id:"minecraft:potato",Count:2}]}

By default, a space is inserted between joined lines. To avoid this behavior, start your line with a +.

Code
say joined +lines
Output
say joinedlines

Math operations

Operation placed between ( and ) will be evaluated. The parentheses will be replaced by the result of this operation. Supported operators are +, -, *, / and %.

Code
say I have (50+35) friends say (269/4) say ( ( 1337 + 4 ) / ( 1 + 2 ) )
Output
say I have 85 friends
say 67.25
say 447

It also is possible to perform operations on set of numbers (e. g. coordinates). To group numbers together, wrap them between two |.

Code
summon ( |137 65 -128| + |50 0 50| ) zombie summon ( |50 50 50| / 5 ) creeper
Output
summon 187 65 -78 zombie
summon 10 10 10 creeper

Variables

Variables allow us to save data and re-use them later. They are declared with the var keyword. A variable name begins by a $.

Code
var $entity = zombie var $coordinates = 50 50 50 summon $entity $coordinates $coordinates = ( $coordinates + |10 10 10| ) summon $entity $coordinates
Output
summon zombie 50 50 50
summon zombie 60 60 60

Procedures

A procedure will let you re-use one or more commands. You can define procedures using the def keyword. All procedures name must be preceded by a ^.

Code
def ^inline_def( $y ): // a def can receive parameters 50 $y 70 def ^multiple_lines( $e ; $block = stone ): // a default value can be set i0:execute $e ~ ~ ~ setblock ~ ~ ~ $block kill $e chain 50 50 50: ^multiple_lines( @e[type=Bat] ; tnt ) // separate arguments using a ; tp @p ^inline_def( 37 )
Output
execute @e[type=Bat] ~ ~ ~ setblock ~ ~ ~ tnt
kill @e[type=Bat]
tp @p 50 37 70

Native procedures

CommandStudio comes with a set of predifined procedures. Those procedures allow you to perform special operations.

Available procedures

Code
^pos_current() // Outputs the current command block position (if relative, relative to // the summoner command block) ^pos_abs( $position ) // Outputs a new position from $position, which is relative to the // summoner command block instead of the current block ^min( $n1 ; $n2 ; $n3 ; ... ) // Outputs the smaller given number ^max( $n1 ; $n2 ; $n3 ; ... ) // Outputs the larger given number ^round( $n ; $precision ) // Round the number $n and keep $precision decimals ^abs( $n ) // Gives the absolute value of $n ^pow( $n ; $power ) // Gives the $n power $power ^sin( $n ; $precision ) // Gives the sinus of $n and keep $precision decimals ^cos( $n ; $precision ) // Gives the cosinus of $n and keep $precision decimals

Auto /stats

You can tell the compiler to use the Minecraft command /stats on a certain command block. To do so, place the operator => in the line following the target command block. The syntax is the same as the original command.
You can even append an init value to set the score at importation time.

Code
chain ~2 ~ ~: i0:testfor @e[type=zombie] => SuccessCount playerName objective // with an init value time query daytime => QueryResult playerName objective 0
Output
testfor @e[type=zombie]
stats ~2 ~ ~ block set SuccessCount playerName objective
time query daytime
stats ~2 ~1 ~ block set QueryResult playerName objective
scoreboard players set playerName objective 0

Marker keyword

The marker keyword will tell the compiler to summon an entity at the position of the following command block. It is possible to summon more than one marker entity per block.

Code
chain ~2 ~ ~: marker armor_stand {CustomName:"label",CustomNameVisible:1,NoGravity:1b} i0:say hi!
Output
say hi!
summon armor_stand ~2 ~ ~ {CustomName:"label",CustomNameVisible:1,NoGravity:1b}

Warning:
Marker entities are summoned at each importation. Consider placing a /kill at the top of your code which targets older marker entities, otherwise they will stack!

Inverting success

The invert keyword place a command block which its success is the opposite of the previous command block.

Code
chain ~2 ~ ~: i0:testfor @e[type=cow] invert ?:say there is no cow
Output
testfor @e[type=cow]
testforblock ~ ~-1 ~ command_block -1 {SuccessCount:0}
say there is no cow

Void keyword

The void keyword allows you to leave an empty space instead of a command block.

Code
chain ~2 ~ ~: say ^pos_current() void say ^pos_current()
Output
say ~2 ~ ~
say ~2 ~2 ~

Nesting your code

Placing a : at the end of a command or a command block allows you to indent the following lines without merging them. It has no incidence on the final commands/command blocks, it is only here to help you organizing your code.

Code
chain ~2 ~ ~: i0:testfor @p[tag=lost]: ?:say You lost ?:kill @p[tag=lost] say Thank you for playing
Output
testfor @p[tag=lost]
say You lost
kill @p[tag=lost]
say Thank you for playing

Escaping

You can prevent characters from being interpreted. To do it, insert a ` before it.

Code
var $var = cool say the $var`est say `$var say http:`//www.youtube.com `def ok
Output
say the coolest
say $var
say http://www.youtube.com
def ok

Commenting

You can add comments to your file using the // syntax. Every characters following this symbol will be ignored. You can also use /* to begin a multi-line comment and */ to end it.

Code
say hello /*multi line comment!*/ say goodbye // very important command
Output
say hello
say goodbye

Including other files

You can import other files into a compiling file using the include keyword.

Code
// other_file say Hey! def ^hello($what): say Hello, $what! // compiled_file include other_file ^hello(world)
Output
Hey!
say Hello, world!

Example

Code
chain ~2 ~ ~: say hello say world summon Zombie ~2 ~-3 ~
Demo

Interface

Keyboard shortcuts

Available keyboard shortcuts:

Shortcut Effect
Ctrl+Space Trigger auto-completion
Ctrl+Q Compile
Ctrl+S Export project
Ctrl+D Select next occurence

CommandStudio as a desktop application

If you are using Chrome you can create an app-like shortcut to open CommandStudio in its own window, just like a regular application. To do this, first go on CommandStudio. Click the menu button at the top-right corner of the Chrome window, then click "More tools", and select "Add to taskbar". Tick "Open as window" and then click "Add".

Using older versions

If you want to use an older version of CommmandStudio, you can download it on your computer from this page. Then extract the archive and open index.html.