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:
(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> then
switch backdrop to (query::sensing)
end
you would be able to write links like https://scratch.mit.edu/projects/485870527/?q=Advertising and it would automatically go to that page.
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)


Signatures are the only place where assets links still work.
SmartCat3
Scratcher
500+ posts

"Query" blocks

SUpport, it would be easier to make dictionaries

Add your projects here!: https://scratch.mit.edu/studios/30150978/
hello there
Press Ctrl+Shift+Down arrow to see more















Please don't invite me to studios just to advertise your project


(((((((((=^.^= :: stack obsolete) :: stack obsolete) :: stack obsolete) :: stack obsolete) :: stack obsolete) :: stack obsolete) :: stack obsolete) :: stack obsolete) ::obsolete stack) :: obsolete stack
(((((((((=^.^= :: stack variables) :: stack variables) :: stack variables) :: stack variables) :: stack variables) :: stack variables) :: stack variables) :: stack variables) ::variables stack) :: variables stack
(((((((((=^.^= :: stack events) :: stack events) :: stack events) :: stack events) :: stack events) :: stack events) :: stack events) :: stack events) ::events stack) :: events stack
(((((((((=^.^= :: stack pen) :: stack pen) :: stack pen) :: stack pen) :: stack pen) :: stack pen) :: stack pen) :: stack pen) ::pen stack) :: pen stack
(((((((((=^.^= :: stack motion) :: stack motion) :: stack motion) :: stack motion) :: stack motion) :: stack motion) :: stack motion) :: stack motion) ::motion stack) :: motion stack
(((((((((=^.^= :: stack looks) :: stack looks) :: stack looks) :: stack looks) :: stack looks) :: stack looks) :: stack looks) :: stack looks) ::looks stack) :: looks stack


Comment
500posts
on my profile if you see this
Yellowsheep43
Scratcher
1000+ posts

"Query" blocks

This would be way too complicated for new scratchers

How to use scratchblocks \ How to make your project popular \ The Do's and Do Not's of the Suggestions Forum
Highlight this and use Ctrl + Shift + Down arrow to see the rest of my signature!
My signature is an evil kumquat factory

