Discuss Scratch
- Discussion Forums
- » Suggestions
- » Switch blocks (updated!) (formerly flag blocks)
- cookieclickerer33
-
Scratcher
1000+ posts
Switch blocks (updated!) (formerly flag blocks)
The switch block would be like lists but also like variables basically there would be this block
The hat block does not need to be implemented but it would be nice
http://scratchblocks.github.io/#?style=scratch3&script=when%20switch%20(my%20switch%20v)%20is%20%5Bon%20v%5D%20%3A%3A%20events%20hat%20%2F%2Fthis%20would%20activate%20when%20the%20switch%20turns%20true%0A%2F%2Fit%20would%20not%20activate%20again%20until%20the%20flag%20changes%20values%20and%20changes%20back%0A%0Aturn%20switch%20(my%20switch%20v)%20to%20%5Bon%20v%5D%20%3A%3A%20%230cc99a%20%0A%0A(value%20of%20switch%20(my%20switch%20v)%3A%3A%20%230cc99a%20)%20%2F%2Fthis%20would%20report%201%20or%200%20instead%20of%20true%20or%20false%0A%0A%3Cswitch%20(my%20switch%20v)%20value%20%20%3A%3A%20%230cc99a%20%3E%20%2F%2F%20this%20would%20report%20true%20or%20false%0A%0A%3Cswitch%20(my%20switch%20v)%20is%20(on%20v)%3A%3A%20%230cc99a%20%3E%20%2F%2Fthis%20would%20also%20report%20ture%20of%20false%2C%20but%20if%20a%20booleen%20is%0A%2F%2Fplaced%20in%20the%20second%20slot%2C%20it%20reports%20based%20on%20the%20value%20of%20that%20so%20for%20example%0A%0A%3Cswitch%20(my%20switch%20v)%20is%20((1)%20%2B%20(0))%20%3A%3A%20%230cc99a%20%2F%2F%20if%20my%20switch%20was%20true%20this%20would%20report%20true%0A%0A%3Cswitch%20(my%20switch%20v)%20is%20%3C(1)%20%3D%20(1)%3E%20%3A%3A%20%230cc99a%20%20%2F%2Fif%20my%20switch%20is%20true%20this%20would%20report%20true%0A%0A%0A
You would be able to name switches similar to variables
This idea comes from the flag nodon in game builder garage
basically this would act as a second variable type, this is a thing in multiple programming languages so I think it should be added
This is NOT a dupe of https://scratch.mit.edu/discuss/topic/20351/
As this suggest many more blocks and is more fleshed out
Old post:
It would be a drop down with 3 options
True, false, and toggle.
So instead of making 200 variables for true or false use flags!
This still applies ^
Some extra blocks
The hat block does not need to be implemented but it would be nice
http://scratchblocks.github.io/#?style=scratch3&script=when%20switch%20(my%20switch%20v)%20is%20%5Bon%20v%5D%20%3A%3A%20events%20hat%20%2F%2Fthis%20would%20activate%20when%20the%20switch%20turns%20true%0A%2F%2Fit%20would%20not%20activate%20again%20until%20the%20flag%20changes%20values%20and%20changes%20back%0A%0Aturn%20switch%20(my%20switch%20v)%20to%20%5Bon%20v%5D%20%3A%3A%20%230cc99a%20%0A%0A(value%20of%20switch%20(my%20switch%20v)%3A%3A%20%230cc99a%20)%20%2F%2Fthis%20would%20report%201%20or%200%20instead%20of%20true%20or%20false%0A%0A%3Cswitch%20(my%20switch%20v)%20value%20%20%3A%3A%20%230cc99a%20%3E%20%2F%2F%20this%20would%20report%20true%20or%20false%0A%0A%3Cswitch%20(my%20switch%20v)%20is%20(on%20v)%3A%3A%20%230cc99a%20%3E%20%2F%2Fthis%20would%20also%20report%20ture%20of%20false%2C%20but%20if%20a%20booleen%20is%0A%2F%2Fplaced%20in%20the%20second%20slot%2C%20it%20reports%20based%20on%20the%20value%20of%20that%20so%20for%20example%0A%0A%3Cswitch%20(my%20switch%20v)%20is%20((1)%20%2B%20(0))%20%3A%3A%20%230cc99a%20%2F%2F%20if%20my%20switch%20was%20true%20this%20would%20report%20true%0A%0A%3Cswitch%20(my%20switch%20v)%20is%20%3C(1)%20%3D%20(1)%3E%20%3A%3A%20%230cc99a%20%20%2F%2Fif%20my%20switch%20is%20true%20this%20would%20report%20true%0A%0A%0A
You would be able to name switches similar to variables
This idea comes from the flag nodon in game builder garage
basically this would act as a second variable type, this is a thing in multiple programming languages so I think it should be added
This is NOT a dupe of https://scratch.mit.edu/discuss/topic/20351/
As this suggest many more blocks and is more fleshed out
Old post:
(flag (1 v) :: #be58ccAnd also this block
set flag ( 1 v) to (true v) :: #be58cc
It would be a drop down with 3 options
True, false, and toggle.
So instead of making 200 variables for true or false use flags!
This still applies ^
Some extra blocks
when flag (1 v) is (true v):: #be58cc hat
<[value v] of flag ( 1 v)>:: #be58cc booleenThe drop down is value or true/false
Last edited by cookieclickerer33 (Dec. 7, 2022 14:25:32)
- WindowsMeRules2000
-
Scratcher
500+ posts
Switch blocks (updated!) (formerly flag blocks)
The flag block would be like lists but also like variables basically there would be this blockCouldn't you just use variables?((Value of flag (1 v))And also this blockset flag ( 1 v) to (true v)
It would be a drop down with 3 options
True, false, and toggle.
So instead of making 200 variables for true or false use flags!
Some extra blocks coming soon as well as colors
- CoconutGator
-
Scratcher
1000+ posts
Switch blocks (updated!) (formerly flag blocks)
So it's a variable with less uses?
- cookieclickerer33
-
Scratcher
1000+ posts
Switch blocks (updated!) (formerly flag blocks)
So it's a variable with less uses?Not exactly it’s like broadcasts but they stay on or off
- cookieclickerer33
-
Scratcher
1000+ posts
Switch blocks (updated!) (formerly flag blocks)
The entire point is to reduce variables because 90% of all my variables are for true or false.The flag block would be like lists but also like variables basically there would be this blockCouldn't you just use variables?((Value of flag (1 v))And also this blockset flag ( 1 v) to (true v)
It would be a drop down with 3 options
True, false, and toggle.
So instead of making 200 variables for true or false use flags!
Some extra blocks coming soon as well as colors
- -ErrorPurpl_157
-
Scratcher
100+ posts
Switch blocks (updated!) (formerly flag blocks)
when flag (… v) is true :: events hatsupport?
wait until <flag (… v) is (false v) :: list>
say (flag (… v) :: list) :: looks
- Little_Mittle12345
-
Scratcher
100+ posts
Switch blocks (updated!) (formerly flag blocks)
Duppe of boolean varianlbes
- randomguy3513
-
Scratcher
1000+ posts
Switch blocks (updated!) (formerly flag blocks)
Duppe of boolean varianlbesPlease link it then and that isn't a duplicate this is suggesting a hat block to go along with it.
- cookieclickerer33
-
Scratcher
1000+ posts
Switch blocks (updated!) (formerly flag blocks)
MockupThanks!
I was thinking more this however
http://scratchblocks.github.io/#?style=scratch3&script=when%20flag%20(1%20v)%20is%20%5Bon%20v%5D%20%3A%3A%20events%20hat%20%2F%2Fthis%20would%20activate%20when%20the%20flag%20turns%20true%2C%20and%20then%0A%2F%2Fit%20would%20not%20activate%20again%20until%20the%20flag%20changes%20values%20and%20changes%20back%0A%0Aturn%20flag%20(1%20v)%20to%20%5Bon%20v%5D%20%3A%3A%20%230cc99a%20%0A%0A(value%20of%20flag%20(1%20v)%3A%3A%20%230cc99a%20)%20%2F%2Fthis%20would%20report%201%20or%200%20instead%20of%20true%20or%20false%0A%0A%3Cflag%20(1%20v)%20value%20%3A%3A%20%230cc99a%20%3E%20%2F%2F%20this%20would%20report%20true%20or%20false%0A%0A%3Cflag%20(1%20v)%20is%20(on%20v)%3A%3A%20%230cc99a%20%3E%20%2F%2Fthis%20would%20also%20report%20ture%20of%20false%2C%20but%20if%20a%20booleen%20is%0A%2F%2Fplaced%20in%20the%20second%20slot%2C%20it%20reports%20based%20on%20the%20value%20of%20that%20so%20for%20example%0A%0A%3Cflag%20(1%20v)%20is%20((1)%20%2B%20(0))%20%3A%3A%20%230cc99a%20%2F%2F%20if%20flag%201%20was%20true%20this%20would%20report%20true%0A%0A%3Cflag%20(1%20v)%20is%20%3C(1)%20%3D%20(1)%3E%20%3A%3A%20%230cc99a%20%20%2F%2Fif%20flag%201%20is%20true%20this%20would%20report%20true%0A%0A%0A
Last edited by cookieclickerer33 (Dec. 2, 2022 13:07:48)
- Za-Chary
-
Scratcher
1000+ posts
Switch blocks (updated!) (formerly flag blocks)
I think it should be named something other than “flag” to prevent confusion with the existing “green flag” in the Scratch player.
- cookieclickerer33
-
Scratcher
1000+ posts
Switch blocks (updated!) (formerly flag blocks)
I think it should be named something other than “flag” to prevent confusion with the existing “green flag” in the Scratch player.Ok! I am having a little trouble with coming up with a name, and flag is the name for something like this in most programming languages
Maybe on off or toggle? That’s would look weird and interfere with the block options tho
Last edited by cookieclickerer33 (Dec. 2, 2022 13:40:17)
- WindowsMeRules2000
-
Scratcher
500+ posts
Switch blocks (updated!) (formerly flag blocks)
How about a switch? idkI think it should be named something other than “flag” to prevent confusion with the existing “green flag” in the Scratch player.Ok! I am having a little trouble with coming up with a name, and flag is the name for something like this in most programming languages
Maybe on off or toggle? That’s would look weird and interfere with the block options tho
- cookieclickerer33
-
Scratcher
1000+ posts
Switch blocks (updated!) (formerly flag blocks)
EhHow about a switch? idkI think it should be named something other than “flag” to prevent confusion with the existing “green flag” in the Scratch player.Ok! I am having a little trouble with coming up with a name, and flag is the name for something like this in most programming languages
Maybe on off or toggle? That’s would look weird and interfere with the block options tho
I still think flag is best
- cookieclickerer33
-
Scratcher
1000+ posts
Switch blocks (updated!) (formerly flag blocks)
I think it should be named something other than “flag” to prevent confusion with the existing “green flag” in the Scratch player.Another thing, green flag is not mentioned that much it’s always just
@greenFlag ::cap greyAnd not green flag
- medians
-
Scratcher
1000+ posts
Switch blocks (updated!) (formerly flag blocks)
I think they mean this topic: https://scratch.mit.edu/discuss/topic/8618/ since flags are another name for booleans, but I don’t think that’s what they’re suggesting.Duppe of boolean varianlbesPlease link it then and that isn't a duplicate this is suggesting a hat block to go along with it.
- cookieclickerer33
-
Scratcher
1000+ posts
Switch blocks (updated!) (formerly flag blocks)
Yes, this would be an entirely new system similar to variables but would not interfere with themI think they mean this topic: https://scratch.mit.edu/discuss/topic/8618/ since flags are another name for booleans, but I don’t think that’s what they’re suggesting.Duppe of boolean varianlbesPlease link it then and that isn't a duplicate this is suggesting a hat block to go along with it.
- 7salad3salad
-
Scratcher
1000+ posts
Switch blocks (updated!) (formerly flag blocks)
Tip: you can use ::extension to color blocks like an extension
- Discussion Forums
- » Suggestions
-
» Switch blocks (updated!) (formerly flag blocks)








