Attached here is version 2. You might want to make sure there isn't a newer version later in the thread. There are a couple extra features that I'll go over later in the thread as well.
Why use this?
It's a quick way to get tabular data into your game.
Why not pull in records only when I need them?
CSV files don't work well as transactional databases. Also, this is MZX.
What if my .csv is in another folder?
Paths! Long Extensions! No Extensions! It Really Works!
Why not add <x>?
Hooray!! Tell me!
This is broken!
Of course it is, I'm CJA.
Does this work with tab-seperated lists?
Yes, but only if one tab separates each item. Just find set "seperator" 44 and replace it with set "seperator" 9. This will work with any character, as long as there's one seperator between each cell, the seperator doesn't appear inside a cell, and the file uses standard line endings (\r, \n, or \r\n). If you're writing dialogue, for example, there are a lot of commas, which you can see in this sentence (as an example, of course), and, instead of commas, you may want to use a better character for serialization, namely, char 9, the Tab character.
I want this to run when my game loads, but my global robot's already doing stuff! OK, do this.
- Export your global robot to global.txt or whatever.
- Replace your global robot with this one line: set "csv_reader.txt" "LOAD_ROBOT"
- Find this line in the CSV reader: . "Done"
- Replace it with this: set "global.txt" "LOAD_ROBOT" (or whatever)
- There we go! Global robot will load your CSVs and then go back to its usual business.
Attached File(s)
-
csv_reader.txt (8.39K)
Number of downloads: 0

Help










