On Feb 26, 12:17 pm, "Auric__" <not.my.r...@[EMAIL PROTECTED]
> wrote:
> On Tue, 26 Feb 2008 15:22:37 GMT, Angbandit wrote:
> > Hi, I've been working on a game for the last decade off and on and
> > I've come to the point now that I need to learn how to create and
> > read files.
>
> > For instance, my game creates a player character for an RPG and I
> > need to be able to save the data to a file with the same name as
> > the player such as "Conan.dat". I need to be able to then load the
> > data from that file and play it in the game, like the old Might and
> > Magic and Wizardry games used to do. I've gotten as far as open as
> > binary and write and such, but I guess I just don't know what I'm
> > doing. I'm sure this is very simple. Any help would be
> > appricitated. If I'm being vauge, I'm sorry.
>
> The simple way would be something like this:
> fNum& = FREEFILE
> OPEN Character.Name$ & ".dat" FOR BINARY AS fNum&
> PUT #fNum&, , Character.Strength%
> PUT #fNum&, , Character.Intelligence%
> PUT #fNum&, , Character.HitPoints&
> PUT #fNum&, , Character.Mana&
> '[etc.]
> CLOSE
> To read it back in, do the same thing, just replace "PUT" with "GET".
>
> Bear in mind, while this is one of the simpler ways to do this, it
> isn't the *only* way, and probably not the best way. ("Best" depends
> upon your requirements, of course.) This also doesn't take into
> account things like compression and encryption.
>
> On a side note, if you're writing a roguelike (as suggested by your
> nym), you may want to visit rec.games.roguelike.development for ideas
> and other such things.
>
> --
> Black hat bean-counters!
Thank you, that helps a lot. But it brings me to second question.
Why use Charecter.Strength%, why not just use Character.Strength as
the variable type? Is it because of the period?
Or is it a variable type issue because I've never understood that
stuff.


|