Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] File Parsing Functions

Author
Message
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 11th Jan 2009 18:44 Edited at: 11th Jan 2009 18:45
I've made some file parsing functions to help with loading maps/entities/missions in my current project. Here's the code:



And here's a list of the functions and explanations:



Here's how it works:

If you have a MyFile.txt that looks like this:



You'd get the values like so:



You can also use datablocks if you have more complex data, like in a level file:



And get values like this:



The "->" symbol is used to access nested values. The functions also do not support tabs ATM so:



Would not work.

If you have any questions just ask.

DJ Chena
15
Years of Service
User Offline
Joined: 13th Jan 2009
Location:
Posted: 13th Jan 2009 19:07
Ohhh! big work, and nice explained. Testing...

Thanks.

www.ruidoatomico.com
Sixty Squares
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 13th Jan 2009 20:36
Yay now I can be organized . Nice work.

AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 13th Jan 2009 20:42
Thanks guys. If you find any bugs please post them here.

Monk
15
Years of Service
User Offline
Joined: 25th Sep 2008
Location: Standing in the snow =D
Posted: 31st Jan 2009 23:36
What type of files does this work with? Any type?

AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 1st Feb 2009 00:16
Any file which contains ASCII characters. Files which are encrypted and what not will not work, but I suppose if you encrypted your files you wouldn't care about these functions anyway as the point is to make it easy to edit external game data.

Login to post a reply

Server time is: 2024-05-18 17:29:00
Your offset time is: 2024-05-18 17:29:00