Discuss Scratch
- jmb1293634
-
100+ posts
when variable changes
sorry if this was a duplicate I did check hard I checked the directory and 100 pages of the suggestions forum so here it is:
when [ v] changes::variables hatso if the selected variable changes then it starts a script under it could also be:
[ v] changing?::variables booleancloverfly also suggested
wait until [ v] changes::variables stackand
repeat until [ v] changes{
}::variables
Last edited by jmb1293634 (Jan. 20, 2025 17:23:18)
- YtArie5
-
1000+ posts
when variable changes
A workaround DOES exist but it's a but annoying
wait until <not <(foo) = [something]>>
...
- cloverfly
-
100+ posts
when variable changes
[variable v] changing?::variables booleanseems rather ambiguous. would it be true on like, the frame the variable changes?
- jmb1293634
-
100+ posts
when variable changes
yes but generally the hat is better so if I had the choice I would use that[variable v] changing?::variables booleanseems rather ambiguous. would it be true on like, the frame the variable changes?
- cloverfly
-
100+ posts
when variable changes
when [variable v] changes::variables hatis cool
I think it should be events:
when [variable v] changes::events hat
there should also be
wait until (variable v) changes :: controland
repeat until (variable v) changes {
} :: control
- jmb1293634
-
100+ posts
when variable changes
added to main suggestionwhen [variable v] changes::variables hatis cool
I think it should be events:when [variable v] changes::events hat
there should also bewait until (variable v) changes :: controlandrepeat until (variable v) changes {
} :: control
- greenrid
-
40 posts
when variable changes
I support!
However, the
Boolean block could be turned into this to make a little more sense:
This way, it would be easier to tell what it means!
However, the
<[variable v] changing?::variables>
Boolean block could be turned into this to make a little more sense:
<When [variable v] changes::variables>
This way, it would be easier to tell what it means!
- cake__5
-
100+ posts
when variable changes
here is the workaround
set [temp v] to (a)
wait until <not <(temp) = (a)>>
your code here::#0000ff
- BigNate469
-
1000+ posts
when variable changes
But that hangs the thread (prevents code later on from executing until the variable changes). here is the workaroundset [temp v] to (a)
wait until <not <(temp) = (a)>>
your code here::#0000ff
A better workaround would be:
foreverOr, alternatively:
if <not<(previous value) = (variable)>> then
broadcast [variable has changed v]
end
set [previous value v] to (variable)
... // other code
end
when I receive [variable has changed v]
... // code for when variable changes here
when [timer v] > ((timer) + <not <(previous value) = (variable)>>)
set [previous value v] to (variable)
... // code for when variable changes here
Last edited by BigNate469 (Jan. 21, 2025 15:18:57)
- TheGreatestGoofy
-
27 posts
when variable changes
nice, but mentioned above, there are workarounds
buhmppp
buhmppp
Last edited by TheGreatestGoofy (Jan. 24, 2025 19:04:45)
- AHypnoman
-
1000+ posts
when variable changes
Please tell us why you support - asserting support, or lack-thereof, doesn't contribute to the discussion - the forums are not for polling. Support! High five!