Discuss Scratch
- stickfiregames
- Scratcher
1000+ posts
letters () to () of () block
Why didn't I think of doing that?Even with the “no screen refresh” thing disabled? Wow. Support since other programming languages can do this. Also the workaround is very slow as I noticed when I used it to make a cloud encoder.
- MushroomMan99
- Scratcher
100+ posts
letters () to () of () block
If a New Scratcher wanted to make a Pig Latin translator like I did, the workaround would be far too complicated for them to understand so even if limiting the number of blocks makes things simpler, I still think it would be simpler to have the block
when green flag clicked
if <(language) = [English ]> then
say [Everything is Awesome!] for (2) secs
end
if <(language) = [French ]> then
say [Tout est super-genial!] for (2) secs
end
if <(language) = [Italian ]> then
say [E meraviglioso!] for (2) secs
end
if <(language) = [Spanish ]> then
say [Todo es fabuloso!] for (2) secs
end
- DadOfMrLog
- Scratcher
1000+ posts
letters () to () of () block
I've made… it… clear… before… (alongside many others) that I'd really like to see this block added - it would simplify the scripting of so many other string operations!
Scratch is relatively slow, since it has to perform translation of the blocks. That means the workaround takes several orders of magnitude longer than a built-in block would. And Scratch could really use all the help it can get, where doing so has no barriers to understanding - I have a hard time believing that anyone who can understand “letter N of STRING” would struggle with “letters M to N of STRING”. And as mentioned above, a built-in block is clearly way simpler than having to work out the script yourself.
It could be argued that it takes away the opportunity to learn a useful script. However, I have to admit that I can't see it as much of a loss, since the same basic loop construction appears in so many other situations…
However, the behaviour for cases like M<1, and/or N>length… I'd say it should just take its cue from the current behaviour of “letter N of STRING”, which ignores those parts beyond the start and end. As for M>N, well…
(Not suggesting a native ‘letters M to N" block should do that, though I’d hardly complain if there was a faster built-in way to do such a reversing…)
I get a bit annoyed when I see really short responses to suggestions.*Asks slightly nervously*… What about really long responses…? (Well, you did say “Please take the time to support your opinions with some arguments”!)
Apart from, as I mentioned at the start, making so many other things simpler, one compelling benefit is speed. I like to do text manipulation projects at times and I would love to have this block. Sure, there are ways to work around it - but they are not very clean. However, I also recognize that Scratch is intended to be simple to learn - and one way to keep it simple is to limit the number of blocks. So there have to be some very compelling benefits before a new block is added to the pallet.
Scratch is relatively slow, since it has to perform translation of the blocks. That means the workaround takes several orders of magnitude longer than a built-in block would. And Scratch could really use all the help it can get, where doing so has no barriers to understanding - I have a hard time believing that anyone who can understand “letter N of STRING” would struggle with “letters M to N of STRING”. And as mentioned above, a built-in block is clearly way simpler than having to work out the script yourself.
It could be argued that it takes away the opportunity to learn a useful script. However, I have to admit that I can't see it as much of a loss, since the same basic loop construction appears in so many other situations…
I don't see any ambiguity in the *meaning* here - the wording makes it clear (unlike a not-immediately-determinative operator name like ‘slice’ or some form of indexing). Ah yes, slicing. Unfortunate for the undefined behaviors here, such as invalid indexes. Will the starting index be inclusive and the ending index be exclusive, as in Python, such that end - start = length? Or will both be inclusive?
However, the behaviour for cases like M<1, and/or N>length… I'd say it should just take its cue from the current behaviour of “letter N of STRING”, which ignores those parts beyond the start and end. As for M>N, well…
As it happens, the string-manipulation project in my sig has a “letters M to N of STRING” custom block, and that reverses the order of characters if M>N. A text reverse block would go well with this.
(Not suggesting a native ‘letters M to N" block should do that, though I’d hardly complain if there was a faster built-in way to do such a reversing…)
Last edited by DadOfMrLog (Aug. 27, 2014 16:41:46)
Alternate account: TheLogFather –– HowTos and useful custom blocks (see studio). Examples below…
- String manipulation - - - X to power of Y - - - Clone point to clone - Detect New Scratcher - Speed tests studio -
- imadrainpipe
- Scratcher
100+ posts
letters () to () of () block
this would be very useful for compiling lists
- TimothyLawyer
- Scratcher
1000+ posts
letters () to () of () block
letters (1) to (3) of [world] :: customHonestly, though, that's why we need custom reporter blocks in general.
say (return) for (2) secs
say (letters (1) to (3) of [yes custom operators] :: custom) for (3e7) secs
BeetleBlocks, WatercolorBot, and Turtle Art
Hover over a name or label to translate into current language
When Earth was… Purple?
☂️
- TimothyLawyer
- Scratcher
1000+ posts
letters () to () of () block
It would be an operator What section does this go?
(letters (1) to (3) of [world] :: operators)similar to letter ( ) of [ ].
BeetleBlocks, WatercolorBot, and Turtle Art
Hover over a name or label to translate into current language
When Earth was… Purple?
☂️
- xX_Damion_Xx
- Scratcher
40 posts
letters () to () of () block
FULL SUPPORT!
REAAAALY useful for online saving.
REAAAALY useful for online saving.
- Charles12310
- Scratcher
1000+ posts
letters () to () of () block
This block should definitely be added for many purposes such as quizzes, and so we don't have to keep on using join blocks, and so we don't have to do too much scripting for detection.
Last edited by Charles12310 (Oct. 11, 2017 23:14:50)
A few internet communication companies want to corrupt the internet by getting rid of net neutrality. Stop Them!
- MCGUY15
- Scratcher
100+ posts
letters () to () of () block
(letters (2) to (8) of (qsupportdjjfisnvoa)
hi
- gavinskycastle
- Scratcher
85 posts
letters () to () of () block
I am suggesting a block like this(letters (1) to (3) of [world])
Cool idea! I've made scripts that act similarly to this, but this would definitely oversimplifiy it .
when green flag clicked
forever
if <someone is looking at this signature> then
ask [Why are you here?] and wait
if <(answer) = [I'm bored]> then
open link [https://scratch.mit.edu/users/gavinskycastle]
end
end
end
- Charles12310
- Scratcher
1000+ posts
letters () to () of () block
bump
A few internet communication companies want to corrupt the internet by getting rid of net neutrality. Stop Them!
- Charles12310
- Scratcher
1000+ posts
letters () to () of () block
Edited my post.Why? SUPPORT
A few internet communication companies want to corrupt the internet by getting rid of net neutrality. Stop Them!
- DaEpikDude
- Scratcher
1000+ posts
letters () to () of () block
yeah okEdited my post.Why? bump (formerly SUPPORT)
And all the world over, each nation's the same,
They've simply no notion of playing the game.
They argue with umpires, they cheer when they've won,
And they practice beforehand, which ruins the fun!
- ninjaMAR
- Scratcher
1000+ posts
letters () to () of () block
bump
support
i have always wanted this block
support
i have always wanted this block