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 
 
NWNX/MySql Persistent Storage?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules
View previous topic :: View next topic  
Author Message
Tsais



Joined: 18 Sep 2017
Posts: 6

PostPosted: Thu Oct 12, 2017 21:47    Post subject: Reply with quote

Terra_777 wrote:
Can only store creatures and or items. 'x2_medium_Chest3' looks like a peaceable.

I'm confused. I thought the whole point of these functions was that they could save a placeable and its inventory?

virusman wrote:
with them you can store the entire placeable with its inventory and properties, without using OnDisturbed and handling every item individually.
Back to top
View user's profile Send private message
Terra_777



Joined: 27 Jun 2008
Posts: 216
Location: Sweden

PostPosted: Fri Oct 13, 2017 20:06    Post subject: Reply with quote

StoreCampaignObject (SCO) and RetriveCampaignObject (RCO) which are hooked into and re-directed to the database only works with item objects and creature objects.

You can store the inventory of a placeable but if you want to store the complete placeable you need to store the resref of the placeable, create the placeable and then restore the inventory.

You can store an inventory of a creature, but be careful with that since those can get big and if they get too big it'll truncate data.
_________________
I dun have any signature, I'm happy anyway.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Tsais



Joined: 18 Sep 2017
Posts: 6

PostPosted: Sat Oct 14, 2017 0:35    Post subject: Reply with quote

UPDATE: I was able to get virusman's functions working. My previous (failing) tests were with an older Win version of NWNX. Once I tried the same tests on a new Linux installation, it worked.

Terra_777 wrote:
if you want to store the complete placeable you need to store the resref of the placeable, create the placeable and then restore the inventory.

Actually, you can store the complete placeable with virusman's additions to NWNX with only one line. I just did it.

Something like:
Code:
SQLSCOExec("UPDATE ax_psobjects SET area='"+GetTag(GetArea(oObject))+"', location='"+LocationToString(GetLocation(oObject))+"', object=%s WHERE id="+IntToString(nID), oObject);

... will store an entire placeable and its contents in a single database row, using a single BLOB, and something like:

Code:
SQLRCOExec("SELECT object FROM ax_psobjects WHERE id="+IntToString(nID), lLoc, nType);

... will retrieve the placeable and its contents.

These are great additions, virusman! Are they documented somewhere (else)?
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Tue Oct 24, 2017 1:17    Post subject: Reply with quote

Yes, documentation could be better. These extensions are only available on Linux.
_________________
In Soviet Russia, NWN plays you!
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules All times are GMT + 2 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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