Discuss Scratch

The_5th_Scratcher
Scratcher
100+ posts

Variable Sensing

The boolean blocks are NO LONGER part of the suggestion!

I think a couple of blocks in the variable category could detect a change in variables. These would work for the shortest amount of time used in the coding interface. (I think it is 0.025 seconds)

The first block is very simple. It would just detect if the variable is different then it was a few milliseconds earlier. The last one would detect if the variable was changed by a certain number. (Ex. changed by 10)


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




wait until [variable v] changed ::variables

repeat until [variable v] changed {

}::variables

Even though one or more of these blocks can probably be made through the custom blocks option, I just think that these would be a good idea.

Workaround for the first hat block by Chiroyce:

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

Last edited by The_5th_Scratcher (July 25, 2022 19:38:23)


Thank you for taking the time to read this post.
Sorry, you have to wait 60 seconds between posts. | I'm on the scratch wiki! | Naming Scripts | Var Sensing | Tracing Shop | Fifth's Adventure


Winston Churchill said:
We make a living by what we get, but we make a life by what we give.

The 5th Scratcher
User #62532525, Cat Owner, Minecrafter, much more…

This is my current profile pic!


Steve0Greatness
Scratcher
1000+ posts

Variable Sensing

It looks like you're trying to use the block plugin. Here, let me help.
Here's what you may be trying to do with the block plugin:
[scratchblocks]<(☁variable) changed::sensing>
<(☁variable) changed from [] to []::sensing>
<(☁variable) changed by [(Number or user)]::sensing>[/scratchblocks]
Preview:
<(☁variable) changed?::sensing>
<(☁variable) changed from [] to []?::sensing>
<(☁variable) changed by [(Number or user)]?::sensing>
If you need more info, please consult the wiki article for the block plugin, or the guide for how to use the block plugin.

/hj is the worst tone indicator. It's confusing and ambiguous. I hate it. The point of tone indicators is to indicate tone, or the way that a piece of text should be read, but what does “half joking” mean? Do you just wake up in the morning and think “wow, I really have something I want to talk about seriously but also kinda not, IDK you decide.” It's useless. I hate it. It just provokes a deep rooted anger within me whenever I see it. People just comment /hj as if it makes any sense. It doesn't. Oh wow, it's a tone indicator that's has a relative meaning, how useful, I'll use it in every comment I post. NO. STOP IT. You're a tone indicator, you have only one job, and yet you sit there doing nothing apart angering me.

/srs

