Re: [PFILES] Equiptment Saving in Pfiles?

From: Patrick Dughi (dughi@imaxx.net)
Date: 01/16/01


> I'm looking to add a section at the bottem of my pfiles that includes all of
> the items they are wearing and in their inventory, I'd also like to make it
> so everything goes back to how it was when they quit ie autoeq, but am not
> sure how to do this and still have text pfiles... or object files.
>
        I'll assume you have stock circle, which now includes autoeq.
Therefore, you have both your eq saved/etc and your object files saved.

        Now, I'll have to also assume that you're a newbie coder.  I'm not
going to go into the reasons, but if I'm wrong, well, I apologize in
advance.

        First, stock circle uses both binary pfiles and binary object
files.  The object files are seperated on a per-player basis, and the
player information exists in a single file.

(total files, 1 pfile plus 1 file for objects for each player =
         1 + [num players])

        Now, as I said, these are binary files.  To grab a given player
file, we calculate the size of a player structure, and then load into a
player structure starting at position 0 in the file, and advancing to
position 0 + (x * size of player structure).  So, if a player file is size
50, first it loads up 50 starting at 0, then it loads up 50 starting at
50, then 100, then 150, etc.  If you take the entire size of the player
file, and divide by the size of a player structure, you actually end up
with the number of players you have - exactly.

        Object files work the same way.  They're just spit out like that,
and since each player only has one file, you can just read in the whole
set without any by-your-leave.

        So, what you're going to have to do is make life complicated;
you'll have to save a variable in each player file which says how many
items they're supposed to load.  That way your file will look like this:

=====
player info
---
obj
---
obj
---
obj
---
obj
=====
player info
.
.
.

        Now, this also means that you can't just to say, just the 40'th
player file position, or get a quick list of all player names.. instead,
you have to load up each file, grab the value, iterate through that many
objects and then go from there.

        In essense, you've managed to slow down the process quite a deal,
and gained nothing from it.

        Lets switch tactics and say we're doing the same thing with ascii
pfiles.  Uhoh! There's almost no difference.  The only thing that changes
is that the objects don't need to be pre-counted and saved as a variable
in the player file - instead, there has to be a marker which says "here
the player info stops and object info starts".

                                *shrugs*

        Still, you gain nothing. Zero. Nada.  No space savings, just
time costs because now, you have to at the least spend some effort and
examine each line.  Bleh.

        Why did you want to mush this information together again?

                                                        PjD

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/03/01 PST