Discuss Scratch
- Discussion Forums
- » Suggestions
- » when variable changes
- jmb1293634
-
Scratcher
1000+ 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{
}::variablesacohen_bhused also suggestedif [variable v] changes{
}::variablescloverfly also suggestedif [variable v] changing{
}else{
}::variablesnote: all the last ones would be very easy to workaround with[ v] changing?::variables booleanso I don't really care about those
Last edited by jmb1293634 (May 1, 2025 15:36:00)
- YtArie5
-
Scratcher
1000+ posts
when variable changes
A workaround DOES exist but it's a but annoying
wait until <not <(foo) = [something]>>
...
- cloverfly
-
Scratcher
500+ posts
when variable changes
[variable v] changing?::variables booleanseems rather ambiguous. would it be true on like, the frame the variable changes?
- jmb1293634
-
Scratcher
1000+ 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
-
Scratcher
500+ 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
-
Scratcher
1000+ 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
-
Scratcher
52 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
-
Scratcher
100+ posts
when variable changes
here is the workaround
set [temp v] to (a)
wait until <not <(temp) = (a)>>
your code here::#0000ff
- BigNate469
-
Scratcher
1000+ posts
when variable changes
here is the workaroundBut that hangs the thread (prevents code later on from executing until the variable changes).set [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
-
Scratcher
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
-
Scratcher
1000+ posts
when variable changes
Support! High five!Please tell us why you support - asserting support, or lack-thereof, doesn't contribute to the discussion - the forums are not for polling.
- Discussion Forums
- » Suggestions
-
» when variable changes