Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Scratch 3.0
- NickyNouse
-
1000+ posts
Scratch 3.0
Check it out!) The current methods involve forcing particular costume names, or adding an obscene number of variables (plus some hacked blocks) to the project.Recently I've been working on making a text rendering engine in Scratch, and have run into a bit of an issue: It's impossible to detect whether a letter is capital or lowercase in any sort of simple way. (
I'd rather avoid forcing users of my custom block to give their sprite's costumes weird names, and I don't want to use hacked blocks if I can help it (in accordance with the ST's own sugguestions!)
This has led me back to thinking about the wonderful new “contains” block in 3.0. Should the “contains” block be case-sensitive?
Currently it isn't, and there are a lot of great cases to be made for keeping it that way. Making the block case-insensitive keeps it consistent with the = block and helps new Scratchers avoid difficult-to-understand bugs (particularly, I would imagine, when using the “contains” block in conjunction with the “answer” block). However, I would really like to see this changed. Giving users a variety of options, rather than sticking to consistency between the = and “contains” blocks, would allow for more programs to be made more easily.
For instance, here is a case detection script written with a case-sensitive “contains” block:if <[ABCDEFGHIJKLMNOPQRSTUVWXYZ] contains (letter) ::operators> then
set [uppercase? v] to [true]
else
set [uppercase? v] to [false]
end
It's dead simple!
I understand that there are a lot of downsides to making the “contains” block case-sensitive, but there are also some considerable benefits. I'd be curious to know whether the Scratch team has already had a discussion about this, and what they think. (As well as the opinions of all of you fine folks here on the forums!)
some other threads
(should this be moved here?)
There's a discussion about this on GitHub here: https://github.com/LLK/scratch-vm/issues/536
- PullJosh
-
1000+ posts
Scratch 3.0
It actually makes a lot of sense to add blocks to convert to uppercase or convert to lowercase, and leave the “contains” block alone. Case detection would still be easy:
<((letter) to lowercase ::operators) = (letter) > // Report "true" if lowercase
<((letter) to uppercase ::operators) = (letter) > // Report "true" if uppercase
- AcousticGuy
-
87 posts
Scratch 3.0
I like this because then we could put another option for the boolean<[] is capital? ::sensing>
<(letter () of [world]) is capital? ::sensing>
- Jonathan50
-
1000+ posts
Scratch 3.0
Those would always report true because = isn't case sensitive. It actually makes a lot of sense to add blocks to convert to uppercase or convert to lowercase, and leave the “contains” block alone. Case detection would still be easy:<((letter) to lowercase ::operators) = (letter) > // Report "true" if lowercase
<((letter) to uppercase ::operators) = (letter) > // Report "true" if uppercase
- PullJosh
-
1000+ posts
Scratch 3.0
Those would always report true because = isn't case sensitive.doh! You're right.

