While writing a tutorial, I would like to include some “ghost” blocks (block that are not included in the tutorial) in the set of visible blocks.
I have this working, for example:
effects.confetti.startScreenEffect()
forever(function () {
})
pause(1000)
for (let index = 0; index < 5; index++) {
}
while (false) {
}
for (let value of list) {
}
break;
continue;
if (true) {
}
list = [0, 1]
text_list = ["a", "b", "c"]
The issue that I am having is how do you include blocks from “Math” or “logic” that are not a block by themselves, but go inside other blocks. Like:
1 + 1
true && true
true || false
I have been able to get part of the way to a solution.
If you include the partial blocks inside a full block, then they get included in the ghost list.
For example:
for (let index = 0; index < Math.min(Math.sqrt(4), randint(3, 10)) + 5 % Math.abs(2); index++) {
}
if (!(true && false)) {
} else if (0 == 0) {
} else if ("" == "") {
} else if (false) {
} else {
}
The issue now is for “primitive” blocks like “true”, “false” & “0”.
I still can not make them show up.
Even if you include them inside another block, I assume because they just show up as values in JavaScript, they are not being picked up.
From playing around, I do not think the primitive blocks are needed.
It seems they are just for connivance.
I have been able to create any math or boolean expression I want to create
You can get the boolean blocks to show up by assigning their value to a variable:
```ghost
let a = true
let b = "hello"
```
That should also work for most basic values except numbers, which are the default value for the variable block, so we remove them from the toolbox. I don’t think we have a way to get the standalone number block to appear in the toolbox, unfortunately.