1
QB64 Discussion / Re: XML in QB64?
« on: May 27, 2020, 01:45:04 pm »
Yeah it's what I was hoping to avoid, anyway. Probably what I already have is good enough, as long as I remember that I have to enclose the tile numbers in quotes when reading from the CSV file so that it interprets it as a single string variable. Which is easy for me to do, but I'm wanting to make the file format somewhat intuitive for others as well, there may be someone who plays my game that wants to make their own custom levels.
Here's another question while we're on the topic of parsing strings: It's something I've never really done before in BASIC. So, I'm not sure if the way I've come up with to parse a string is the best way. Here's what I've got:
Where "tiles$" is the string from the CSV that lists the numbers of the image tiles you want to use, and "tile%" is the extracted value that you use to actually find the tile. This bit of code definitely works, I just have this feeling that there's a better way to do it.
EDIT: Modified the code as follows so that I'm not calling MID$ three times every loop:
Here's another question while we're on the topic of parsing strings: It's something I've never really done before in BASIC. So, I'm not sure if the way I've come up with to parse a string is the best way. Here's what I've got:
Code: QB64: [Select]
- strindex% = strindex% + 1
- strindex% = strindex% + 1
Where "tiles$" is the string from the CSV that lists the numbers of the image tiles you want to use, and "tile%" is the extracted value that you use to actually find the tile. This bit of code definitely works, I just have this feeling that there's a better way to do it.
EDIT: Modified the code as follows so that I'm not calling MID$ three times every loop:
Code: QB64: [Select]