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 
 
Noob Question

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules
View previous topic :: View next topic  
Author Message
Lugoun



Joined: 18 May 2007
Posts: 36

PostPosted: Wed Jun 06, 2007 9:13    Post subject: Noob Question Reply with quote

Ok, I'm approaching this from purely an experienced nwn scripter standpoint and I'm confused about something.

I was under the impression that with the right installation, plugins and include files (mainly nwnx_sql I think) that I would be able to SetPersistent(Int, String, whatever) and GetPersistent(whatever), to my hearts desire, the way I would have used SetCampaign or GetCampaign in my past experience.

I just wanna be able to get and set persistent data via script and I havent been able to get a clear answer on how to do this from the person managing the db.

Can someone tell me where I'm missing the boat? Or where this is a lot more complicated than I imagine?
_________________
Lugoun
www.hotta-rpg.org
Back to top
View user's profile Send private message
FunkySwerve



Joined: 02 Jun 2005
Posts: 377

PostPosted: Thu Jun 07, 2007 8:41    Post subject: Reply with quote

You can indeed do this fairly easily. Instead of SetCampaign functions, you use the SetPersistent functions in the aps_include include script (you must include this script in anything you use those functions in, of course). You can also do much more, but you'll want to get comfortable with the basic functions first. SetPersistentInt/String/etc store a set of values in a database, by name and playername for players. For any given data set you will have playername, name, variable name, and variable value. You can use SQL to search using any or all of those, but the GetPersistent functions will pull them up looking for match of playername, name, and variable name. It's more straighfoward than it sounds, I promise.

One thing to understand is that everything but objects are stored as strings in MySQL and converted to whatever data type the function you are using is. There's really no substantial difference between them.

Please don't hesitate to ask if you have more questions, or want help with a specific example.

Funky
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Thu Jun 07, 2007 10:07    Post subject: Reply with quote

Note: For NWNX4 it's nwnx_sql and for NWNX2 it's aps_include. You also need the pwdata table in your database. You can use the NWNX4 demo modules to create the table and have a look how the scripts call the DB.
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Lugoun



Joined: 18 May 2007
Posts: 36

PostPosted: Thu Jun 07, 2007 19:53    Post subject: Reply with quote

Thanks for the replies.

I think the main problem is me and the db person dont speak the same language (even though I could swear its English), and my hands are too full right now to take a crash course in MYSQL.

I still need to confirm one thing. Assuming the right install and the correct include files and the pwdata table exists, etc, can I just SetPersistent varaibles whenever and however I need without concern?

Or, is there special maintenance needed on the db side to prepare it to accept the data I want to Set (i.e. do I need to keep a list of persistent varaibles)?
_________________
Lugoun
www.hotta-rpg.org
Back to top
View user's profile Send private message
FunkySwerve



Joined: 02 Jun 2005
Posts: 377

PostPosted: Fri Jun 08, 2007 5:19    Post subject: Reply with quote

Pretty much. Just like Campaign Ints, though, you don't want to accidentally overwrite the same var on the same object, but then you already know that. There's no need to do any kind of db maintenance, and the variables will never expire unless you delete them.
Funky
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules 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