• Advertisement
Sign in to follow this  

reading data file c#

This topic is 2061 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everybody, i am trying to write a basic text based rpg in the vein of zork and other rpgs from the late 70s and early 80s. However, i have come across a problem. I am trying to create a more open ended way of creating monsters for the game by the game reading .txt files. However, i have no idea how to do this. This may come across quite stupid but i cant really find a tutorial that covers what i am working on. Can you please provide a website url that you believe may help me with this or explain it in a reply.

Thank you for your time,

fusion1

p.s.: im writing this to raise money for a charity, so hasty responses are very useful as i am working on a limited time scale

Share this post


Link to post
Share on other sites
Advertisement
Using lists to read, write, and search text files:
http://stackoverflow.com/questions/4483529/c-sharp-using-lists-to-read-write-and-search-text-file-lines

How To: Reading and Writing Text Files:
http://www.csharp-station.com/HowTo/ReadWriteTextFile.aspx

An example file I found while looking this stuff up - this should help you to see how it can be set up:
Breath of Death VII Monster Stats & Abilities

Share this post


Link to post
Share on other sites

However, i have come across a problem. I am trying to create a more open ended way of creating monsters for the game by the game reading .txt files.


You could look into something like JSON, there are a couple of libraries available, such as http://json.codeplex.com/. There are also built-in libraries for XML parsing in .NET, but XML is a bit more complicated and probably overkill (IMO).

Share this post


Link to post
Share on other sites
i am still having a bit of trouble assigning the values from the .txt file to actual variables within the code, and i cannot find a very good tutorial to show me how, the reading and writing part i have well, its just assigning the values

thank you for your time

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement