Discuss Scratch
- redgreenandblue
- Scratcher
100+ posts
Replace letter () of () with ()
I think there should be a
It would show in the block library as
(replace letter () of [] with []::operators)This would be extremely helpful for variables!
It would show in the block library as
(replace letter (1) of [jello world!] with [h]::operators)If somebody knows a simple workaround that would also work.
Last edited by redgreenandblue (May 29, 2016 01:32:11)
- ipushpeople
- Scratcher
100+ posts
Replace letter () of () with ()
on a scale of “simple workaround” to “not simple workaround” i would rate that “very not simple workaround”define replace letter (letter) of [text] with [string]
set [i v] to [1]
repeat (length of (text))
add (letter (i) of (text)) to [tmp v]
change [i v] by (1)
end
replace item (letter) of [tmp v] with (string)
set [result v] to (tmp :: list)
-D
- NanoRook
- Scratcher
1000+ posts
Replace letter () of () with ()
define replace letter (letter) of [text] with [string]
set [i v] to [1]
repeat (length of (text))
add (letter (i) of (text)) to [tmp v]
change [i v] by (1)
end
replace item (letter) of [tmp v] with (string)
set [result v] to (tmp :: list)
that isn't a simple workaround at all.
Semi-Support, it's obvious this could help but I can't think of anything.
I LOVE BEING PURPLE!!!! JOIN THE PURPLE COALITION TODAY IF YOU ALSO LOVE BEING PURPLE. PURPLE IS THE NEW BLUE! PURPLE IS THE SUPERIOR NAVBAR COLOR! YYYEAAHHHHH BABY!!!!
- alexphan
- Scratcher
1000+ posts
Replace letter () of () with ()
on a scale of “simple workaround” to “not simple workaround” i would rate that “very not simple workaround”define replace letter (letter) of [text] with [string]
set [i v] to [1]
repeat (length of (text))
add (letter (i) of (text)) to [tmp v]
change [i v] by (1)
end
replace item (letter) of [tmp v] with (string)
set [result v] to (tmp :: list)
-D
You are all so nicedefine replace letter (letter) of [text] with [string]
set [i v] to [1]
repeat (length of (text))
add (letter (i) of (text)) to [tmp v]
change [i v] by (1)
end
replace item (letter) of [tmp v] with (string)
set [result v] to (tmp :: list)
that isn't a simple workaround at all.
/sarcasm
Programming isn't meant to be easy. Besides, the workaround that I provided (Breck-'s my other account) is not that complicated. It's just adding characters to a list and replacing an item. It's better than this method:
define change (character#) of string to (new character)
set [changer v] to []
set [item# v] to (1)
repeat ((character#) - (1))
set [changer v] to (join (changer) (letter (item#) of (string)))
change [item# v] by (1)
end
set [changer v] to (join (changer) (new character))
set [item# v] to ((character#) + (1))
repeat ((length of (string)) - (character#)
set (changer) to (join (changer) (letter (item#) of (string)))
change [item# v] by (1)
end
set [string v] to (changer
Last edited by alexphan (May 29, 2016 18:32:38)
- helloandgoodbye9
- Scratcher
1000+ posts
Replace letter () of () with ()
No support due to easy workaround.
(Want to see some hard ones? See https://scratch.mit.edu/discuss/topic/195968/)
(Want to see some hard ones? See https://scratch.mit.edu/discuss/topic/195968/)
Last edited by helloandgoodbye9 (May 29, 2016 21:44:57)
Last edited by kaj (Tomorrow 25:61:61) ͪͪͪͪͪͪͪͪͪͪ ͣͣͣͣ ͯͯͯͯYes, its above the line)
- MathlyCat
- Scratcher
1000+ posts
Replace letter () of () with ()
I don't see it as “hard”. If you can run down and explain to yourself the function of each it's not necessarily difficult. As it seems there are much worse workarounds: Cloud Lists.on a scale of “simple workaround” to “not simple workaround” i would rate that “very not simple workaround”define replace letter (letter) of [text] with [string]
set [i v] to [1]
repeat (length of (text))
add (letter (i) of (text)) to [tmp v]
change [i v] by (1)
end
replace item (letter) of [tmp v] with (string)
set [result v] to (tmp :: list)
-D
Think before you act.
Actions speek louder than words.
hi there fella
Actions speek louder than words.
hi there fella
- jokebookservice1
- Scratcher
1000+ posts
Replace letter () of () with ()
If this isn't sarcasm (I can't tell) then No support due to easy workaround.
(Want to see some hard ones? Work around the if else block. )
define do if elseor more simply
if <...::grey> then
...
stop [this script v]
end
...
set [c v] to <...::grey>I used a variable because the first clause might change the value of the condition.
if <(c) = [true]> then
...
end
if <(c) = [false]> then
...
end
No support - it is an important concept that should be learned
- helloandgoodbye9
- Scratcher
1000+ posts
Replace letter () of () with ()
I was being sarcastic, but that would work.If this isn't sarcasm (I can't tell) then No support due to easy workaround.
(Want to see some hard ones? Work around the if else block. )define do if elseor more simply
if <...::grey> then
...
stop [this script v]
end
...set [c v] to <...::grey>I used a variable because the first clause might change the value of the condition.
if <(c) = [true]> then
...
end
if <(c) = [false]> then
...
end
No support - it is an important concept that should be learned
Last edited by helloandgoodbye9 (May 29, 2016 21:50:01)
Last edited by kaj (Tomorrow 25:61:61) ͪͪͪͪͪͪͪͪͪͪ ͣͣͣͣ ͯͯͯͯYes, its above the line)
- CodeLegend
- Scratcher
500+ posts
Replace letter () of () with ()
No support. Not because there's a workaround (most existent blocks in Scratch have a workaround), but because its potential applications are limited. It could also confuse newer coders. They could try this:
(replace letter (1) of (my variable) with [a]::operators)thinking that it would modify the variable.
- jokebookservice1
- Scratcher
1000+ posts
Replace letter () of () with ()
True. Though it is a rounded block, so it would be a bit more intuitive that it reports something No support. Not because there's a workaround (most existent blocks in Scratch have a workaround), but because its potential applications are limited. It could also confuse newer coders. They could try this:(replace letter (1) of (my variable) with [a]::operators)thinking that it would modify the variable.
- A-KouZ1
- Scratcher
100+ posts
Replace letter () of () with ()
Full support! (id wanna suggest this before, but like you already XD)
Because workaround is takes much of steps to run on scratch Interpreter,
I just want that the instruction is work instantly,
very useful, so I no need use the list for replace value of memory :p
Because workaround is takes much of steps to run on scratch Interpreter,
I just want that the instruction is work instantly,
very useful, so I no need use the list for replace value of memory :p
Somehow, I just need some of time and encourage…
- Sheep_maker
- Scratcher
1000+ posts
Replace letter () of () with ()
One thing that this block would be useful for is variable case sensing. Maybe this block:
(replace letters () through () of [] to []::operators)would allow the last input to have more than one character.
- Sheep_maker This is a kumquat-free signature. :P
This is my signature. It appears below all my posts. Discuss it on my profile, not the forums. Here's how to make your own.
.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }
- ASEMAZING
- Scratcher
100+ posts
Replace letter () of () with ()
Ok I see that people just like finding workarounds, but heres the thing: ALMOST ANY BLOCK IN SCRATCH RIGHT NOW COULD BE WORKEDAROUND! Anyways such as
Could be worked around as
Though there is a work around (and not an easy one in my opinion) I SUPPORT!!!
The main reason is this would totally help anyone and in reality, adding that block shouldn't be to hard for the ST anyway. (Compared to some other suggestion.)
Plus I was wanting this yesterday too! So deja vu!
-ASEMAZING
move () steps
Could be worked around as
change x by ()
Though there is a work around (and not an easy one in my opinion) I SUPPORT!!!
The main reason is this would totally help anyone and in reality, adding that block shouldn't be to hard for the ST anyway. (Compared to some other suggestion.)
Plus I was wanting this yesterday too! So deja vu!
-ASEMAZING
- redgreenandblue
- Scratcher
100+ posts
Replace letter () of () with ()
The last string input would be able to have multiple charachters anyway. I could do this: One thing that this block would be useful for is variable case sensing. Maybe this block:(replace letters () through () of [] to []::operators)would allow the last input to have more than one character.
(replace letter (1) of [jllo world!] with [he]::operators)
Last edited by redgreenandblue (May 30, 2016 00:31:34)
- ASEMAZING
- Scratcher
100+ posts
Replace letter () of () with ()
The last string input would be able to have multiple charachters anyway. I could do this: One thing that this block would be useful for is variable case sensing. Maybe this block:(replace letters () through () of [] to []::operators)would allow the last input to have more than one character.(replace letter (1) of [jllo world!] with [he]::operators)
Either would be great, but I kinda like what @Sheep_Maker said.
-ASEMAZING
- Abstract-
- Scratcher
1000+ posts
Replace letter () of () with ()
No, that's not a workaround. X does not move in the direction you are pointing. Steps does. Ok I see that people just like finding workarounds, but heres the thing: ALMOST ANY BLOCK IN SCRATCH RIGHT NOW COULD BE WORKEDAROUND! Anyways such asmove () steps
Could be worked around aschange x by ()
-ASEMAZING
- ASEMAZING
- Scratcher
100+ posts
Replace letter () of () with ()
No, that's not a workaround. X does not move in the direction you are pointing. Steps does. Ok I see that people just like finding workarounds, but heres the thing: ALMOST ANY BLOCK IN SCRATCH RIGHT NOW COULD BE WORKEDAROUND! Anyways such asmove () steps
Could be worked around aschange x by ()
-ASEMAZING
Yes, but you can use;
when green flag clicked
forever
if <key [Right Arrow v] pressed?> then
point in direction (90 v)
set x to [Whatever you want here]
end
end
And than repeat with the rest of the X and Y directions such as
point in direction (-90 v)
change x by (-10)
and than the Y's
- joefarebrother
- Scratcher
500+ posts
Replace letter () of () with ()
The real workaround for the move steps block is
The reason it exists even though it has a workaround is so people can still make games and animations without having to know trigonometry. However, the workaround for the suggestion doesn't require any special knowledge, just a bit of critical thinking and problem solving, which is what programming is about.
No support.
define move (steps) steps
go to x: ((x position) + (([sin v] of (direction)) * (steps))) y: ((y position) + (([cos v] of (direction)) * (steps))
The reason it exists even though it has a workaround is so people can still make games and animations without having to know trigonometry. However, the workaround for the suggestion doesn't require any special knowledge, just a bit of critical thinking and problem solving, which is what programming is about.
No support.
Last edited by joefarebrother (May 30, 2016 04:55:45)
- LFOB
- Scratcher
100+ posts
Replace letter () of () with ()
on a scale of “simple workaround” to “not simple workaround” i would rate that “very not simple workaround”define replace letter (letter) of [text] with [string]
set [i v] to [1]
repeat (length of (text))
add (letter (i) of (text)) to [tmp v]
change [i v] by (1)
end
replace item (letter) of [tmp v] with (string)
set [result v] to (tmp :: list)
-D
All they have to do is copy the script and use the custom block to do what they need…
(And this is very simple programming anyway…)
Last edited by LFOB (May 30, 2016 16:51:48)