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 
 
Mod Conversion

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows technical support
View previous topic :: View next topic  
Author Message
Red



Joined: 14 Feb 2009
Posts: 21

PostPosted: Fri Mar 06, 2009 7:12    Post subject: Mod Conversion Reply with quote

I have a quick question about converting my mod to properly use NWNX. This is more than likely a foolish question, I am one of those self taught types.

I have NWNX running, which I acquired via the HGLL system, and all seems well.

My question relates to Campaign Int's and the APS GetPersistant functions.

While looking at those, and salivating, a question came to mind.
I came across this bit.

Code:
        // If you want to convert your existing persistent data to APS, this
        // would be the place to do it. The requested variable was not found
        // in the database, you should
        // 1) query it's value using your existing persistence functions
        // 2) save the value to the database using SetPersistentString()
        // 3) return the string value here.

Which, if I understand correctly, is a good spot to do something like this.
Code:

int iValue = GetCampaignInt("Master","slave");
SetPersistentInt(oPWObject, "NewSlave", int iValue, string sTable = "pwdata");

Converting that camp int to the aps system.

Should I convert all my Get/Set camp checks and such that I am currently using in my mod to the APS persistent functions?
could I perhaps just do both?

Just so I am clear, as finding the correct question can sometimes be just as difficult as finding the answer, once I saved any data I want in this fashion should I then go into my mod and change every Set/Get CampInt to Set/GetPersistant functions?
Is that faster, or better, or even something I can do?

I love the system,
Thanx
Back to top
View user's profile Send private message
Fireboar



Joined: 17 Feb 2008
Posts: 323

PostPosted: Fri Mar 06, 2009 19:11    Post subject: Reply with quote

It could be tricky, but that is indeed what you need to do. It might be an idea to have a trial period (say, perhaps a week) where the script checks in both places, and makes the conversion if found only in the Bioware DB. That would cause more overhead, but the payoff after the trial period where you remove Set/GetPersistent entirely is worth it.

Remember though, you don't HAVE to convert everything over at once. Keep things sane and do them one at a time.
Back to top
View user's profile Send private message
Red



Joined: 14 Feb 2009
Posts: 21

PostPosted: Sun Mar 08, 2009 22:58    Post subject: Reply with quote

Since I started this ghost thread, I may as well put it to use.
I had much success in my db conversion, all went well.

An interesting problem we have is our test players not seeing us on Gamespy and not being able to direct connect.
I have searched and searched by none of the workarounds I have found have worked out for us.

We are purchasing a new router, as ours hosted a mod from 2002 to 2007 and very well may be beyond it's intended lifespan.

Anyone have a similar issue that they found a solution for?

We have all the ports open for gamespy.

I my ini's I noticed that server on 5121 and the player on 5120. Perhaps that is something I overlooked? Sound right to everyone?
Back to top
View user's profile Send private message
Fireboar



Joined: 17 Feb 2008
Posts: 323

PostPosted: Mon Mar 09, 2009 20:52    Post subject: Reply with quote

That sounds about right. The ports being open doesn't sound like a problem... was there anything that could have triggered the problem? As in, when this happened, was there any change in your server setup? Might be an idea to check that the server's local network IP (192.168.x.x or 10.0.x.x) is still the same. While you're at is, is your Internet IP address still the same?
Back to top
View user's profile Send private message
Red



Joined: 14 Feb 2009
Posts: 21

PostPosted: Tue Mar 10, 2009 4:42    Post subject: Reply with quote

We needed a new router, went 1gig.

We don't have a static ip from our isp (cable)

Is that a major issue? So far two testers out of about 10 have not been able to direct connect or see us in gamespy.
I turned on the gamespy watchdog, just to be sure we are talking. All is well there, I think I can turn that back off.

The strange thing is them not being able to direct to our dyn address, which we have set up. Just strange, and I do believe not related to nwnx.

