Discuss Scratch
- Discussion Forums
- » Bugs and Glitches
- » Boolean bug
- 3sal2
-
Scratcher
100+ posts
Boolean bug
When a custom block with a boolean input is used, it will not respond to any changes in the plugged-in boolean condition's state.
- LoudHeadphones
-
Scratcher
100+ posts
Boolean bug
I know! It doesn't change what happens in the script based on the boolean if the change in the boolean happened during the block's run of its scripts. 
Dear ST, Please fix this bug soon, so that I can recreate the repeat until block.

Dear ST, Please fix this bug soon, so that I can recreate the repeat until block.
- Lucario621
-
Scratcher
100+ posts
Boolean bug
Do you think you could provide some more details about your bug? Is this just happening with a certain custom block you created, or is this happening to all of them? Could you maybe provide a script or a link to the project so we could see this bug happening? If the custom block you made just loops endlessly, then certainly possible that it was intended to not change its behavior if the input value changes, but I'm not sure.
- 3sal2
-
Scratcher
100+ posts
Boolean bug
It always happens for boolean inputs.
Try building these blocks:
Unfortunately, the BP does not recognize boolean input blocks in custom block scripts, except in the block-defining hat, so I colored them deep purple.
Try building these blocks:
define say (string1) until <boolean1>
say (string1)
wait until <boolean1 :: custom>
say []
define move while <boolean1>
forever
if <boolean1 :: custom>
move (10) steps
end
Unfortunately, the BP does not recognize boolean input blocks in custom block scripts, except in the block-defining hat, so I colored them deep purple.
- MegaApuTurkUltra
-
Scratcher
1000+ posts
Boolean bug
It always happens for boolean inputs.When you call a custom block, you are passing variables by value. This means the value of the variable is copied over to the parameter in the custom block, and changes to the original variable will not change the parameter. If you want to pass variables by reference, meaning changes to the original variable affect the parameter in the custom block you will need to implement some sort of workaround such as putting your variable in a list.
Try building these blocks:define say (string1) until <boolean1>
say (string1)
wait until <boolean1 :: custom>
say []
define move while <boolean1>
forever
if <boolean1 :: custom>
move (10) steps
end
Unfortunately, the BP does not recognize boolean input blocks in custom block scripts, except in the block-defining hat, so I colored them deep purple.
// pass-by-reference implementation
when gf clicked
delete (all v) of [refs v]
set [ref_index v] to (0)
define move while (ref)
repeat until <(item (ref) of [refs v])=[false]>
move (10) steps
end
define set ref (ref) to (value)
repeat until <not<(ref_index) < (ref)>>
add [] to [refs v]
change [ref_index v] by (1)
end
replace item (ref) of [refs v] with (value)
// example usage
when gf clicked
set ref (1) to [true]
move while (1)
when gf clicked
wait (5) secs
set ref (1) to [false]
// -------------------
when you read this::events hat
say [HTH]
- ItzIqopia2
-
Scratcher
18 posts
Boolean bug
It always happens for boolean inputs.
Try building these blocks:define say (string1) until <boolean1>
say (string1)
wait until <boolean1 :: custom>
say []
define move while <boolean1>
forever
if <boolean1 :: custom>
move (10) steps
end
Unfortunately, the BP does not recognize boolean input blocks in custom block scripts, except in the block-defining hat, so I colored them deep purple.
- Discussion Forums
- » Bugs and Glitches
-
» Boolean bug




