Discuss Scratch
- mybearworld
-
Scratcher
1000+ posts
"Query" blocks
By doing https://scratch.mit.edu/projects/1581299/?q=hello_world, you should be able to change the value of a block:
Let's take a look at an example where this could be used.
For example, you have a dictionary, like https://scratch.mit.edu/projects/485870527/ is.
By putting
This would also be useful for animations (linking to a certain part).
There is one issue though. People may want to put “100% Pen” in a query. However, ?q=100% Pen doesn't work - you'd have to put ?q=100%25 Pen.
To solve that, the “Copy Link” dialog should get a new option.

They would not be called Sections, but Quueries, I forgot to rename them.
The creator would be able to set up all the queries listed on that menu. Those also wouldn't be the only ones possible.
(query::sensing)//This would be changed from nothing to hello_world
<query exists?::sensing>//This would turn true.
Let's take a look at an example where this could be used.
For example, you have a dictionary, like https://scratch.mit.edu/projects/485870527/ is.
By putting
if <query exists?::sensing> thenyou would be able to write links like https://scratch.mit.edu/projects/485870527/?q=Advertising and it would automatically go to that page.
switch backdrop to (query::sensing)
end
This would also be useful for animations (linking to a certain part).
There is one issue though. People may want to put “100% Pen” in a query. However, ?q=100% Pen doesn't work - you'd have to put ?q=100%25 Pen.
To solve that, the “Copy Link” dialog should get a new option.

They would not be called Sections, but Quueries, I forgot to rename them.
The creator would be able to set up all the queries listed on that menu. Those also wouldn't be the only ones possible.
Last edited by mybearworld (Jan. 18, 2023 13:38:41)
- Yellowsheep43
-
Scratcher
1000+ posts
"Query" blocks
This would be way too complicated for new scratchers
- ShyGamer16
-
Scratcher
500+ posts
"Query" blocks
This would be way too complicated for new scratchersSo? Maybe you should check this out then…
- SmartCat3
-
Scratcher
500+ posts
"Query" blocks
This would be way too complicated for new scratchersIt would be complicated to a 4 year old
- Maximouse
-
Scratcher
1000+ posts
"Query" blocks
This would be way too complicated for new scratchersNew Scratches would probably just ignore the blocks, but this seems like a feature that would be difficult to implement in a way that isn't complicated.
- SmartCat3
-
Scratcher
500+ posts
"Query" blocks
I have a slightly different suggestion( I think this is different from what you are suggesting)
If the query/project was incorrect, it would do this:
get query [scratch.mit.edu/projects/104/?q=Weekend] :: sensingThe rest would be the same.
If the query/project was incorrect, it would do this:
think [error!] for (2) secsTHe rest would be the same
- _nix
-
Scratcher
1000+ posts
"Query" blocks
It'd actually be pretty easy to code an extension which does this! The query is stored inside the JavaScript “location” object, so the code would just look something like this:This would be way too complicated for new scratchersNew Scratches would probably just ignore the blocks, but this seems like a feature that would be difficult to implement in a way that isn't complicated.
class Scratch3QueryBlocks { ... getQuery() { return this.location.search; } hasQuery() { return this.location.search.length > 0; } }
)I think this would be a neat feature as an extension, maybe with other browser-related blocks! (Those could probably come from other similar suggestions.)
- JackK211424
-
Scratcher
500+ posts
"Query" blocks
(Actually .search includes the whole thing, e.g. “?q=123” instead of just “123”, so you'd have to do a little bit of string processing, but you get the idea.)
class Scratch3QueryBlocks { ... getQuery() { return this.location.search.substring(3); } hasQuery() { return this.location.search.length > 0; } }
Aaaaanyways this is a genuinely good idea!
One thing I may suggest would be the ability to set the query, so, going back to the dictionary, if you select a word it will set the query so you dont have to manually.
Last edited by JackK211424 (Oct. 6, 2021 20:42:45)
- mybearworld
-
Scratcher
1000+ posts
"Query" blocks
One thing I may suggest would be the ability to set the query, so, going back to the dictionary, if you select a word it will set the query so you dont have to manually.That would be difficult to implement. You can't just change URLs midway.
- PkmnQ
-
Scratcher
1000+ posts
"Query" blocks
One thing I may suggest would be the ability to set the query, so, going back to the dictionary, if you select a word it will set the query so you dont have to manually.I think you can workaround it using something like this:
when green flag clicked
if <<query exists? :: sensing> and <(query set?) = [0]>> then
set [query v] to (query :: sensing)
set [query set? v] to [1]
end
Last edited by PkmnQ (Oct. 7, 2021 08:25:26)
- mybearworld
-
Scratcher
1000+ posts
"Query" blocks
How would this work off-line
<query exists?::sensing> // is always false
(query::sensing)// is always blank
or in an embed?https://scratch.mit.edu/projects/xyz/embed?q=abc
- JackK211424
-
Scratcher
500+ posts
"Query" blocks
How would this work off-line, or in an embed?An embed would just use the embeds query and off-line it wouldn't work like the username block.
Edit: Ninja'd by 14 seconds.
Last edited by JackK211424 (Oct. 8, 2021 18:39:34)
- ScolderCreations
-
Scratcher
1000+ posts
"Query" blocks
Here's another question: what about websites that can run scratch projects, but have their own url parameters?
- mybearworld
-
Scratcher
1000+ posts
"Query" blocks
Here's another question: what about websites that can run scratch projects, but have their own url parameters?Again, in the embed link, the query should be included. It has nothing to do with the website's link.
- Maximouse
-
Scratcher
1000+ posts
"Query" blocks
Here's another question: what about websites that can run scratch projects, but have their own url parameters?If you're talking about mods and alternative players: this would only read the “q” parameter – if the website already has one, it could be named differently there.
- ScolderCreations
-
Scratcher
1000+ posts
"Query" blocks
I don't think you understood me. I'm not talking about embeds, I'm talking about scratch modifications, such as turbowarp.Here's another question: what about websites that can run scratch projects, but have their own url parameters?Again, in the embed link, the query should be included. It has nothing to do with the website's link.
- mybearworld
-
Scratcher
1000+ posts
"Query" blocks
I don't think you understood me. I'm not talking about embeds, I'm talking about scratch modifications, such as turbowarp.The code is not very complicated, modders could just change the query name manually.