- Charles12310
-
1000+ posts
Scratch 3.0
Anything that is not a letter or contains letters will report false. A string that contains lowercase will report false. A string must be fully uppercase to report true and must have only letters in it.I like this block, but the naming is ambiguous: another option for the boolean<[] is capital? ::sensing><[happiness] is capital? ::sensing>
<[UPPERlower] is capital? ::sensing>
<[123] is capital? ::sensing>
<[._.] is capital? ::sensing>
- Sheep_maker
-
1000+ posts
Scratch 3.0
Maybe the less than and greater than blocks can be made case-sensitive.
In JavaScript:
In Scratch 2.0, both report false (because they're the same):
EDIT:
“C”<“[” in JS returns true, but the same thing in Scratch returns false, so I'm assuming the less than/greater than blocks lowercases its inputs before testing
In JavaScript:
"C">"c" // false
"C"<"c" // true
<[C]>[c]> // falseSince the only time the less than/greater than block is used with strings is with sorting, I don't think making the block case sensitive will break much projects.
<[C]<[c]> // false
EDIT:
“C”<“[” in JS returns true, but the same thing in Scratch returns false, so I'm assuming the less than/greater than blocks lowercases its inputs before testing
Last edited by Sheep_maker (Sept. 13, 2017 01:23:50)
- Jonathan50
-
1000+ posts
Scratch 3.0
Would it sort like ABCDEF…abcdef… (or abcdef…ABCDEF…) or like AaBbCcDdEeFf… (or aAbBcCdDeEfF)?
I would expect < and > to be consistent with = but maybe it'd be okay.
I would expect < and > to be consistent with = but maybe it'd be okay.
- TheUltimatum
-
1000+ posts
Scratch 3.0
Wait you can use the “<” and “>” for comparing strings? Maybe the less than and greater than blocks can be made case-sensitive.
In JavaScript:In Scratch 2.0, both report false (because they're the same):"C">"c" // false
"C"<"c" // true<[C]>[c]> // falseSince the only time the less than/greater than block is used with strings is with sorting, I don't think making the block case sensitive will break much projects.
<[C]<[c]> // false
EDIT:
“C”<"[" in JS returns true, but the same thing in Scratch returns false, so I'm assuming the less than/greater than blocks lowercases its inputs before testing
- NitroCipher
-
500+ posts
Scratch 3.0
Maybe the less than and greater than blocks can be made case-sensitive.
In JavaScript:In Scratch 2.0, both report false (because they're the same):"C">"c" // false
"C"<"c" // true<[C]>[c]> // falseSince the only time the less than/greater than block is used with strings is with sorting, I don't think making the block case sensitive will break much projects.
<[C]<[c]> // false
EDIT:
“C”<"[" in JS returns true, but the same thing in Scratch returns false, so I'm assuming the less than/greater than blocks lowercases its inputs before testing
I think the best way to handle case sensitivity (using < & > ) would be to get the total score for capitalization.
<[Hello]< [world]> //input one would have a score of 1 and two would have 0
<[HeLlO]< [wOrLd]> //one=3 and two=2
<[ABCDEFGHIJKLMNOPQRSTUVWXYZ] < [abcdefghijklmnopqrstuvwxyz] > //one=26 and two=0
- Sheep_maker
-
1000+ posts
Scratch 3.0
YesWait you can use the “<” and “>” for comparing strings? Maybe the less than and greater than blocks can be made case-sensitive.
In JavaScript:In Scratch 2.0, both report false (because they're the same):"C">"c" // false
"C"<"c" // true<[C]>[c]> // falseSince the only time the less than/greater than block is used with strings is with sorting, I don't think making the block case sensitive will break much projects.
<[C]<[c]> // false
EDIT:
“C”<"[" in JS returns true, but the same thing in Scratch returns false, so I'm assuming the less than/greater than blocks lowercases its inputs before testing
I think strings that are closer to the Z-side when ordered alphabetically are worth more than those on the A-side. Perhaps it has something to do with their ASCII value thing
- NickyNouse
-
1000+ posts
Scratch 3.0
There are a few issues I can see popping up with this technique:Maybe the less than and greater than blocks can be made case-sensitive.
In JavaScript:In Scratch 2.0, both report false (because they're the same):"C">"c" // false
"C"<"c" // true<[C]>[c]> // falseSince the only time the less than/greater than block is used with strings is with sorting, I don't think making the block case sensitive will break much projects.
<[C]<[c]> // false
EDIT:
“C”<"[" in JS returns true, but the same thing in Scratch returns false, so I'm assuming the less than/greater than blocks lowercases its inputs before testing
I think the best way to handle case sensitivity (using < & > ) would be to get the total score for capitalization.<[Hello]< [world]> //input one would have a score of 1 and two would have 0
<[HeLlO]< [wOrLd]> //one=3 and two=2
<[ABCDEFGHIJKLMNOPQRSTUVWXYZ] < [abcdefghijklmnopqrstuvwxyz] > //one=26 and two=0
- it might cause compatibility issues for older projects.
- it might not always be clear whether numbers should be treated as numerical values or ASCII values. Might cause issues with negatives, e-notation, etc.
- < and > might not be the way new scratchers would expect to test capitalization
- likewise, it's not obvious that those examples are testing capitalization. Inexperienced users might be confused when seeing this used in other people's projects (but that leads to a whole different discussion about the usability of string inequality at all)
All of those issues could be circumvented by adding a new block instead
- AcousticGuy
-
87 posts
Scratch 3.0
I still think I will like 2.0 better but it would be nice if we had more blocks like islowercase. I hope that 3.0 is good!
Last edited by AcousticGuy (Sept. 14, 2017 15:28:16)
- Jonathan50
-
1000+ posts
Scratch 3.0
That's what the scratch-blocks playgrounds looked like when they were first on GitHub in May 2016, it looks a lot better nowthat version of scratch 3…. sooo badhttp://i.cubeupload.com/sFT361.png
Lol this is so cool! (Don't worry there's vertical blocks too)
http://i.cubeupload.com/mttik5.png
I believe the scratchblocks tag was a mistake. I removed it, and now the post makes a lot more sense. (though the images do appear spammy.)
where can you get that!?

That first image is what happens when you click “Sprinkles!” in the horizontal playground btw.
Last edited by Jonathan50 (Sept. 15, 2017 02:23:51)
- MinecraftM153
-
100+ posts
Scratch 3.0
ooohhhThat's what the scratch-blocks playgrounds looked like when they were first on GitHub in May 2016, it looks a lot better nowthat version of scratch 3…. sooo badhttp://i.cubeupload.com/sFT361.png
Lol this is so cool! (Don't worry there's vertical blocks too)
http://i.cubeupload.com/mttik5.png
I believe the scratchblocks tag was a mistake. I removed it, and now the post makes a lot more sense. (though the images do appear spammy.)
where can you get that!?The playgrounds are here now: http://llk.github.io/scratch-blocks/
That first image is what happens when you click “Sprinkles!” in the horizontal playground btw.
- Ceo_
-
500+ posts
Scratch 3.0
They added a new block

I like it
(if you haven't get it, they added extensions and probably other things)

I like it
(if you haven't get it, they added extensions and probably other things)
Last edited by Ceo_ (Sept. 19, 2017 17:17:53)