^^^ (there's more below)
This one is useful because it tells you that this signature is fully 100% serious. (/srs) Who would've thought that tone indicators needed to tell you something about the piece of text they're attached to? /s

I'm serious, I'm not even going to put multiple (/hj)s a the end of my signature as to mock the previous paragraph for not getting the point of something(like previous version of my signature). /srs
The_5th_Scratcher
Scratcher
100+ posts

Variable Sensing

Steve0Greatness wrote:

It looks like you're trying to use the block plugin. Here, let me help.

Thank you, but I'm looking for feedback (Yes, that was what I was trying to do,Thank you very much )

Thank you for taking the time to read this post.
Sorry, you have to wait 60 seconds between posts. | I'm on the scratch wiki! | Naming Scripts | Var Sensing | Tracing Shop | Fifth's Adventure


Winston Churchill said:
We make a living by what we get, but we make a life by what we give.

The 5th Scratcher
User #62532525, Cat Owner, Minecrafter, much more…

This is my current profile pic!


han614698
Scratcher
1000+ posts

Variable Sensing

For -Steave0Greatness-:
I think it should be
<[☁variable v] changed::sensing>
<[☁variable v] changed from [] to []::sensing>
<[☁variable v] changed by [(Number or user)]::sensing>
not
<(☁variable) changed::sensing>
<(☁variable) changed from [] to []::sensing>
<(☁variable) changed by [(Number or user)]::sensing>
Support, this would help reduce the number of broadcasts.

<Scratch Wikian | Forum Helper | Almost to 6000 Posts! | Please be aware I may mistype things, my wrist is fractured>

Credit to -gge for the icons in my signature | I condensed all this code into five lines using [p] tags, idk why




EatNYeet
Scratcher
500+ posts

Variable Sensing

han614698 wrote:

For -Steave0Greatness-:
I think it should be
<[☁variable v] changed::sensing>
<[☁variable v] changed from [] to []::sensing>
<[☁variable v] changed by [(Number or user)]::sensing>
not
<(☁variable) changed::sensing>
<(☁variable) changed from [] to []::sensing>
<(☁variable) changed by [(Number or user)]::sensing>
Support, this would help reduce the number of broadcasts.
If it's variable sensing, it doesn't feel right for it to look line sensing blocks. A minor change as well:

<[☁variable v] changed::variables>
<[☁variable v] changed from [] to []::variables>
<[☁variable v] changed by [Number v] []::variables>//this looks nicer as a dropdown menu

Support.

It's such a pain to try and find a previous variable, but there could be some hat blocks for these as well, like how there's hat blocks and sensing blocks for the “key () pressed?” block.
when [variable v] changes::variables hat
when [variable v] changes from [] to []:: variables hat
when [variable v] is changed by [number v] []::variables hat

Last edited by EatNYeet (May 1, 2021 03:17:37)


Why is this a thing?
Steve0Greatness
Scratcher
1000+ posts

Variable Sensing

han614698 wrote:

-Steave0Greatness-
now this is just getting offending…

/hj is the worst tone indicator. It's confusing and ambiguous. I hate it. The point of tone indicators is to indicate tone, or the way that a piece of text should be read, but what does “half joking” mean? Do you just wake up in the morning and think “wow, I really have something I want to talk about seriously but also kinda not, IDK you decide.” It's useless. I hate it. It just provokes a deep rooted anger within me whenever I see it. People just comment /hj as if it makes any sense. It doesn't. Oh wow, it's a tone indicator that's has a relative meaning, how useful, I'll use it in every comment I post. NO. STOP IT. You're a tone indicator, you have only one job, and yet you sit there doing nothing apart angering me.

/srs

^^^ (there's more below)
This one is useful because it tells you that this signature is fully 100% serious. (/srs) Who would've thought that tone indicators needed to tell you something about the piece of text they're attached to? /s

I'm serious, I'm not even going to put multiple (/hj)s a the end of my signature as to mock the previous paragraph for not getting the point of something(like previous version of my signature). /srs
EatNYeet
Scratcher
500+ posts

Variable Sensing

Steve0Greatness wrote:

han614698 wrote:

-Steave0Greatness-
now this is just getting offending…
Ripperoni…

Let's try to keep things on topic, please.

Why is this a thing?
fdreerf
Scratcher
1000+ posts

Variable Sensing

The boolean blocks are useless and ambiguous. They would just return true and then immediately return false, since changing a variable is an action, not a condition.

Hyped for MS-DOS 11.0
The_5th_Scratcher
Scratcher
100+ posts

Variable Sensing

Update: I made the variable sensing in the variable category as requested & made it dropdown. Thanks for all the support!

fdreerf wrote:

The boolean blocks are useless and ambiguous. They would just return true and then immediately return false, since changing a variable is an action, not a condition.

You can do this:

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

forever
if <[variable v] changed ::variables> then

end
end



Thank you for taking the time to read this post.
Sorry, you have to wait 60 seconds between posts. | I'm on the scratch wiki! | Naming Scripts | Var Sensing | Tracing Shop | Fifth's Adventure


Winston Churchill said:
We make a living by what we get, but we make a life by what we give.

The 5th Scratcher
User #62532525, Cat Owner, Minecrafter, much more…

This is my current profile pic!


fdreerf
Scratcher
1000+ posts

Variable Sensing

The_5th_Scratcher wrote:

You can do this:

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

forever
if <[variable v] changed ::variables> then

end
end


Even then, this has the exact same problem as the broadcast received boolean. Will it return false when you click the green flag? Will it turn true and stay true forever when the variable changes? There's too much ambiguity.

Hyped for MS-DOS 11.0
The_5th_Scratcher
Scratcher
100+ posts

Variable Sensing

-bump-

Thank you for taking the time to read this post.
Sorry, you have to wait 60 seconds between posts. | I'm on the scratch wiki! | Naming Scripts | Var Sensing | Tracing Shop | Fifth's Adventure


Winston Churchill said:
We make a living by what we get, but we make a life by what we give.

The 5th Scratcher
User #62532525, Cat Owner, Minecrafter, much more…

This is my current profile pic!


DarthVader4Life
Scratcher
1000+ posts

Variable Sensing

fdreerf wrote:

The boolean blocks are useless and ambiguous. They would just return true and then immediately return false, since changing a variable is an action, not a condition.
Actually, only the
<[variable v] changed? ::variables>
is, since
<[variable v] changed from [ ] to [ ] ::variables>
is a condition that only returns true if the previous input of that variable was a certain number and it changed to another certain number. Also, the
<[variable v] changed by [ ] ::variables>
should be changed to
<[variable v] changed by < > ::variables>
so you can do both intentions
when green flag clicked
if <[variable v] changed by <(number) = ((number) - (0))> ::variables> then

end

when green flag clicked
if <[variable v] changed by <(username ::sensing) = [ RandomUser ]> ::variables> then

end
And you don't have much ambiguity on how it would know the difference between a number and a username.

Last edited by DarthVader4Life (May 2, 2021 15:34:38)


Be Moist Also, here's a helpful link to Ocular
I am DV4L, Erector of Text Walls, Typer of Long Posts, Creator of Mini-mod posts
The kumquats have eaten this line, so I have to have a new way to repel them.
Had a bad day or are feeling bored? Watch this to make your day better in an interesting way.
Do you think you've been banned unfairly? Then you'd be wrong. The ST aren't children, so quit acting like they are.
fdreerf
Scratcher
1000+ posts

Variable Sensing

DarthVader4Life wrote:

<[variable v] changed from [ ] to [ ] ::variables>
is a condition that only returns true if the previous input of that variable was a certain number and it changed to another certain number. Also, the
But will it stay true forever? When will it become false? It's a pointless block as really the only true definition is to become true and then immediately become false.

Last edited by fdreerf (May 2, 2021 21:31:51)


Hyped for MS-DOS 11.0
The_5th_Scratcher
Scratcher
100+ posts

Variable Sensing

fdreerf wrote:

is to become true and then immediately become false.


It would turn false after 0.025 seconds, long enough for a string of code to be triggered

Thank you for taking the time to read this post.
Sorry, you have to wait 60 seconds between posts. | I'm on the scratch wiki! | Naming Scripts | Var Sensing | Tracing Shop | Fifth's Adventure


Winston Churchill said:
We make a living by what we get, but we make a life by what we give.

The 5th Scratcher
User #62532525, Cat Owner, Minecrafter, much more…

This is my current profile pic!


The_5th_Scratcher
Scratcher
100+ posts

Variable Sensing

DarthVader4Life wrote:

And you don't have much ambiguity on how it would know the difference between a number and a username.
Maybe the username part shouldn't be a part of this suggestion

Thank you for taking the time to read this post.
Sorry, you have to wait 60 seconds between posts. | I'm on the scratch wiki! | Naming Scripts | Var Sensing | Tracing Shop | Fifth's Adventure


Winston Churchill said:
We make a living by what we get, but we make a life by what we give.

The 5th Scratcher
User #62532525, Cat Owner, Minecrafter, much more…

This is my current profile pic!


han614698
Scratcher
1000+ posts

Variable Sensing

fdreerf wrote:

The boolean blocks are useless and ambiguous. They would just return true and then immediately return false, since changing a variable is an action, not a condition.
This is the exact reason why
[message v] received::events boolean
is rejected.

Maybe,
wait until [var v] changes::variables stack

<Scratch Wikian | Forum Helper | Almost to 6000 Posts! | Please be aware I may mistype things, my wrist is fractured>

Credit to -gge for the icons in my signature | I condensed all this code into five lines using [p] tags, idk why




The_5th_Scratcher
Scratcher
100+ posts

Variable Sensing

due to a suggestion like this one being rejected because of booleans, I have decided to replace that part of the suggestion with these:

wait until [variable v] changed ::variables

repeat until [variable v] changed {

}::variables


I also added the hat blocks a few days ago because that was my original intent with this suggestion.

(This is starting to seem like it would be an extension like “pen” and “music”

Thank you for taking the time to read this post.
Sorry, you have to wait 60 seconds between posts. | I'm on the scratch wiki! | Naming Scripts | Var Sensing | Tracing Shop | Fifth's Adventure


Winston Churchill said:
We make a living by what we get, but we make a life by what we give.

The 5th Scratcher
User #62532525, Cat Owner, Minecrafter, much more…

This is my current profile pic!


The_5th_Scratcher
Scratcher
100+ posts

Variable Sensing

Many people have said:
BUMP

Thank you for taking the time to read this post.
Sorry, you have to wait 60 seconds between posts. | I'm on the scratch wiki! | Naming Scripts | Var Sensing | Tracing Shop | Fifth's Adventure


Winston Churchill said:
We make a living by what we get, but we make a life by what we give.

The 5th Scratcher
User #62532525, Cat Owner, Minecrafter, much more…

This is my current profile pic!


The_5th_Scratcher
Scratcher
100+ posts

Variable Sensing

BUMP

Thank you for taking the time to read this post.
Sorry, you have to wait 60 seconds between posts. | I'm on the scratch wiki! | Naming Scripts | Var Sensing | Tracing Shop | Fifth's Adventure


Winston Churchill said:
We make a living by what we get, but we make a life by what we give.

The 5th Scratcher
User #62532525, Cat Owner, Minecrafter, much more…

This is my current profile pic!


The_5th_Scratcher
Scratcher
100+ posts

Variable Sensing

BUMP bump BUMP bump

Thank you for taking the time to read this post.
Sorry, you have to wait 60 seconds between posts. | I'm on the scratch wiki! | Naming Scripts | Var Sensing | Tracing Shop | Fifth's Adventure


Winston Churchill said:
We make a living by what we get, but we make a life by what we give.

The 5th Scratcher
User #62532525, Cat Owner, Minecrafter, much more…

This is my current profile pic!


Powered by DjangoBB