When [Post v] :: #ffd900
if <(Kumquats available? :: #00ff7b) = <True :: #517d48> :: #d642e3> then :: #00e32d
Make evil kumquats :: #00d5ff
end
Haha invisible block go brrr :: cap :: #ffffff
Angry David


It's spelled AMONG US, not Amogus! Know the difference!

(((((I reside in the ((Questions About Scratch :: #00e8a2 stack) :: #00e8c1 stack) and ((Suggestions :: #00e8a2 stack) :: #00e8c1 stack) forums :: #ff0073) :: #ffae00) :: #ffd500) :: #00ff2a) :: #0095ff) :: #8c00ff hat
I spend a bit of time everywhere <Except the wiki :: #94634a> :: #dd00ff cap

(_/(._. v)|_ :: #0051ff) :: #55ff00 hat // This is an unnamed servant that restocks on kumquats constantly
As long as Signal (When gf clicked :: #ff0059) [given v] {
Produce Kumquats :: #08d16d
} :: #9a0f2a
I enjoy [Among Us v], [FNF v], [Roblox v], [Memes v], [Object Shows v], and [Anthropomorphic animals v]:: #08b0d1 cap


ShyGamer16
Scratcher
500+ posts

"Query" blocks

Yellowsheep43 wrote:

This would be way too complicated for new scratchers
So? Maybe you should check this out then…


SmartCat3
Scratcher
500+ posts

"Query" blocks

Yellowsheep43 wrote:

This would be way too complicated for new scratchers
It would be complicated to a 4 year old

Add your projects here!: https://scratch.mit.edu/studios/30150978/
hello there
Press Ctrl+Shift+Down arrow to see more















Please don't invite me to studios just to advertise your project


(((((((((=^.^= :: stack obsolete) :: stack obsolete) :: stack obsolete) :: stack obsolete) :: stack obsolete) :: stack obsolete) :: stack obsolete) :: stack obsolete) ::obsolete stack) :: obsolete stack
(((((((((=^.^= :: stack variables) :: stack variables) :: stack variables) :: stack variables) :: stack variables) :: stack variables) :: stack variables) :: stack variables) ::variables stack) :: variables stack
(((((((((=^.^= :: stack events) :: stack events) :: stack events) :: stack events) :: stack events) :: stack events) :: stack events) :: stack events) ::events stack) :: events stack
(((((((((=^.^= :: stack pen) :: stack pen) :: stack pen) :: stack pen) :: stack pen) :: stack pen) :: stack pen) :: stack pen) ::pen stack) :: pen stack
(((((((((=^.^= :: stack motion) :: stack motion) :: stack motion) :: stack motion) :: stack motion) :: stack motion) :: stack motion) :: stack motion) ::motion stack) :: motion stack
(((((((((=^.^= :: stack looks) :: stack looks) :: stack looks) :: stack looks) :: stack looks) :: stack looks) :: stack looks) :: stack looks) ::looks stack) :: looks stack


Comment
500posts
on my profile if you see this
Maximouse
Scratcher
1000+ posts

"Query" blocks

Yellowsheep43 wrote:

This would be way too complicated for new scratchers
New 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.


This is Maximouse's signature. Learn more about signatures.
SmartCat3
Scratcher
500+ posts

"Query" blocks

I have a slightly different suggestion( I think this is different from what you are suggesting)
get query [scratch.mit.edu/projects/104/?q=Weekend] :: sensing
The rest would be the same.
If the query/project was incorrect, it would do this:
think [error!] for (2) secs
THe rest would be the same

Add your projects here!: https://scratch.mit.edu/studios/30150978/
hello there
Press Ctrl+Shift+Down arrow to see more















Please don't invite me to studios just to advertise your project


(((((((((=^.^= :: stack obsolete) :: stack obsolete) :: stack obsolete) :: stack obsolete) :: stack obsolete) :: stack obsolete) :: stack obsolete) :: stack obsolete) ::obsolete stack) :: obsolete stack
(((((((((=^.^= :: stack variables) :: stack variables) :: stack variables) :: stack variables) :: stack variables) :: stack variables) :: stack variables) :: stack variables) ::variables stack) :: variables stack
(((((((((=^.^= :: stack events) :: stack events) :: stack events) :: stack events) :: stack events) :: stack events) :: stack events) :: stack events) ::events stack) :: events stack
(((((((((=^.^= :: stack pen) :: stack pen) :: stack pen) :: stack pen) :: stack pen) :: stack pen) :: stack pen) :: stack pen) ::pen stack) :: pen stack
(((((((((=^.^= :: stack motion) :: stack motion) :: stack motion) :: stack motion) :: stack motion) :: stack motion) :: stack motion) :: stack motion) ::motion stack) :: motion stack
(((((((((=^.^= :: stack looks) :: stack looks) :: stack looks) :: stack looks) :: stack looks) :: stack looks) :: stack looks) :: stack looks) ::looks stack) :: looks stack


Comment
500posts
on my profile if you see this
_nix
Scratcher
1000+ posts

"Query" blocks

Maximouse wrote:

Yellowsheep43 wrote:

This would be way too complicated for new scratchers
New 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.
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:
class Scratch3QueryBlocks {
    ...
    getQuery() {
        return this.location.search;
    }
    hasQuery() {
        return this.location.search.length > 0;
    }
}
(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. )

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.)

══ trans autistic lesbian enbydoggirls // 16 17 18 19 20 21, she/they
sparrows one word to the paragraph // <3 // ~(quasar) nebula
JackK211424
Scratcher
500+ posts

"Query" blocks

_nix wrote:

(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;
    }
}
Fixed.

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

JackK211424 wrote:

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.

Signatures are the only place where assets links still work.
PkmnQ
Scratcher
1000+ posts

"Query" blocks

JackK211424 wrote:

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)


This is an account that exists.

Here, have a useful link:
The Official List of Rejected Suggestions by Za-Chary

SmartCat3
Scratcher
500+ posts

"Query" blocks

Bump

Add your projects here!: https://scratch.mit.edu/studios/30150978/
hello there
Press Ctrl+Shift+Down arrow to see more















Please don't invite me to studios just to advertise your project


(((((((((=^.^= :: stack obsolete) :: stack obsolete) :: stack obsolete) :: stack obsolete) :: stack obsolete) :: stack obsolete) :: stack obsolete) :: stack obsolete) ::obsolete stack) :: obsolete stack
(((((((((=^.^= :: stack variables) :: stack variables) :: stack variables) :: stack variables) :: stack variables) :: stack variables) :: stack variables) :: stack variables) ::variables stack) :: variables stack
(((((((((=^.^= :: stack events) :: stack events) :: stack events) :: stack events) :: stack events) :: stack events) :: stack events) :: stack events) ::events stack) :: events stack
(((((((((=^.^= :: stack pen) :: stack pen) :: stack pen) :: stack pen) :: stack pen) :: stack pen) :: stack pen) :: stack pen) ::pen stack) :: pen stack
(((((((((=^.^= :: stack motion) :: stack motion) :: stack motion) :: stack motion) :: stack motion) :: stack motion) :: stack motion) :: stack motion) ::motion stack) :: motion stack
(((((((((=^.^= :: stack looks) :: stack looks) :: stack looks) :: stack looks) :: stack looks) :: stack looks) :: stack looks) :: stack looks) ::looks stack) :: looks stack


Comment
500posts
on my profile if you see this
ScolderCreations
Scratcher
1000+ posts

"Query" blocks

How would this work off-line, or in an embed?

mybearworld
Scratcher
1000+ posts

"Query" blocks

ScolderCreations wrote:

How would this work off-line
<query exists?::sensing> // is always false
(query::sensing)// is always blank

ScolderCreations wrote:

or in an embed?
https://scratch.mit.edu/projects/xyz/embed?q=abc

Signatures are the only place where assets links still work.
JackK211424
Scratcher
500+ posts

"Query" blocks

ScolderCreations wrote:

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

ScolderCreations wrote:

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.

Signatures are the only place where assets links still work.
Maximouse
Scratcher
1000+ posts

"Query" blocks

ScolderCreations wrote:

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.


This is Maximouse's signature. Learn more about signatures.
ScolderCreations
Scratcher
1000+ posts

"Query" blocks

mybearworld wrote:

ScolderCreations wrote:

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.
I don't think you understood me. I'm not talking about embeds, I'm talking about scratch modifications, such as turbowarp.

mybearworld
Scratcher
1000+ posts

"Query" blocks

ScolderCreations wrote:

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.

Signatures are the only place where assets links still work.

Powered by DjangoBB