Discuss Scratch

minecraftpawa
Scratcher
100+ posts

New Operator block: letters _ to _ of _

Currently, getting part of a variable is complicated since Scratch only supports getting one letter of a variable at a time. The following block would be easily understandable and useful. (For splitting variables, for example.)
(letters () to () of [world] :: operators)

Last edited by minecraftpawa (Feb. 9, 2022 14:25:42)

Autofirejm
Scratcher
1000+ posts

New Operator block: letters _ to _ of _

minecraftpawa wrote:

Currently, getting part of a variable is complicated since Scratch only supports getting one letter of a variable at a time. The following block would be easily understandable and useful. (For splitting variables, for example.)
(letters () to () of [world] :: operators)
How would this work? would it do something like
(Letters (a) to (a) of [papaya] :: operators) // apaya 
Or
(Letters (a) to (a) of [papaya] :: operators) // a
ideapad-320
Scratcher
1000+ posts

New Operator block: letters _ to _ of _

Support!
minecraftpawa
Scratcher
100+ posts

New Operator block: letters _ to _ of _

Autofirejm wrote:

minecraftpawa wrote:

Currently, getting part of a variable is complicated since Scratch only supports getting one letter of a variable at a time. The following block would be easily understandable and useful. (For splitting variables, for example.)
(letters () to () of [world] :: operators)
How would this work? would it do something like
(Letters (a) to (a) of [papaya] :: operators) // apaya 
Or
(Letters (a) to (a) of [papaya] :: operators) // a
(letters (1) to (3) of [world] :: operators)
outputs wor.
Letter detection in variables would be nice too, but it'd likely be more complicated and would be a separate thing.

Last edited by minecraftpawa (Feb. 9, 2022 15:00:29)

jtarps
Scratcher
28 posts

New Operator block: letters _ to _ of _

Support I had an issue with that yesterday and had to use
(join (join (letter (2) of (word)) (letter (3) of (word))) (join (letter (4) of (world)) (letter (5) of (world))))
it wasn't fun
MagicCoder330
Scratcher
1000+ posts

New Operator block: letters _ to _ of _

Support. this makes a lot of sense
smisamul6
Scratcher
100+ posts

New Operator block: letters _ to _ of _

Support! This would be veeery useful.
Spaceboy1010
Scratcher
100+ posts

New Operator block: letters _ to _ of _

Support! I too had to do a billion join blocks, this would make things a whole lot easier.
minecraftpawa
Scratcher
100+ posts

New Operator block: letters _ to _ of _

jtarps wrote:

Support I had an issue with that yesterday and had to use
(join (join (letter (2) of (word)) (letter (3) of (word))) (join (letter (4) of (world)) (letter (5) of (world))))
it wasn't fun
It's even worse if the length of the part you need to get doesn't stay the same, because in that case you need to do something like this:
define getsection (start) (length) (word)
set [i v] to (start)
set [storage v] to []
repeat (length)
set [storage v] to (join (storage) (letter (i) of (word)))
change [i v] by (1)
end
twogadugary
Scratcher
100+ posts

New Operator block: letters _ to _ of _

Having it in a reporter would be far more easy and convenient than having to make a workaround script, and this wouldn't confuse new or younger users.
Icefan13
Scratcher
100+ posts

New Operator block: letters _ to _ of _

support. Maybe also a block like
(letters [after v] () of [world]::operators//reports all the letters before or after the given value
minecraftpawa
Scratcher
100+ posts

New Operator block: letters _ to _ of _

Icefan13 wrote:

support. Maybe also a block like
(letters [after v] () of [world]::operators//reports all the letters before or after the given value
Maybe, but that could relatively easily be done with something like this:
(letter (5) to (length of (word)) of (word)::operators)
I don't think a ‘letters after x’ block is useful enough to warrant being added, and would simply make the operators section more cluttered.

Last edited by minecraftpawa (Feb. 11, 2022 14:07:08)

Powered by DjangoBB