Data from File
BlitzMax Forums/BlitzMax Beginners Area/Data from File
| ||
Hi. I'd like my unit data to be stored in a file so that it can be changed at a later date. In previous games I made some code that generated a data file by basically just dumping a long series of numbers and information. The game then read this and loaded back the information in the right order. The problem with this is that more or less data than expected for an entry causes offset-loading problems with later entries, and it's impossible for a human to modify it. I would like a data file that is written like a text document.... newunit unitname = unitattack = endunit etc So it can be modified easily. But I don't know how to go about doing that. Is there any built-in way to access eg ini files, or any free code available? Thanks. |
| ||
Look at readline/writeline or, probably better, search the forums for libxml or maxml as, for a lot of data, xml could be the way to go. |
| ||
This is an early prototype so it's far from optimal. But it should give you a basic idea of how to do something like this. If you don't want to use the "three letters and separator" approach I've used, you'll need to either write your own string tokenizer or find one that's readily available. And an example structure file: |
| ||
http://www.blitzbasic.com/codearcs/codearcs.php?code=1890#comments This could also be of help. |