logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Proper set/GetPersistentObject documentation ?

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related
View previous topic :: View next topic  
Author Message
Pyridon



Joined: 07 Oct 2005
Posts: 9

PostPosted: Mon Dec 19, 2005 19:04    Post subject: Proper set/GetPersistentObject documentation ? Reply with quote

I am trying to save objects to the database for the first time, and trying to use the Set/GetPersistentObject functions to do that.

The trouble is that there isn't any proper documentation for those functions, or at least I haven't found it. So what I can do is trying to understand the aps_demo container, but of course the function doesn't work the way I need it to work, and there isn't much documentation. Only this:
Code:


    /* Method 1: GetPersistentObject
     *
     * Use this method for simplicity.
    */
    while (bContinue)
    {
        oCreated = GetPersistentObject(oChest1, "Item_" + IntToString(iItem), oChest2);
        if (!GetIsObjectValid(oCreated))
            bContinue = FALSE;
        else
            iItem++;
    }

Not very informative. The biggest problem is that I cannot understand what the parameters for the GetPersistentObject are. You remember, the example file actually copies the object from another container (Chest1) . So I suppose the first parameter is the container object reference where it's was saved the database, so... oChest2 is the reference of the container where it's loaded to ? Does that work if those two are the same container ?
Back to top
View user's profile Send private message
celtic3



Joined: 16 Jul 2005
Posts: 19

PostPosted: Sat Feb 18, 2006 6:42    Post subject: reply Reply with quote

There is a 4th parameter for what table to use, but it is optional and is set to the default pwobjdata unless you set it.
Back to top
View user's profile Send private message
xtrick8



Joined: 31 Jul 2006
Posts: 8
Location: Melbourne, Australia

PostPosted: Mon Jul 31, 2006 6:08    Post subject: Reply with quote

In your example oChest1 and oChest2 can be the same object. I think it just allows stuff to go back to the original owner of the object or something. But really there is no need that I can see for the second object argument. I hope that helps. I found this script works ok, but I am having corruption issues with some objects upon retrieval back from the database. A heal potion will sometimes become a speed potion when you check back.
_________________
- xtrick8 (Lead Writer for Noreshia)
http://www.noreshia.com/
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group