Discuss Scratch

Testingscratcher
Scratcher
72 posts

I am on GitHub! (making Scratch blocks for hopeful future implementation)

So I recently got the Git repositories for Scratch, and I have so far coded two new blocks! No, these are not official blocks, but I'm hoping that, with some time passed, they will be. The new blocks are as follows:



The first block is actually the second one which I had initially created an issue for. This shorthand variant of the “if <> then {} else {}” would be especially useful for setting variables or values quickly, and in a nicely compacted manner. The C or E-shaped blocks already included would still be more useful for task-oriented blocks of code, or for when the stack blocks within them are not identical. Just that this new one would be better-suited for smaller, simpler applications, like setting a variable p to “this is tasty” if, say, pizza with pineapple is your favorite food, or “this is nasty” if it isn't. Just an example anyway. X3

And yes, leaving the false value blank will still edit your variables, so continue to use C-shaped “if <> then {}” blocks for this purpose unless you need a “this is false” value.

The second block is actually the first one which I had created an issue for, and was also the first block I coded for my fork of the Scratch repositories. We already have blocks like…

(item # of ( v) in [list v] :: list)

… in Scratch 3.0, which are great, but what about a version for strings instead of lists? This second new block is a simplified version of appending each character of a string to a list, and then using the aforementioned block to get your value. Another thing it does is it takes sequences of characters (something that even workarounds can't solve efficiently), and outputs either the position of the single letter, or the position of the first character in a sequence. If what you're looking for isn't there, then a return of “0” appears instead; it's the zeroth character, but it doesn't exist at all. Pretty neat, yea?

Anyway, I think this is fun. I've got one more block planned on behalf of another forum member, and I'll take suggestions for two more, so that I'll have a roster here of five working Scratch blocks which may hopefully be officially added to Scratch 3.0 in the future. :3
WaterComesBack
Scratcher
100+ posts

I am on GitHub! (making Scratch blocks for hopeful future implementation)

Github. Hmm, I think it's rejected. I might be wrong.
TCLoRS Wrote:
2.2 Text-based coding in Scratch
Some users wish to code Scratch not with the blocks, but with typing code instead (similar to how more advanced programming languages work). However, the Scratch Team has discussed this possibility multiple times and has decided every time that it would not be beneficial for beginners or for teachers.

One amazing thing about block-based programming is that syntax errors largely do not exist. Text-based programming would introduce syntax errors which younger users might not understand.

This suggestion extends to coding Scratch in any text, including BBCode, Javascript, some form of pseudocode, or some other programming language. If you wish to code using another language, then you can learn it on your own, but it would have to be done outside of Scratch.
Testingscratcher
Scratcher
72 posts

I am on GitHub! (making Scratch blocks for hopeful future implementation)

WaterComesBack wrote:

Github. Hmm, I think it's rejected. I might be wrong.
Only the Scratch source code is written in JavaScript. The implemented blocks, however, would still follow the regular Scratch block format, and that is the topic of this thread.

Rather, I'm assuming that's a rejected suggestion? What you have quoted is talking about possibly replacing Scratch itself with a derivation of, say, JavaScript, which is 100% typing and 0% block dragging.

Last edited by Testingscratcher (Aug. 18, 2019 18:16:00)

Za-Chary
Scratcher
1000+ posts

I am on GitHub! (making Scratch blocks for hopeful future implementation)

The official rejected suggestion that @WaterComesBack mentioned is about the possibility of an official way to allow users to code Scratch using text (such as Javascript, BBCode, or some other form of text) — whether it be replaced by the block-based programming, or is merely an extra option, we have decided not to add such a feature.

I don't think that's what you're suggesting here, though.

Last edited by Za-Chary (Aug. 18, 2019 18:19:39)

WaterComesBack
Scratcher
100+ posts

I am on GitHub! (making Scratch blocks for hopeful future implementation)

Za-Chary wrote:

The official rejected suggestion that @WaterComesBack mentioned is about the possibility of an official way to allow users to code Scratch using text (such as Javascript, BBCode, or some other form of text).

I don't think that's what you're suggesting here, though.
Oh? Code? Blocks? Sorry, didn't know what that meant
-ShadowOfTheFuture-
Scratcher
1000+ posts

I am on GitHub! (making Scratch blocks for hopeful future implementation)

This sounds cool, hope the Scratch Team adds your blocks in the future!
Sheep_maker
Scratcher
1000+ posts

I am on GitHub! (making Scratch blocks for hopeful future implementation)

I think changing the wording of the second block to
(position of [] in []::operators)
would be more familiar to Scratchers.

Your first block would differ from the ternary operator in other programming languages because all of its inputs are be evaluated, so if there was a block like
(delete last item of [list v]::list) // pop in some other languages
which would delete the last item and report it, something like
set [popped item v] to ((delete last item of [list 1 v]::list) if <(list) = [list 1]> else (delete last item of [list 2 v]::list)::operators)
which is meant to pop the item from list 1 only if (list) is “list 1” and from list 2 otherwise, would unexpectedly delete the last item from both lists.

Of course, this wouldn't be noticeable until Scratch adds custom reporters or an extension comes with a reporter with side effects.
Testingscratcher
Scratcher
72 posts

I am on GitHub! (making Scratch blocks for hopeful future implementation)

I don't know… are you suggesting that I also add the…

(delete last item of [list v] :: list)

… block as well? Because I can surely do that. It isn't technically a block already in the code. Well, a stack block is, but not a reporter.

Last edited by Testingscratcher (Aug. 19, 2019 05:03:21)

Testingscratcher
Scratcher
72 posts

I am on GitHub! (making Scratch blocks for hopeful future implementation)

Oh, also, no… it returns only one or the other. If it's true, it only returns the first one. That's the way I coded it. It is impossible to return both of them at exactly the same time.

Last edited by Testingscratcher (Aug. 19, 2019 05:09:24)

ScolderCreations
Scratcher
1000+ posts

I am on GitHub! (making Scratch blocks for hopeful future implementation)

These are blocks I would definitely want in Scratch, although I'm not sure if this was the original suggestion. It's definitely an easy way for the ST to implement it though, the code is public.
TheTrillion
Scratcher
500+ posts

I am on GitHub! (making Scratch blocks for hopeful future implementation)

(() if <> else ()::operators)
Perhaps the block right above this paragraph should be the same block as Scratch's current if else. However when Scratch's current if else is dragged into an input, it transforms into the block you have proposed, so as to not confuse young users, who may be wondering what are the use cases for this block.
Theultracyan_Mod
Scratcher
23 posts

I am on GitHub! (making Scratch blocks for hopeful future implementation)

umm idk how to make a number or text and boolean colored

Last edited by Theultracyan_Mod (Feb. 25, 2023 09:14:48)

Theultracyan_Mod
Scratcher
23 posts

I am on GitHub! (making Scratch blocks for hopeful future implementation)

My own Scratch Blocks
when [loudness v] = () :: hat
When the timer or loudness is Equals the Value, the script activates

Last edited by Theultracyan_Mod (Feb. 25, 2023 09:27:36)

gdfsgdfsgdfg
Scratcher
1000+ posts

I am on GitHub! (making Scratch blocks for hopeful future implementation)

ok

for () if <> else ()

if <…> then 
set [foo v] to [a]
else
set [foo v] to [apple]
end
medians
Scratcher
1000+ posts

I am on GitHub! (making Scratch blocks for hopeful future implementation)

gdfsgdfsgdfg wrote:

ok

for () if <> else ()

Well, it's known as ternary operators, but it can get annoying having to do that with a lot of if statements.
The last one can be replicated like this:

Or by adding the characters of the string to a list:
Crispydogs101
Scratcher
1000+ posts

I am on GitHub! (making Scratch blocks for hopeful future implementation)

I feel like this can have many uses. Instead of being a “Only can be used for one purpose” this could be used for a lot of things. And it can be easier to make complex projects.

Powered by DjangoBB