Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Character Placement in a String
- eefie_gang
- Scratcher
26 posts
Character Placement in a String
I am helping someone make a save system for their game, but I am having issues with the loading system. I can not figure out how to detect what position a specific character is in the string. let's say I have a save code something like this “816746334,8744.37484553/38594”. so lets say I am trying to get the number in between the comma and the period, I would say to just take specific characters but the issue is that the other numbers can vary in size. like the first number could be anywhere form 3 characters to 40 characters. so my question is how do I detect what position the comma is in the variable string?
ask [Are you subscribed to Nolswit on Youtube?] and waitCurrently working on: Nuclear Platformer
if <(answer) = [Yes]> then
say [Thank you!]
else
Redirect to [www.youtube.com/@Nolswit]
end
- BigNate469
- Scratcher
1000+ posts
Character Placement in a String
set [index v] to [0]
set [output v] to []
repeat until <(letter (index) of [save code]) = [,]>
change [index v] by [1]
end
repeat until <(letter (index) of [save code]) = [.]>
set [output v] to (join [output] (letter (index) of [save code]))
change [index v] by [1]
end
Highlight any part of this signature and press ctrl+shift+down arrow to see the rest of it
foreverPlease read the list of Officially Rejected Suggestions before posting a suggestion for Scratch! 100th post
if <person asks [what's a signature] :: sensing> then
Redirect to [https://en.scratch-wiki.info/wiki/Signature] :: motion
end
end
This signature is designed to be as helpful as possible.
View all of the topics you've posted in:
https://scratch.mit.edu/discuss/search/?action=show_user&show_as=topics
View all of your posts:
https://scratch.mit.edu/discuss/search/?action=show_user&show_as=posts
Forum tips:
Don't post in topics where the latest post is over ~2 months old, unless you have something critical to add. Especially in topics that are several years old- it isn't helpful, and is known as necroposting.
Don't post unrelated things in topics, including questions of your own. Make a new topic for your questions.
You can use the
[color=color name or hexadecimal value here] and [/color]
Lesser-known Scratch URLs:
https://scratch.mit.edu/projects/PROJECT ID HERE/remixtree (replace “PROJECT ID HERE” with project id number. Shows all the remixes of the project, and the remixes of those projects, and the remixes of those projects, and so on, as a chart. Link currently redirects to one of my projects)
View a larger list at: https://scratch.mit.edu/discuss/topic/542480/
Why @Paddle2See's responses are so often identical: https://scratch.mit.edu/discuss/topic/762351/
1000th post
- eefie_gang
- Scratcher
26 posts
Character Placement in a String
tysm it work
ask [Are you subscribed to Nolswit on Youtube?] and waitCurrently working on: Nuclear Platformer
if <(answer) = [Yes]> then
say [Thank you!]
else
Redirect to [www.youtube.com/@Nolswit]
end
- Discussion Forums
- » Help with Scripts
- » Character Placement in a String