Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Taking an array separated by a certain character e.g ] and separate each array item into a item in a list.
- IssBjorn
-
New Scratcher
20 posts
Taking an array separated by a certain character e.g ] and separate each array item into a item in a list.
Can I do this? If so then how would I do this? Thanks
- applejuiceproduc
-
Scratcher
1000+ posts
Taking an array separated by a certain character e.g ] and separate each array item into a item in a list.
Can I do this? If so then how would I do this? ThanksI'm pretty sure this is extremely hard to do, if it's even possible on scratch. Depending on your project, you might want to start using a different programming language, as scratch isn't advanced enough for stuff like this but most other programming languages can do it pretty easily.
- IssBjorn
-
New Scratcher
20 posts
Taking an array separated by a certain character e.g ] and separate each array item into a item in a list.
Can I do this? If so then how would I do this? ThanksI'm pretty sure this is extremely hard to do, if it's even possible on scratch. Depending on your project, you might want to start using a different programming language, as scratch isn't advanced enough for stuff like this but most other programming languages can do it pretty easily.
Problem is I know only two programming languages, scratch and monkey c (which is a failry basic sdk for smartwatches and gps devices made by garmin). Is there anything visual like scratch I could use but with the ability to do this?
- deck26
-
Scratcher
1000+ posts
Taking an array separated by a certain character e.g ] and separate each array item into a item in a list.
Perfectly possible but you'll need to build each item character by character since Scratch's string handling is poor.
set var to blank
look at each character in turn and if not separator append to var else save var to list and set to blank
Just be careful to save the var at the end if it contains anything.
set var to blank
look at each character in turn and if not separator append to var else save var to list and set to blank
Just be careful to save the var at the end if it contains anything.
- IssBjorn
-
New Scratcher
20 posts
Taking an array separated by a certain character e.g ] and separate each array item into a item in a list.
Perfectly possible but you'll need to build each item character by character since Scratch's string handling is poor.
set var to blank
look at each character in turn and if not separator append to var else save var to list and set to blank
Just be careful to save the var at the end if it contains anything.
Good news! it works!
- msztr
-
Scratcher
100+ posts
Taking an array separated by a certain character e.g ] and separate each array item into a item in a list.
And don't forget to make the Separate block ‘run without screen refresh’!

Last edited by msztr (Aug. 8, 2022 16:27:53)
- Discussion Forums
- » Help with Scripts
-
» Taking an array separated by a certain character e.g ] and separate each array item into a item in a list.





