Discuss Scratch

Sheep_maker
Scratcher
1000+ posts

Scratch 3.0 Utilities extension

WA3360 wrote:

when this sprite clicked
go to [ youtube.com]
Can't do that with unofficial extensions since they're sandboxed in web workers
AnAlgorithm
Scratcher
85 posts

Scratch 3.0 Utilities extension

Well…I guess ‘millisecond’ should go in the ‘Sensing’ part. Seems good.
(current [millisecond v])
WaterGames7216_
Scratcher
24 posts

Scratch 3.0 Utilities extension

Can I suggest blocks?
It's fine if you do not want me to.
SuperSean12
Scratcher
500+ posts

Scratch 3.0 Utilities extension

speech to text?
WaterGames7216_
Scratcher
24 posts

Scratch 3.0 Utilities extension

What about a

(round () to the nearest ()::#8BC34A)

I know its easily workaroundable, but would be nice to have.
Here is an example

(round (9.4) to the nearest (10)::#8BC34A)

The answer would be 9.0.

Last edited by WaterGames7216_ (Sept. 16, 2020 14:44:50)

bjmoore2007
Scratcher
32 posts

Scratch 3.0 Utilities extension

can i suggest an block ? it would compare an variable to 2 or more lists and then tell the name of the list the variable belongs too by either using AI or counting the letters in each item of the list that match with the variables letters and then comparing it too other lists
Sheep_maker
Scratcher
1000+ posts

Scratch 3.0 Utilities extension

bjmoore2007 wrote:

can i suggest an block ? it would compare an variable to 2 or more lists and then tell the name of the list the variable belongs too by either using AI or counting the letters in each item of the list that match with the variables letters and then comparing it too other lists
Hmm, I have a feeling this can already be done without AI. You can use the
<[list v] contains [thing] ?>
block to determine if a variable is in a specific list. You can then use if/else blocks to determine which list has the variable's value

I'm not exactly sure how the name of the list would be useful though because you can't plug the name into a list dropdown, I think
bjmoore2007
Scratcher
32 posts

Scratch 3.0 Utilities extension

i mean it would determine the percentage of equal letters like for example (fish) compared to list (dish)(nice) and list(cart)(mine) wold display list (dish) (nice) because dish and nice all have an total of 4 equal letters and cart mine only one equal letter
RichieNB
Scratcher
71 posts

Scratch 3.0 Utilities extension

bjmoore2007 wrote:

i mean it would determine the percentage of equal letters like for example (fish) compared to list (dish)(nice) and list(cart)(mine) wold display list (dish) (nice) because dish and nice all have an total of 4 equal letters and cart mine only one equal letter

Using leven to find the percentage of equal letters between 2 words:

(a, b) => (a.length + b.length - (leven(a, b) * 2)) / (a.length + b.length)
bjmoore2007
Scratcher
32 posts

Scratch 3.0 Utilities extension

wow thx i did not now this bevore so let me do more research

Last edited by bjmoore2007 (Dec. 29, 2020 01:55:33)

johnelr
Scratcher
1000+ posts

Scratch 3.0 Utilities extension

Sheep_maker wrote:

I made an extension for Scratch 3.0 which you can try out here. It adds a few blocks, many of which are workaroundable, but still nice to have. They are all reporter/boolean blocks because currently extensions loaded from a URL can't access the rest of Scratch.

The blocks are current sorted in an arbitrary order:
<is [apple] exactly [APPLE]?::#8BC34A>
Case sensitive string comparison. It can also distinguish between different types (eg a number created from a + block vs a join block)

<() \<= (50)::#8BC34A>
<() \>= (50)::#8BC34A>
I didn't use the special unicode characters because Scratch tends to use keyboard-only characters, as shown in the * and / blocks. The second input is 50 because the built in <, =, and > blocks follow this behaviour, a change in Scratch 3.0. They only support numbers, unlike the built in comparison blocks.

<true::#8BC34A>
<false::#8BC34A>
Although unnecessary, it might make your code look cleaner and not have any empty slots or seemingly useless = blocks.

(() ^ ()::#8BC34A)
I would probably have worded this as “to the power of” instead, but it's usually put as ^ on the Suggestions forums.

(pi::#8BC34A)
This reporter is often suggested on the suggestions forums.

(if <> then [banana] else [apple]::#8BC34A)
The ternary operator. The default strings are based off the new default values for the join block.

(letters (5) to (7) of [red apple]::#8BC34A)
The indices start from 1 and are inclusive, because I feel like they're more intuitive for beginners (they're used for page numbers, for example).

(current millisecond::#8BC34A)
This is also often suggested. I think it returns an integer between 0 and 999.

(get content from [https://api.scratch.mit.edu/users/griffpatch/messages/count]::#8BC34A)
I am using a page that doesn't output a very large string, yet is on Scratch. I chose griffpatch because he almost always has a nonzero message count.

([fruit/apples] of [{"fruit": {"apples": 2, "bananas": 3}, "total_fruit": 5}]::#8BC34A)
Parses the JSON and outputs the object at that path. If there's nothing at that path, then it returns an empty string. If there's an object, it returns the JSON of the object. I don't think the block is very intuitive, and it can be worded better. However, it will help beginners learn about the uses of the previous block.

<[true]::#8BC34A>
Not very intuitive; it literally just returns what you put in. However, it's a boolean reporter, so you can use it to put variables in if blocks:
if <(game running?)::#8BC34A> then
...
end

(replace [bananas are awesome. i like bananas.] using the rule [banana] with [apple]::#8BC34A)
Uses regex to replace the string (the second input is the regex). The replacement is unfortunately case insensitive, which I feel will better fit the other Scratch blocks. You can replace captured groups using $n.
i added true and false booleans and pi reporters in my extension
johnelr
Scratcher
1000+ posts

Scratch 3.0 Utilities extension

set [variable v] to (get html from [https://example.com])
Cool_puppy28
Scratcher
8 posts

Scratch 3.0 Utilities extension

Hallo. This is cool
Hypercrafter200
Scratcher
5 posts

Scratch 3.0 Utilities extension

I found a bug, the block below won't report anything
(get content from [(join [https://api.scratch.mit.edu/users/] (join (your username here) [/messages/count])::#8BC34A)
can you fix it?
celleron56
Scratcher
89 posts

Scratch 3.0 Utilities extension

this is very cool (could you try to add a add / replace (item in json) ) and try to get it approved by the ST because i really want this in scratch
Sheep_maker
Scratcher
1000+ posts

Scratch 3.0 Utilities extension

Hypercrafter200 wrote:

I found a bug, the block below won't report anything
(get content from [(join [https://api.scratch.mit.edu/users/] (join (your username here) [/messages/count])::#8BC34A)
can you fix it?
For security reasons, websites by default do not let other web pages from getting their content; this is called the CORS policy
JJ09012011
Scratcher
100+ posts

Scratch 3.0 Utilities extension

Wow, the blocks are useful for my games.
Astro202
Scratcher
82 posts

Scratch 3.0 Utilities extension

NICE!!!!!!
0znzw
Scratcher
83 posts

Scratch 3.0 Utilities extension

ygi7d5u6dtifuygio;ilu6y5t4syedtrfykguh
thewolfydude4313
Scratcher
9 posts

Scratch 3.0 Utilities extension

0znzw wrote:

ygi7d5u6dtifuygio;ilu6y5t4syedtrfykguh
* did you type
learn to type perfectly
im not a bully btw

Powered by DjangoBB