Loading words from a text file
Hi friends!
I'm planning to make several word-based games, like Hangman, Crossword, etc...
The idea is to load the words from an external .txt file, so I can add/edit/remove them without editing the executable file.
Which is the best way to accomplish this?
Thank you very much.
Re: Loading words from a text file
I think I should use the Ini and the Array objects, but I'm still trying to figure out how to use them.
Please, any help is welcome.
Thanks.
Re: Loading words from a text file
You could use ini and string parser, i think they would work well ;)
Re: Loading words from a text file
I'm a great fan of the List object, as well - it allows you to load in a plain text file already split up line by line.
As you can see there are several ways to handle files in MMF - which one is best depends on exactly what you're doing with the contents.
Re: Loading words from a text file
I've tried both of your suggestions, and I think it will be easier to use the INI and String Parser objects.
Maybe I should obtain a random number at the start of the frame, and then search for that line in the txt file, and retrieve the string associated to it.
At the moment, I've only been able to load all of the lines and put them into a single one. I'm still a bit confused about all of the options of the INI object.
Thank you very much. I'll keep on trying and I'll let you know. I hope I can make it.