Making a modding program.

Post here about scripting and programming for HaloPC (audio, network, ai, etc.)
Post Reply
User avatar
Andrew_b




Socialist

Posts: 4188
Joined: Sat Feb 24, 2007 4:52 pm
Contact:

Making a modding program.

Post by Andrew_b »

Ok well, I have been reading tutorials on how to parse text files. Im a bit confused and was wondering if someone could help me.

Code: Select all

bank : _nameless.114B.FCB0 {
 money_account: 50000
 loans: 0
}
Thats the format of the whole file...except alot more data.

How would i get my program to open the file, Read the words between } and { and put it into a list box or a tree view of some sort (like hmt) I am using VB. Any help whatsoever would be awesome! :D
User avatar
Anthony




Translator Connoisseur New Age ONI

Posts: 1001
Joined: Thu Jul 06, 2006 10:19 pm
Location: Whittier, CA
Contact:

Post by Anthony »

use C# and I will help a bit
Patrickssj6




Pi Collaborator

Posts: 5426
Joined: Sat Jul 24, 2004 12:12 pm
Location: I'm a Paranoid
Contact:

Post by Patrickssj6 »

Anthony wrote:use C# and I will help a bit
How about you post the code in C# and he can convert it himself. I know C# is better now that I use it myself, but there are no huge differences...only thing I miss the the Optional property for the parameters :P

Basically what you could do is loop through until you find { then go to the next line and so on until }.

There are multiple ways of doing this. Especially in VB you have text functions that could help you like EOF and so on.

With a StreamReader you just increase the offset until you find { then you skip the first space, add the next chars to an array until next space then you know you are getting the next word etc.

Do it yourself. :wink:
...left for good
User avatar
Andrew_b




Socialist

Posts: 4188
Joined: Sat Feb 24, 2007 4:52 pm
Contact:

Post by Andrew_b »

Thanks for the explanation, it makes more sense than when i was just on msdn trying to read stuff.
Post Reply