Discuss Scratch

WiLcR02019
Scratcher
1 post

When variable changes

i am in full support this would be really helpful
the2000
Scratcher
1000+ posts

When variable changes

I support this just because we have “if on edge bounce”. If that block is allowed then this definitely belongs
Rendangbike2
Scratcher
1000+ posts

When variable changes

How would this be beneficial?
co0lcr34t10ns
Scratcher
1000+ posts

When variable changes

Easy workaround:
when green flag clicked
forever
Game code here
if <(☁ score) > (☁ highscore)> then
set [☁ highscore v] to (☁ score)
say (join (username) [, you got highscore!]) for (2) secs
end
end
Semi support.
RealChutacoPlayz
Scratcher
100+ posts

When variable changes

Support, but with
when [var v] changes to [] :: hat :: control
Because if a variable like score changes to 100 then it should do something like reward the player.
Ihatr
Scratcher
1000+ posts

When variable changes

The workaround may exist, and it may be easy, but this is obviously intended for New Scratchers.

We have a “when backdrop switches to __” block that can be easily workarounded, but it's for the sole purpose of making things easier. This is a lot like this, and there are no reasons not to add it besides that workaround crap
PGBFLITE6373
Scratcher
1000+ posts

When variable changes

Okay of we have a workaround then why did st make this block
forever

end
when we could just use this block
repeat until <[1] = [2]>

end
Destruction_5858
Scratcher
100+ posts

When variable changes

I fully agree but there are workarounds!
when green flag clicked
forever
set [(stuff) v] to (blank)
if <not <(stuff) = (blank)>> then
broadcast [ score changed]
end
end


when I receive [score changed v]
do stuff

Last edited by Destruction_5858 (Feb. 18, 2021 18:13:54)

Ihatr
Scratcher
1000+ posts

When variable changes

Destruction_5858 wrote:

I fully agree but there are workarounds!
when green flag clicked
forever
set [(stuff) v] to (blank)
if <not <(stuff) = (blank)>> then
broadcast [ score changed]
end
end


when I receive [score changed v]
do stuff
Your workaround doesn't work lol
Arzenist
Scratcher
98 posts

When variable changes

A-no-meep wrote:

Support because of BobbyBee's reasoning, and the lag reduction this block would provide over its workaround.
This doesn’t cause lag, a work around is much better, less blocks to scroll around, if that did cause lag, large mathematical operations would just be liabilities for the coder on scratch. That was a reason the forever if block was removed, there was an easy work around for it. Who knows? Maybe the forever block will be removed because the repeat until does the exact same thing, or vice versa. Scratch is meant to replicate real coding also, so we have to find the solutions to problems, I don’t support the idea of that.
xarparx
Scratcher
100+ posts

When variable changes

Support, the workaround requires two variables, and if you need this for multiple variables, it wouldn't be practical to create a second variable for everything. This could also be implemented in boolean form:
<[variable v] changed::variables>
Maybe the boolean would report "true' for 1 second, so you can detect multiple changes in a variable.
dertermenter
Scratcher
1000+ posts

When variable changes

The workaround isn’t that hard so this doesn’t need to be implemented. Just add more to the code under score.
Hotwheels_Fan101
Scratcher
15 posts

When variable changes

i agree with @rdococ

Last edited by Hotwheels_Fan101 (May 3, 2021 23:23:24)

Hotwheels_Fan101
Scratcher
15 posts

When variable changes

hey yall, if you are trying to do a volume control with a variable slide, try this

forever
if <(volume control) = (volume)> then
wait until <not <(volume control) = (volume)>>
set volume to (volume control) %
end
end

(() or ())   
(() and ())
those would be useful so that you don't have to do if variable = this OR variable = that OR variable = thing etc

Last edited by Hotwheels_Fan101 (May 3, 2021 23:24:18)

Birk09
Scratcher
1 post

When variable changes

when green flag clicked
forever
if <my variable changes by 2> then
play sound [hi] until done
end
end
dova2020
Scratcher
8 posts

When variable changes

I know this topic is old lol, but I do need this in one of my projects

Last edited by dova2020 (July 20, 2021 15:24:16)

An0therRand0mC0der
Scratcher
1000+ posts

When variable changes

Semi-support. This could actually be useful instead of having to make a whole script, but what would this be used for?

Edit: I accidentally posted on an old topic, sorry! Please don't necropost, thanks!

Last edited by An0therRand0mC0der (July 20, 2021 15:34:47)

boopoogood
Scratcher
22 posts

When variable changes

Why not this ???
forever
if <(foo) = (foo)> then

Last edited by boopoogood (Sept. 18, 2021 10:06:05)

GreggyTheMarmoset
New Scratcher
1 post

When variable changes

f1lip wrote:

No support. Easy Workaround…


when green flag clicked
change [score v] by (1)
broadcast [score change v]



when I receive [score change v]
if <(score) = [ 1]> then
say [the score has changed.] for (2) secs
end


However, my variable changes a LOT. It would be very hard to put (broadcast score change) after every time the variable changes
dave-alt-4
Scratcher
1000+ posts

When variable changes

9/10 support , 1/10 no support
support cuz its used a lot

no support cuz then we'll have a lot of hat blocks , instead , i think
<[dropdowns  v] ? ::sensing>
would be better to save space in the editor .

Powered by DjangoBB