Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » I need help with replacing a item from a variable.
- rleu
- Scratcher
29 posts
I need help with replacing a item from a variable.
I need some help with this script:
forever
if <(answer) contains [%name%]> then
set (my var) to (answer)
from (my var) replace %name% with (var).
say: (my var)
else
ask: Message:
say: (answer)
end
end
Last edited by rleu (July 30, 2021 18:52:00)
- The_Imaginarium
- Scratcher
1000+ posts
I need help with replacing a item from a variable.
Can you please elaborate on your problem?
- Yusei-Fudo
- Scratcher
1000+ posts
I need help with replacing a item from a variable.
Can you please elaborate on your problem?
I'm pretty sure it's if my variable contains a certain value, then it replaces those values from my variable with a value of some sort.
That's just my guess judging from the code.
I'm a decent coder who has a huge passion for coding. I taught myself all the coding skills I have now. And with those skills, I have made some pretty decent projects, check them out! Be sure to ⭐ ❤️ & Follow, too! I have a few pictures below which are actually links. Click on them to take to different projects that I made. Might come in handy. :)
Need a project where you can check to see if you can use someone's camera or not? Here's one:
Need a project to detect when someone has clicked the stop sign? Take a look at this:
Need a project that can point at specific clones, etc? Why not use this:
Need to prank someone? Tell them to click this picture, but also make sure they're signed onto Scratch, otherwise, it doesn't work:
For more of my projects, just click on this picture:
- The_Imaginarium
- Scratcher
1000+ posts
I need help with replacing a item from a variable.
foreverIs this correct?
if <(answer) contains [%name%] :: operators> then
set [my variable v] to (answer)
replace item (my variable) of [list v] with [%name%]
say(my variable)
else
ask [message] and wait
say (answer)
end
end
- Yusei-Fudo
- Scratcher
1000+ posts
I need help with replacing a item from a variable.
foreverIs this correct?
if <(answer) contains [%name%] :: operators> then
set [my variable v] to (answer)
replace item (my variable) of [list v] with [%name%]
say(my variable)
else
ask [message] and wait
say (answer)
end
end
I'm pretty sure it's only one specific string, not an item
Please elaborate on your question, we're guessing what's wrong.
Last edited by Yusei-Fudo (July 30, 2021 21:37:09)
I'm a decent coder who has a huge passion for coding. I taught myself all the coding skills I have now. And with those skills, I have made some pretty decent projects, check them out! Be sure to ⭐ ❤️ & Follow, too! I have a few pictures below which are actually links. Click on them to take to different projects that I made. Might come in handy. :)
Need a project where you can check to see if you can use someone's camera or not? Here's one:
Need a project to detect when someone has clicked the stop sign? Take a look at this:
Need a project that can point at specific clones, etc? Why not use this:
Need to prank someone? Tell them to click this picture, but also make sure they're signed onto Scratch, otherwise, it doesn't work:
For more of my projects, just click on this picture:
- Discussion Forums
- » Help with Scripts
- » I need help with replacing a item from a variable.