Terminal
Cocrea Terminal makes debugging easier
Why
Debugging in Scratch is ... CATASTROPHE🌋 , especially in these situations:
when a project contains many variables and lists.
when tracing the changes of a variable in a loop.
when multi-sprites driven by events.
Gandi Terminal is designed to solve these problems and make debugging easier.
Functions and Definition
Tracing
The following methods help you log variables or simply print a string to the Terminal.
Hide / Show Terminal
Hide or show the terminal window.
Log / Warn / Error
Using the method "log" to print a message in green color, "warn" in yellow color, and "error" in red color. For example, when you run the code above, the terminal will print message below.
Trace <a message> with Color
The method "trace" is similar to log, warn, and error. But you can choose the color.
Similar to the previous one, but it won't print <VALUE> more than once if <VALUE> is not changed.
For example, when you run code left, you will get the result shown in the right.

Clear
Clear the output in the Terminal.
Runloop Control
The following events or methods can be used to pause your application for debugging and monitoring the changes of variables.
When <a variable> Changed
The event will be dispatched when <variable> changed. For example:

When <a boolean> turns true from false
The event will be dispatched when a boolean expression turns TRUE from FALSE

Pause / Continue
Programmatically pause or continue the application runloop. It can be used to set a conditional breakpoint. For example, the following code will automatically pause the application when the variable score is less than 0.

Terminal Commands
The following commands can be used in the Terminal window. Before using it, you should run the command "show terminal".
help
show command help
clear
clear the terminal
? <name>
fuzzy search and print variables or lists named <name>
print variables with the name "player": ? player
??
print all variables and lists
h
shortcut for help
c
shortcut for clear
Best Practices
Scenario A: Tracing the changes of a variable in one algorithm.
As the screenshot is shown below, the left side shows a simple algorithm with a loop within another loop. This example demonstrates a situation where bugs might be easily made.
With Gandi Terminal, you can trace the changes of variables, as shown on the right, instead of guessing the value of variables or inserting a "wait" code to slow down the algorithm and watching the value of each variable.

Scenario B: Figure out the sequencing of the events while code reading
Code reading is one of the best ways to learn to code. However, when reading a complex project, for instance Among Us from TimMcCool, it is frustrating to figure out how functions are been called, and the sequencing of the events.
With Gandi Terminal, you can insert a trace block under each function and event. When functions are been called, or events are been dispatched, the Terminal will print a message to help you figure out the sequencing. As shown below.

Change Log
0.1
Added: 1. show/hide Terminal 2. log / warn / error 4. clear
0.2
Added: 1. trace 2. when variable changed 3. when <> turns true from false 4. pause and continue
0.3
Added: 1. Terminal commands Fixed: 1. a bug leads to code missing
Last updated