View previous topic :: View next topic |
Author |
Message |
Lugoun
Joined: 18 May 2007 Posts: 36
|
Posted: Wed Jun 06, 2007 9:13 Post subject: Noob Question |
|
|
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 |
|
|
FunkySwerve
Joined: 02 Jun 2005 Posts: 377
|
Posted: Thu Jun 07, 2007 8:41 Post subject: |
|
|
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 |
|
|
Papillon x-man
Joined: 28 Dec 2004 Posts: 1060 Location: Germany
|
Posted: Thu Jun 07, 2007 10:07 Post subject: |
|
|
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 |
|
|
Lugoun
Joined: 18 May 2007 Posts: 36
|
Posted: Thu Jun 07, 2007 19:53 Post subject: |
|
|
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 |
|
|
FunkySwerve
Joined: 02 Jun 2005 Posts: 377
|
Posted: Fri Jun 08, 2007 5:19 Post subject: |
|
|
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 |
|
|
|