Start hereStart here

Test your creation

Use the Sugar editor and Sandbox Mode to try an Item action or Boop safely before publishing it.

Item actions and Boops have a Run button. It opens Sandbox Mode, where you can try your creation without sending a message or changing anything real.

Use it often. Testing one small change is much easier than finding a mistake after writing an entire game.

Choose the test values

Before each run, you can:

  • Name the participants
  • Add or remove participants within the Boop or action’s limits
  • Change the values of its variables
  • Provide a sample Item when your creation asks for one
  • Set a sample Lore balance when your code uses Lore

Then press Run to see the result.

What the test shows

Sandbox Mode shows the same kinds of results someone can see on JOI, including text, chips, images, videos, embeds, dice, and changed variable values.

If your code would use an inventory Item, change an Item, or move Lore, the sandbox shows what would happen without doing it.

Nothing is saved

A test never:

  • Sends a message or post
  • Saves changes to a Memory variable
  • Uses an inventory Item
  • Changes a real Item
  • Spends, transfers, or rewards Lore

You can safely try every branch of your creation.

Write comfortably

Use the fullscreen button when you need more room. Multiline editors show line numbers, and Tab inserts two spaces so you can keep longer code readable. When the cursor is inside the indentation at the beginning of a line, Ctrl + Backspace removes all indentation to its left. Elsewhere, it keeps its normal word-deletion behavior. On mobile, the toolbar stays near the keyboard.

The toolbar can also insert variables and common Sugar pieces available in the field you are editing. Later lessons introduce those pieces one at a time.

When Sugar finds a mistake

Read the first specific name in the error. It will often point to a variable, function, media name, or missing part of the code.

Common fixes are:

  • Check the capitalization of a name
  • Close every (, {, and quotation mark
  • Put commas between function options
  • Add a semicolon between instructions in a longer program
  • Put every statement-form if, else if, and else body inside matching braces

Later lessons explain each of these marks when you first need it.