Discuss Scratch

The_5th_Scratcher
Scratcher
100+ posts

Variable Sensing

BUMP!
The_5th_Scratcher
Scratcher
100+ posts

Variable Sensing

UPDATE:

These are all of the block that i'm suggesting:


[variable v] changed::variables hat //these would start a line of code
[variable v] changed from [] to []::variables hat
[variable v] changed by [number]::variables hat

wait until [variable v] changed ::variables

repeat until [variable v] changed {

}::variables

Last edited by The_5th_Scratcher (May 19, 2021 19:31:21)

The_5th_Scratcher
Scratcher
100+ posts

Variable Sensing

.pmuB
kccuber
Scratcher
1000+ posts

Variable Sensing

let me try this in snap!
will post my results soon
The_5th_Scratcher
Scratcher
100+ posts

Variable Sensing

kccuber wrote:

let me try this in snap!

What is snap?…
The_5th_Scratcher
Scratcher
100+ posts

Variable Sensing

BUMP
samq64
Scratcher
1000+ posts

Variable Sensing

I support
when variable [foo v] changes :: hat events
beacuse it's useful and it's something that a lot of people are likely to use.

I do not support the boolean blocks because as mentioned above, they're are too ambiguous.
As for the other hat blocks, I don't think they're really needed beacuse you can just do this
when variable [foo v] changes :: events hat
if <(foo) = [...]> then
...
End

I'm not too sure about those last two blocks.

Last edited by samq64 (June 5, 2021 15:56:04)

samq64
Scratcher
1000+ posts

Variable Sensing

The_5th_Scratcher wrote:

kccuber wrote:

let me try this in snap!

What is snap?…
Here's the Scratch wiki article: https://en.scratch-wiki.info/wiki/Snap

Last edited by samq64 (June 5, 2021 00:52:28)

The_5th_Scratcher
Scratcher
100+ posts

Variable Sensing

bump
The_5th_Scratcher
Scratcher
100+ posts

Variable Sensing

bump
The_5th_Scratcher
Scratcher
100+ posts

Variable Sensing

samq64 wrote:

I do not support the boolean blocks because as mentioned above, they're are too ambiguous.

I already removed the boolean blocks from the suggestion.
cat_tap
Scratcher
1000+ posts

Variable Sensing

The_5th_Scratcher wrote:

-snip-
How about

<[variable v] changed ?::variables>
<[variable v] changed from [] to [] ?::variables>
<[variable v] changed by (...) ?::variables>

wait until <[variable v] changed ?::variables>

repeat until <[variable v] changed ?::variables>
end

then you could also use it in many other ways, like

if <[variable v] changed ? ::variables> then
...
end

<<[variable1 v] changed ? ::variables> and <[variable2 v] changed by (...) ?::variables>>

Support! Though there is a workaround, it's not too accurate if it needs to be precise…
Chiroyce
Scratcher
1000+ posts

Variable Sensing

when green flag clicked
set [cached var v] to (my variable)

when [timer v] > ((timer) - <not <(cached var) = (my variable)>>)
set [cached var v] to (my variable)
say [Variable changed!] for (2) secs // change this to code that should be run when the variable is changed

`my variable` is the variable that will be detected if changed
This is a workaround for people who are in need of this suggestion right now.

Here is a demo.

Last edited by Chiroyce (June 10, 2021 07:30:09)

kccuber
Scratcher
1000+ posts

Variable Sensing

samq64 wrote:

The_5th_Scratcher wrote:

kccuber wrote:

let me try this in snap!

What is snap?…
Here's the Scratch wiki article: https://en.scratch-wiki.info/wiki/Snap
anyway this idea miserably failed

Last edited by kccuber (June 10, 2021 13:20:56)

The_5th_Scratcher
Scratcher
100+ posts

Variable Sensing

cat_tap wrote:

The_5th_Scratcher wrote:

-snip-
How about

<[variable v] changed ?::variables>
<[variable v] changed from [] to [] ?::variables>
<[variable v] changed by (...) ?::variables>

wait until <[variable v] changed ?::variables>

repeat until <[variable v] changed ?::variables>
end

then you could also use it in many other ways, like

if <[variable v] changed ? ::variables> then
...
end

<<[variable1 v] changed ? ::variables> and <[variable2 v] changed by (...) ?::variables>>

Support! Though there is a workaround, it's not too accurate if it needs to be precise…

The boolean blocks are no longer part of the suggestion.
The_5th_Scratcher
Scratcher
100+ posts

Variable Sensing

Chiroyce wrote:

This is a workaround for people who are in need of this suggestion right now.

Thanks! I'll put it in the top post on the first page.
The_5th_Scratcher
Scratcher
100+ posts

Variable Sensing

bump
The_5th_Scratcher
Scratcher
100+ posts

Variable Sensing

bump
VeryFamus
Scratcher
1000+ posts

Variable Sensing

Here is a workaround for the first hat block:
forever
if <not<(Var)=(oldVar) :: operators> :: operators> then

end
Set [oldVar v] to (Var) :: variables
end
And the third hat block:
forever
if <not<(Var)=(oldVar) :: operators> :: operators> then
If <(Var) = ((oldVar) + [num] :: operators) :: operators> then

end
end
Set [oldVar v] to (Var) :: variables
end
The repeat until block:
Repeat until <not<(Var)=(oldVar) :: operators> :: operators>

end

Forever
Set [oldVar v] to (Var) :: variables
end
And the wait until block:
Wait until <not<(Var)=(oldVar) :: operators> :: operators>


Forever
Set [oldVar v] to (Var) :: variables
end

As for the second hat, I don’t support that one due to being too specific, but here is a workaround (I support all the other ones):

forever
if <not<(Var)=(oldVar) :: operators> :: operators> then
If <<(Var) = [num] :: operators> and <(oldVar) = [num] :: operators>> then

end
end
Set [oldVar v] to (Var) :: variables
end
Jackson49_test
Scratcher
100+ posts

Variable Sensing

Bump

Last edited by Jackson49_test (April 5, 2022 22:11:51)

Powered by DjangoBB