Discuss Scratch

4Parrots
Scratcher
46 posts

Commands help

Hello ! I want to create commands (Like “give data 300”) but i dont know how to say “ok, first world is what i do (give), second word is what i give and number is how much i want”. If anyone can help/tell me how to do something like this, please awnser me ^^
gor-dee
Scratcher
1000+ posts

Commands help

You would need to separate the words, then use them by either comparing them to words in a list or using a lot of IF THEN ELSEs. To separate them you need to go through the command letter by letter, building up a word until you get to a space. Use the
(letter () of [world])
and
(join [] [world])
blocks.
I have an example here https://scratch.mit.edu/projects/413989104/editor/ but it might be a bit difficult to follow. I'll see if I can find a better example…
4Parrots
Scratcher
46 posts

Commands help

I did'nt really understand x) I found a “solution” but i prefer to write “give data 400” than “give” next “data” next “400”, Its not my objective and I want to make my game clean


Last edited by 4Parrots (March 1, 2021 21:32:50)

gor-dee_test
Scratcher
100+ posts

Commands help

I cleaned up that project and made this https://scratch.mit.edu/projects/494850688/
4Parrots
Scratcher
46 posts

Commands help

Ok it works and its easy to edit, ty !

Powered by DjangoBB