Discuss Scratch

947___
Scratcher
39 posts

variables with checkboxes

this feature would be great for settings menus and stuff.

i thought of an idea for variables:
instead of 0 and 1, just a checkbox.

here are some images i made with inspect element:




and instead of just 0 and 1, you could set the values the variable sends when checked, or unchecked



ps: if ppl are wondering what the variable returns in the editor, it's whatever you set it for
for example, 0 and 1

pps: the blocks are like
set [ v] to (0 v)
change [ v] by (0)

ppps: it goes unchecked when it's neither of the set values

Last edited by 947___ (Aug. 4, 2023 13:31:25)

Fun_Cupcake_i81
Scratcher
1000+ posts

variables with checkboxes

This would be a cool feature to have, and it probably wouldn't be too hard to implement, so I support. Plus, it would make debugging stuff easier.
wikibro300000
Scratcher
1000+ posts

variables with checkboxes

Support, would be useful for settings and easier than making an entire different sprite
josueart
Scratcher
500+ posts

variables with checkboxes

Support, although you can workaround it with a slider.
wikibro300000
Scratcher
1000+ posts

variables with checkboxes

josueart wrote:

Support, although you can workaround it with a slider.
Checkbox looks better
josueart
Scratcher
500+ posts

variables with checkboxes

wikibro300000 wrote:

Checkbox looks better
Yeah
NotK3ndricAlt
Scratcher
1000+ posts

variables with checkboxes

No support. Workaround:
set [var v] to [no]

set [var v] to [yes]
deweypointjr
Scratcher
100+ posts

variables with checkboxes

Support. I have had trouble making settings menus in the past. This would be really useful for that.
wikibro300000
Scratcher
1000+ posts

variables with checkboxes

NotK3ndricAlt wrote:

No support. Workaround:
set [var v] to [no]

set [var v] to [yes]
First you would need to make a sprite and make the code and the more sprites the more confusing the coding is
medians
Scratcher
1000+ posts

variables with checkboxes

You could also do something like this probably:
when this sprite clicked
if <(var) = [no]> then
set [var v] to [yes]
else
set [var v] to [no]
end
Also, maybe this could be done through boolean variables somehow if those are implemented?
947___
Scratcher
39 posts

variables with checkboxes

medians wrote:

You could also do something like this probably:
when this sprite clicked
if <(var) = [no]> then
set [var v] to [yes]
else
set [var v] to [no]
end
Also, maybe this could be done through boolean variables somehow if those are implemented?
yes, i use that alot
Boss_1s
Scratcher
100+ posts

variables with checkboxes

support, even though you can use the slider as a workaround, it doesn't look good.
wikibro300000
Scratcher
1000+ posts

variables with checkboxes

medians wrote:

You could also do something like this probably:
when this sprite clicked
if <(var) = [no]> then
set [var v] to [yes]
else
set [var v] to [no]
end
Also, maybe this could be done through boolean variables somehow if those are implemented?

wikibro300000 wrote:

First you would need to make a sprite and make the code and the more sprites the more confusing the coding is
mumu245
Scratcher
1000+ posts

variables with checkboxes

The default values should be 0 and 1.
947___
Scratcher
39 posts

variables with checkboxes

mumu245 wrote:

The default values should be 0 and 1.
yeah
qwertycodechamp90411
Scratcher
100+ posts

variables with checkboxes

Support! This would make settings way easier.

The only thing I have to add is that I believe it should be a boolean-variable.
<checkbox checked?::variables>
If it stays a reporter, at least add a pop-up menu similar to the cloud variable message.
'Please note, the variable will report 1 when checked, and 0 when unchecked. You can change these values by right-clicking the variable on-stage'.

I would say make it true/false, not 0/1 for new scratchers, but that would be way too inconvenient (for me, at least).
In a script:
if <checkbox checked?::variables> then 
set [difficulty v] to (1)


else
set [difficulty v] to (0)
end

Last edited by qwertycodechamp90411 (Aug. 4, 2023 21:33:01)

947___
Scratcher
39 posts

variables with checkboxes

qwertycodechamp90411 wrote:

Support! This would make settings way easier.

The only thing I have to add is that I believe it should be a boolean-variable.
<checkbox checked?::variables>
If it stays a reporter, at least add a pop-up menu similar to the cloud variable message.
'Please note, the variable will report 1 when checked, and 0 when unchecked. You can change these values by right-clicking the variable on-stage'.

I would say make it true/false, not 0/1 for new scratchers, but that would be way too inconvenient (for me, at least).
In a script:
if <checkbox checked?::variables> then 
set [difficulty v] to (1)


else
set [difficulty v] to (0)
end
<checkbox [ v] checked? :: variables>
is what you mean

Last edited by 947___ (Aug. 4, 2023 21:38:30)

qwertycodechamp90411
Scratcher
100+ posts

variables with checkboxes

947___ wrote:

qwertycodechamp90411 wrote:

Support! This would make settings way easier.

The only thing I have to add is that I believe it should be a boolean-variable.
<checkbox checked?::variables>
If it stays a reporter, at least add a pop-up menu similar to the cloud variable message.
'Please note, the variable will report 1 when checked, and 0 when unchecked. You can change these values by right-clicking the variable on-stage'.

I would say make it true/false, not 0/1 for new scratchers, but that would be way too inconvenient (for me, at least).
In a script:
if <checkbox checked?::variables> then 
set [difficulty v] to (1)


else
set [difficulty v] to (0)
end
<checkbox [ v] checked? :: variables>
is what you mean
No I meant that the variable name was checkbox lol.

Honestly that's better.
xnousnow
Scratcher
9 posts

variables with checkboxes

Yeah, we def need a boolean variable, it's pain to make all the variables
set [boolean variable v] to [0]
set [boolean variable v] to [1]

if <(boolean variable) = (0)> then
say [it's false]
end
It would change to:
set [boolean variable v] to <false>
set [boolean variable v] to <true>

if <not<boolean variable>> then
say [it's false]
end
Also, that way, <true>/<false> value should be made.
947___
Scratcher
39 posts

variables with checkboxes

xnousnow wrote:

Yeah, we def need a boolean variable, it's pain to make all the variables
set [boolean variable v] to [0]
set [boolean variable v] to [1]

if <(boolean variable) = (0)> then
say [it's false]
end
It would change to:
set [boolean variable v] to <false>
set [boolean variable v] to <true>

if <not<boolean variable>> then
say [it's false]
end
Also, that way, <true>/<false> value should be made.

qwertycodechamp90411 wrote:

Support! This would make settings way easier.

The only thing I have to add is that I believe it should be a boolean-variable.
<checkbox checked?::variables>
If it stays a reporter, at least add a pop-up menu similar to the cloud variable message.
'Please note, the variable will report 1 when checked, and 0 when unchecked. You can change these values by right-clicking the variable on-stage'.

I would say make it true/false, not 0/1 for new scratchers, but that would be way too inconvenient (for me, at least).
In a script:
if <checkbox checked?::variables> then 
set [difficulty v] to (1)


else
set [difficulty v] to (0)
end
it could just be
<(my variable) = (1)>
but maybe once we get custom reporters and booleans
define () // pretend there's no block shape there
return (value::custom)::custom

define <>
return (value::custom)::custom

Last edited by 947___ (Aug. 5, 2023 01:24:16)

Powered by DjangoBB