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 
 
Script not finishing??

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



Joined: 02 Sep 2007
Posts: 830

PostPosted: Sun Dec 12, 2010 3:40    Post subject: Script not finishing?? Reply with quote

Weird thing happening

Im not sure if this is to do with nwnx or not, but could someone have a look at this for me.


My on Mod load script, seems to be interupted by something...
I dont know exactly whats causing it, but I know that my logs appear like this.

Quote:

Player pausing: DISABLED
Auto Save: Enabled
Saving Characters in Saved Game
---- End Server Options ----
[Sun Dec 12 01:30:10] Running on Mod Load Script
[Sun Dec 12 01:30:10] Loading Persistent Time/Date:1026/5/22 9:1:28



The strange thing is, I have a closing log message in the same script, which should be printing out Finished On Mod Load script.



Code:

void main()
{
WriteTimestampedLogEntry("Running on Mod Load Script");
    //Start SQL INIT
    ExecuteScript("aps_onload",OBJECT_SELF);
    // Init placeholders for chat gateway
    InitSpeech();
    SetModuleSwitch(MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS ,TRUE);

    SetLocalLocation(GetModule(), "LocationFailSafe", GetStartingLocation());

        // TIME SETTING
        LordPersistentTime();
        //END OF TIME


    object oArea = NWNXFuncs_GetFirstArea();
    if(oArea != OBJECT_INVALID)
        {
         SetLocalInt(OBJECT_SELF,"NWNX_LOADED",1);
        }
    while(oArea != OBJECT_INVALID)
        {

            int iMusicTrack = GetLocalInt(oArea,"BATTLE_MUSIC");
            if(iMusicTrack != 0)
             {
                MusicBattleChange(oArea, iMusicTrack);
             }
             LoadStoreArea(oArea); //// Loads fog colors, music tracks etc from database, as well as updating the db
           oArea = NWNXFuncs_GetNextArea();
        }


WriteTimestampedLogEntry("Finished Mod Load Script");
}



I first noticed this, when my Persistent time tracking function wasnt showing up in the logs, It was originally below the area loop. And that worked fine.
However according to the last update time in the pwdata table, the persistent time hadnt received an update since 1pm saturday (this weekend).

I only managed to get it back working, by moving it above the area loop.

Im thinking it might be a TMI breaking the script from working.

The area loop originally only had to iterate through so many areas, but I think now that I have got into the large number of areas, its extending the script duration so long, it causes a TMI.

Any ideas on how to fix or work around?
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Sun Dec 12, 2010 4:05    Post subject: looks like it was Reply with quote

Looks like it was the LoadStoreArea(oArea); call in the loop which was breaking the function.


This function is quite complex, it basically compares the area in the module, to the stored settings for that area, in the database, and if they dont match the database, it sets the settings according to what was in the database.

Eg - Being able to update music and area fog colors without having to edit the module etc.

My guess is that this function, being as complex as it is, is fine for a few areas in a loop, but today I must have reached the limit as far as script length can go.


Question: Can I work around this via doing
AssignCommand(oArea,DelayCommand(2.50,LoadStoreArea(oArea)));

Would this segment the script, or would the nwn engine still treat LoadStoreArea, as if it was inside the originating script?
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Sun Dec 12, 2010 4:10    Post subject: Wow it worked Reply with quote

Ok, that appears to have worked.

By assigning the function to be carried out by the area itself, segmented it enough that all areas can be processed, without causing a TMI.
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