I have another question, if you feel like reading code. If not, no worries.

I worked the reset plugin into my mainheartbeat. While doing so I have blocked the reset of my clock function. I have a slim heartbeat, that I actually just place on any areas onhb in the mod. Works great, keeps a clock, does area damage, is written very clean. Just cant restart that clock for some reason.

I took out a few lines of code before the actual call to the plug in, that dealt with transaction. I thought perhaps I was overkill with those and dropped it down to just the one line of code.

onmod enter related to clock
Code:

#include "x2_inc_switches"
#include "aps_include"

void main()
{
    object oClock = GetObjectByTag("pcclock"); ///my related object
    SetPersistentInt(oClock,"clock",0); //set to zero
    SetModuleSwitch(MODULE_SWITCH_NO_RANDOM_MONSTER_LOOT,TRUE);//just loot stuff
        // Init placeholders for ODBC gateway
    SQLInit(); //as per nwnx install instructions, works fine
}


hb script related to clock.
Code:
void main()
{
    int iCount = GetLocalInt(OBJECT_SELF,"beats"); //standard stuff
    iCount++;
    SetLocalInt(OBJECT_SELF, "beats", iCount);

and
Code:

 if (iCount==100)
     {
           object oClock = GetObjectByTag("pcclock");
           int nRunTime = GetPersistentInt(oClock,"clock");
           nRunTime = nRunTime + 10;
           if (!(nRunTime%60))
           {
             SpeakString ("Visit our forums at www.altharia.net for all the latest news about Gladiator.");
           }
           SetPersistentInt(oClock,"clock",nRunTime);
           string sRunTime = IntToString(nRunTime);

           iCount=0;
           SetLocalInt(OBJECT_SELF, "beats", iCount);

           //save the polymorphed folks
           object oPC = GetFirstPC();
     while ( GetIsObjectValid(oPC) ) // Loop through all the Players
       {
        if ( GetIsObjectValid(GetItemInSlot(INVENTORY_SLOT_CARMOUR,oPC)) )
            {
            ExecuteScript("ws_saveall_sub", oPC); //save polymorph dudes
            }                                                      //before export
        oPC = GetNextPC();
       }
           ExportAllCharacters(); // our ten minute save function
           SpeakString ("Characters saved.",TALKVOLUME_SHOUT);
           SpeakString ("Server has been running for " + sRunTime + " minutes.",TALKVOLUME_SHOUT); // when called on restarted mod !=0
       if (nRunTime==1430)SpeakString ("Server Reset in 10 minutes.",TALKVOLUME_SHOUT);
       if (nRunTime==1435)SpeakString ("Server Reset in 5 minutes.",TALKVOLUME_SHOUT);        // i wrote this, be warned
       if (nRunTime==1440) //loop and boot
           {
          // SetPersistentInt(oClock,"clock",0);       //did not help
          // SetLocalInt(OBJECT_SELF, "beats", 0); //
            while (GetIsObjectValid(oPC))
            {
              if (!GetIsDM(oPC))
                {
                BootPC(oPC);
                }
               oPC = GetNextPC();
             }
 DelayCommand(0.1, SQLExecDirect("COMMIT TRANSACTION")); // Not sure if this only works for SQLite
 DelayCommand(0.2, SQLExecDirect("BEGIN TRANSACTION"));  // Not sure if it's needed to start it up again
 AssignCommand(GetModule(), DelayCommand(5.0, SetLocalString(GetModule(),"NWNX!RESETPLUGIN!SHUTDOWN","1"))); //swiped the above 3 lines from this forum, was posted by Rami
           }
     }
}


It usually does take me a while to first get my code to work, and then to streamline it. I always have had success, even with only what I have learned deving mods as my education. This simple bit? thrown.

* I put all three lines in. It all seems fine, just my return on the timed shout does not reset after a server reset. I have to be setting that or missing a clear somewhere*
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows technical support 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