reading data file c#

Started by
3 comments, last by fusion1 11 years, 10 months ago
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
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

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).
thank you
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

This topic is closed to new replies.

Advertisement