Discuss Scratch

Sheep_maker
Scratcher
1000+ posts

Scratch 3.0 Utilities extension

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.

- Sheep_maker This is a kumquat-free signature. :P
.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }
Jeffalo
New to Scratch
14 posts

Scratch 3.0 Utilities extension

will this work when scratch 3 come out???


it very cool and make me happy

thank you,
jeffalo
Sheep_maker
Scratcher
1000+ posts

Scratch 3.0 Utilities extension

Jeffalo wrote:

will this work when scratch 3 come out???


it very cool and make me happy

thank you,
jeffalo
I can't guarantee it, but I'll try to update it if anything changes. I'd also have to get it approved by the ST before you can use it in your projects.

- Sheep_maker This is a kumquat-free signature. :P
.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }

Powered by DjangoBB

Standard | Mobile