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 
 
-Grumble- Help?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux technical support
View previous topic :: View next topic  
Author Message
william_hunter



Joined: 31 Jan 2007
Posts: 149

PostPosted: Tue Nov 10, 2009 20:55    Post subject: -Grumble- Help? Reply with quote

Hey all..I am back, and once again, I am stupid.

Is there anyone here that is willing to walk me through setting up NWNX on my Ubuntu box for use with my PW (again)? I had it running on this machine for a long long time, and I lost the HDD over the summer, and have recently decided to get my world back up and running, but I can't remember how to do the basic setup! I know..I know..what an idiot..yes, I didn't have a good backup.

Now, I am going to be running this world differently, using the PRC this time, so things are a little different, but I have the mod ready for beta testing, and I can't seem to keep it running. Every time I boot it up, it segfaults within seconds. Any thoughts?
_________________
The Realm of Tharagon NWN PW
Back to top
View user's profile Send private message
Paul R



Joined: 17 Apr 2009
Posts: 42

PostPosted: Wed Nov 11, 2009 16:47    Post subject: Reply with quote

Give me a yell if you want to go through the setup on there, I've got two Ubuntu servers running nwnx. Did you use nwnx_easy last time or the svn contents?
Back to top
View user's profile Send private message
william_hunter



Joined: 31 Jan 2007
Posts: 149

PostPosted: Wed Nov 11, 2009 18:10    Post subject: Reply with quote

I used nwnx_easy, but I think somehow I screwed it up..lol..Anyways, I would certainly appreciate a little help in getting this thing running again. I managed to host on this box for 4 years without much trouble, but I am getting old and senile, I forget stuff. Smile


I think there might be a problem with the PRC database caching as well, I've got to look into that. That may be the problem entirely, actually, now that I think about it..let me post the log.

Code:

[Tue Nov 10 13:41:57] Loading Module: The Shard Beta
[Tue Nov 10 13:42:28] Module 2da cache fingerprint: The Shard_233_1117775683
[Tue Nov 10 13:42:28] Starting to load 2da cache object from prc_datac2
[Tue Nov 10 13:43:07] Loading Module: The Shard Beta
[Tue Nov 10 13:43:50] Module 2da cache fingerprint: The Shard_973_829982243
[Tue Nov 10 13:43:50] Starting to load 2da cache object from prc_datac2
[Tue Nov 10 14:36:05] Loading Module: The Shard Beta
[Tue Nov 10 14:36:40] Module 2da cache fingerprint: The Shard_432_1339499194
[Tue Nov 10 14:36:40] Starting to load 2da cache object from prc_datac2
[Wed Nov 11 09:57:57] Loading Module: The Shard Beta
[Wed Nov 11 09:58:31] Module 2da cache fingerprint: The Shard_352_1061460218
[Wed Nov 11 09:58:31] Starting to load 2da cache object from prc_datac2




This is the code that enters the log after I start the server. It then segfaults and crashes out.
_________________
The Realm of Tharagon NWN PW
Back to top
View user's profile Send private message
william_hunter



Joined: 31 Jan 2007
Posts: 149

PostPosted: Wed Nov 11, 2009 18:35    Post subject: Reply with quote

More info:

Here is what the terminal spits out when the segfault happens.

Code:

william@ubuntu-desktop:~/nwn$ ./nwnstartup.sh

NWNX2lib: Init
NWNX2lib: org SetString() at 0x81f41b4, new SetString() at 0xb80bffbb
NWNX2lib: org GetObj() at 0x81f40bc, new GetObj() at 0xb80bf9ed
* Parsing configuration...
NWN Extender v2.7-beta4
(c) 2004 by the APS/NWNX Linux Conversion Group
(c) 2007-2008 by virusman
Based on the Win32 version (c) 2003 by Ingmar Stieger (Papillon)
and Jeroen Broekhuizen
visit us at http://www.avlis.org

* Loading modules...
TMI plugin Registered.
FIXES plugin Registered.
LETO plugin Registered.
CHAT plugin Registered.
PROFILER plugin Registered.
RESETPLUGIN plugin Registered.
FUNCTIONS plugin Registered.
EVENTS plugin Registered.
RESMAN plugin Registered.
MNX plugin Registered.
STRUCTS plugin Registered.
HASHSET plugin Registered.
ODBC plugin Registered.
* NWNX2 activated.
Neverwinter Nights Server
Build:8109
Copyright BioWare Corp 1998-2004

Server: Loading...
Server: Running...

Server: Loading module "The Shard Beta"........................
Server: Module loaded
INIT(S): valid ret=0x082041ec
./nwnstartup.sh: line 26: 24126 Segmentation fault      ./nwserver -publicserver 1 -servername "The Shard Beta" -port 5121 -dmpassword "xxxx(thanks Paul).." -oneparty 0 -pvp 0 -difficulty 3 -elc 0 -ilr 0 -reloadwhenempty 0 -module "The Shard Beta" -maxclients 32 -servervault 1 -maxlevel 40 -gametype 1 -autosaveinterval 0 "$@"

NWNX2lib: Init
./nwnstartup.sh: line 26: 24133 Segmentation fault      sleep 5


_________________
The Realm of Tharagon NWN PW


Last edited by william_hunter on Wed Nov 11, 2009 20:36; edited 1 time in total
Back to top
View user's profile Send private message
Paul R



Joined: 17 Apr 2009
Posts: 42

PostPosted: Wed Nov 11, 2009 19:03    Post subject: Reply with quote

errmm might want to edit that output and errm take out something.

Anyway, I don't use PRC so I've not seen that 2da caching in use. Is it part of the modload event and do you have that part of the script? Does it use the nwnx database functions?

Also was the server running correctly between the times shown there, e.g. started at 14:36:05, caching completed and server running ok until 09:57:57 the next day (assuming there is a while loop type restart going on)?

If so then it's unlikely to be the caching itself and more likely some other issue. Do any of the nwnx_*.txt files show anything?

As you probably know the second segfault is the usual effect of having a LD_PRELOAD set and having an non shell function command in the while loop.
Back to top
View user's profile Send private message
william_hunter



Joined: 31 Jan 2007
Posts: 149

PostPosted: Wed Nov 11, 2009 19:27    Post subject: Reply with quote

No it won't stay live more than a few seconds before crashing out. The while loop was only added an hour ago or so as I work on getting other parts of the server ready for beta testing

Quote:

As you probably know the second segfault is the usual effect of having a LD_PRELOAD set and having an non shell function command in the while loop.


Lol..you mistake me for someone that actually knows how to work in the shell. I can make it run my commands, but I generally don't really know a ton about how the entire thing works. I am still learning, but I am actually a MacOSX user, and I don't really do much work with Linux..only with this server. I've cobbled together enough knowledge to be functional (barely, obviously)

Can you explain what this means?
_________________
The Realm of Tharagon NWN PW
Back to top
View user's profile Send private message
william_hunter



Joined: 31 Jan 2007
Posts: 149

PostPosted: Wed Nov 11, 2009 19:33    Post subject: Reply with quote

Here is my shell script, just in case I made some error in putting this together:

Code:

#!/bin/bash
while [ true ]
do
export LD_PRELOAD=./nwnx2.so

./nwserver \
   -publicserver 1 \
   -servername "The Shard Beta" \
   -port 5121 \
   -dmpassword "xxxxxxx" \
   -oneparty 0 \
   -pvp 0 \
   -difficulty 3 \
   -elc 0 \
   -ilr 0 \
   -reloadwhenempty 0 \
   -module "The Shard Beta" \
   -maxclients 32 \
   -servervault 1 \
   -maxlevel 40 \
   -gametype 1 \
   -autosaveinterval 0 \
   "$@"

sleep 5
done
unset LD_PRELOAD



By the way, while I am here...does anyone have the list of 'gametypes'? I want to put this in tech supprt for the time being but don't know what gametype tech is..eventually, it will be in PW/Action
_________________
The Realm of Tharagon NWN PW
Back to top
View user's profile Send private message
Paul R



Joined: 17 Apr 2009
Posts: 42

PostPosted: Wed Nov 11, 2009 20:33    Post subject: Reply with quote

william_hunter wrote:
No it won't stay live more than a few seconds before crashing out. The while loop was only added an hour ago or so as I work on getting other parts of the server ready for beta testing

Quote:

As you probably know the second segfault is the usual effect of having a LD_PRELOAD set and having an non shell function command in the while loop.


Lol..you mistake me for someone that actually knows how to work in the shell. I can make it run my commands, but I generally don't really know a ton about how the entire thing works. I am still learning, but I am actually a MacOSX user, and I don't really do much work with Linux..only with this server. I've cobbled together enough knowledge to be functional (barely, obviously)

Can you explain what this means?


lol sorry Smile You're exporting an environment variable LD_PRELOAD into the shell so that the nwnx2.so code can run on the nwserver startup and hook into all those nice juicy functions so they can be subverted and corrupted Wink

As it's exported it means that all commands executed while it is in the shell including the sleep 5 delay will try and have it preloaded by the dynamic linker (except for shell builtin functions like the while). As that is not the nwserver process it can't find the relevant hooks and dies, but this also means your sleep does not do anything.

Nothing drastic but you can use this if you need something else in the while loop

Code:
#!/bin/bash

cd /to/the/game/directory

while [ 1 ]
 do
  LD_PRELOAD=./nwnx2.so ./nwserver -options -moreoptions -ohhowiwishthe.inifileworked
  sleep 5
 done


This also means you can add things like backing up the log files in the loop before the nwserver is restarted as the variable is for that specific command only.

Anyway, that's not the issue just thought it should be pointed out incase it confused things sorry for going off on a tangent...



...so, do you have anything in the nwnx_*.txt files in the logs.0 directory? One of those might show some relevant detail and if not then I think we might need to look at your modload event script and see what it is up to.


The game room values are in one of the .2da files and are also on the Bioboards, Action is 0 and it seems that most of the servers in the Action room are PW's as well. You'll probably get more player traffic in Action than PW/Action really.


Also what you did with the xxxxx's above also needs to be done with your terminal output post Wink
Back to top
View user's profile Send private message
william_hunter



Joined: 31 Jan 2007
Posts: 149

PostPosted: Wed Nov 11, 2009 20:39    Post subject: Reply with quote

There isn't anything in the logs that is indicative of a problem at all. I will go export the modload now...
_________________
The Realm of Tharagon NWN PW
Back to top
View user's profile Send private message
william_hunter



Joined: 31 Jan 2007
Posts: 149

PostPosted: Wed Nov 11, 2009 20:48    Post subject: Reply with quote

Here is the active merged script. Looking at this, I have a feeling that the issue is multiple calls for the same function from 3 different scripts. Correct me if I am wrong, of course..


Code:

// prc_onmodload,x2_mod_def_load
/////////////////////////////////////////////////////////////////////
//
// This script has been auto-generated by HakInstaller to call
// multiple handlers for the onmoduleload event.
//
/////////////////////////////////////////////////////////////////////

void main()
{
    ExecuteScript("prc_onmodload", OBJECT_SELF);
    ExecuteScript("x2_mod_def_load", OBJECT_SELF);
    ExecuteScript("fky_chat_modload", OBJECT_SELF);
}



PRC Modload

Code:

//::///////////////////////////////////////////////
//:: PRC On Module Load event handler
//:: prc_onmodload
//::///////////////////////////////////////////////
/** @file prc_onmodload
    Things we need to happen upon a module being
    loaded. For example, setting up caches and
    switches.

*/
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////

#include "prc_alterations"
#include "prc_inc_leadersh"
#include "inc_switch_setup"
#include "inc_cache_setup"
#include "inc_sql"


//////////////////////////////////////////////////
/*             Function prototypes              */
//////////////////////////////////////////////////

void OnLoad_Always(object oModule);
void OnLoad_Save(object oModule);
void OnLoad_Fresh(object oModule);


//////////////////////////////////////////////////
/*             Function definitions             */
//////////////////////////////////////////////////

void CheckDB()
{
    string sDBName = GetBiowareDBName();
    //check PRC version
    if(GetCampaignString(sDBName, "version") != PRC_VERSION)
    {
        DoDebug("Removing old PRC version databases");
        DestroyCampaignDatabase(sDBName);
        DestroyCampaignDatabase(COHORT_DATABASE);
    }
    SetCampaignString(sDBName, "version", PRC_VERSION);

    // 2da cache fingerprint handling
    // This is for detecting a cache updated by someone else upon loading a saved game
    // and avoiding clobbering it.
    string sFingerprint;

    // Generate the fingerprint from module name, current millisecond value and
    // 31-bit random number.
    sFingerprint = GetModuleName() + "_" + IntToString(GetTimeMillisecond()) + "_" + IntToString(Random(0x7fffffff));

    DoDebug("Module 2da cache fingerprint: " + sFingerprint);

    // Store the fingerprint on the module - it will be written to the DB upon cache storage
    SetLocalString(GetModule(), "PRC_2DA_Cache_Fingerprint", sFingerprint);

    // Also store the fingerprint of the DB we will be loading shortly
    SetLocalString(GetModule(), "PRC_2DA_Cache_Fingerprint_LastAccessed", GetCampaignString(sDBName,  "PRC_2DA_Cache_Fingerprint"));

    location lLoc = GetLocation(GetObjectByTag("HEARTOFCHAOS"));
    //only get it if one doesnt already exist (saved games)
    // This never gets run on saved games due to the "prc_mod_load_done" check.
    // However, it is still usefull cleanup in case some unforseen condition does
    // leave a cache object present in a freshly loaded module - Ornedan 20061229
    if(GetIsObjectValid(GetObjectByTag("Bioware2DACache")))
        DestroyObject(GetObjectByTag("Bioware2DACache"));
    DoDebug("Starting to load 2da cache object from " + sDBName);
    object oChest = RetrieveCampaignObject(sDBName, "CacheChest", lLoc);
    if(!GetIsObjectValid(oChest))
        DoDebug("WARNING: Unable to load 2da cache object (CacheChest) from " + sDBName);
    else
        DoDebug("Finished loading 2da cache object from " + sDBName);
}

/**
 * Called when a saved game load is detected. Determines if the
 * 2da cache DB has changed in the meanwhile. If it has, reload the
 * cache creature from the DB.
 */
void CheckDBUpdate()
{
    // Get last loaded (or saved) and DB fingerprints
    string sDBName = GetBiowareDBName();
    string sModuleFingerprint = GetLocalString(GetModule(), "PRC_2DA_Cache_Fingerprint_LastAccessed");
    string sDBFingerprint     = GetCampaignString(sDBName,  "PRC_2DA_Cache_Fingerprint");

    DoDebug("CheckDBUpdate():\n"
          + " Module last access fingerprint: " + sModuleFingerprint + "\n"
          + " Database fingerprint: " + sDBFingerprint
            );
    // If they differ, the DB has changed in meanwhile and we need to reload the cache chest
    if(sModuleFingerprint != sDBFingerprint)
    {
        DoDebug("Fingerprint mismatch, reloading 2da cache from " + sDBName);
        location lLoc = GetLocation(GetObjectByTag("HEARTOFCHAOS"));
        DestroyObject(GetObjectByTag("Bioware2DACache"));

        DoDebug("Starting to load 2da cache object from " + sDBName);
        object oChest = RetrieveCampaignObject(sDBName, "CacheChest", lLoc);
        if(!GetIsObjectValid(oChest))
            DoDebug("ERROR: Unable to load 2da cache object (CacheChest) from " + sDBName);
        else
            DoDebug("Finished loading 2da cache object from " + sDBName);

        // Updated last access fingerprint
        SetLocalString(GetModule(), "PRC_2DA_Cache_Fingerprint_LastAccessed", sDBFingerprint);
    }
}

void main()
{
    object oModule = GetModule();

    OnLoad_Always(oModule);

    // Determine if we are loading a saved game or entering a fresh module
    // Some things should only be run in one situation or the other.
    if(GetLocalInt(oModule, "prc_mod_load_done"))
    {
        OnLoad_Save(oModule);
    }
    else
    {
        SetLocalInt(oModule, "prc_mod_load_done", TRUE);
        OnLoad_Fresh(oModule);
    }
}

/**
 * Things that should always be run on loading a module,
 * irrespective of whether it's a fresh load or a save.
 */
void OnLoad_Always(object oModule)
{
    //this triggers NWNX on Linux
    SetLocalInt(oModule, "NWNX!INIT", 1);
    SetLocalString(oModule, "NWNX!INIT", "1");
}

/**
 * Things that should be run only when a saved game is loaded.
 */
void OnLoad_Save(object oModule)
{
    CheckDBUpdate();
}

/**
 * Things that should only be run when a module is first loaded.
 */
void OnLoad_Fresh(object oModule)
{
    // Set PRC presence & version marker. If plugins ever happen, this would be useful.
    SetLocalString(oModule, "PRC_VERSION", PRC_VERSION);

    SetModuleSwitch(MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS, TRUE); /// @todo This is somewhat intrusive, make it unnecessary and remove

    // Run a script to determine if the PRC Companion is present
    ExecuteScript("hakmarker", OBJECT_SELF);

    //load any default switch 2da
    object oModule = GetModule();
    int i = 0;
    string sSwitchName, sSwitchType, sSwitchValue;
    // Use Get2DAString() instead of Get2DACache() to avoid caching.
    // People might want to set different switch values when playing in different modules.
    // Or just change the switch values midplay.
    while((sSwitchName = Get2DAString("personal_switch", "SwitchName", i)) != "")
    {
        // Read rest of the line
        sSwitchType  = Get2DAString("personal_switch", "SwitchType",  i);
        sSwitchValue = Get2DAString("personal_switch", "SwitchValue", i);

        // Determine switch type and set the var
        if     (sSwitchType == "float")
            SetLocalFloat(oModule, sSwitchName, StringToFloat(sSwitchValue));
        else if(sSwitchType == "int")
            SetPRCSwitch(sSwitchName, StringToInt(sSwitchValue));
        else if(sSwitchType == "string")
            SetLocalString(oModule, sSwitchName, sSwitchValue);

        // Increment loop counter
        i += 1;
    }

    //delay this to avoid TMIs
    DelayCommand(0.01, CreateSwitchNameArray());
    DelayCommand(0.01, DoEpicSpellDefaults());
    DelayCommand(0.01, DoSamuraiBanDefaults());
    SetDefaultFileEnds();
    if(GetPRCSwitch(PRC_CONVOCC_ENABLE))
    {
        SetPRCSwitch(PRC_USE_DATABASE, TRUE);
        //SetPRCSwitch(PRC_DB_PRECACHE, TRUE);
        SetPRCSwitch(PRC_USE_LETOSCRIPT, TRUE);
        // set up the convoCC combination switches
        if(GetPRCSwitch(PRC_CONVOCC_ENFORCE_FEATS))
        {
            SetPRCSwitch(PRC_CONVOCC_ENFORCE_BLOOD_OF_THE_WARLORD, TRUE);
            SetPRCSwitch(PRC_CONVOCC_ENFORCE_FEAT_NIMBUSLIGHT, TRUE);
            SetPRCSwitch(PRC_CONVOCC_ENFORCE_FEAT_HOLYRADIANCE, TRUE);
            SetPRCSwitch(PRC_CONVOCC_ENFORCE_FEAT_SERVHEAVEN, TRUE);
            SetPRCSwitch(PRC_CONVOCC_ENFORCE_FEAT_SAC_VOW, TRUE);
            SetPRCSwitch(PRC_CONVOCC_ENFORCE_FEAT_VOW_OBED, TRUE);
            SetPRCSwitch(PRC_CONVOCC_ENFORCE_FEAT_THRALL_TO_DEMON, TRUE);
            SetPRCSwitch(PRC_CONVOCC_ENFORCE_FEAT_DISCIPLE_OF_DARKNESS, TRUE);
            SetPRCSwitch(PRC_CONVOCC_ENFORCE_FEAT_LICHLOVED, TRUE);
            SetPRCSwitch(PRC_CONVOCC_ENFORCE_FEAT_EVIL_BRANDS, TRUE);
            SetPRCSwitch(PRC_CONVOCC_ENFORCE_FEAT_VILE_WILL_DEFORM, TRUE);
            SetPRCSwitch(PRC_CONVOCC_ENFORCE_FEAT_VILE_DEFORM_OBESE, TRUE);
            SetPRCSwitch(PRC_CONVOCC_ENFORCE_FEAT_VILE_DEFORM_GAUNT, TRUE);
            SetPRCSwitch(PRC_CONVOCC_ENFORCE_FEAT_LOLTHS_MEAT, TRUE);
        }
        if(GetPRCSwitch(PRC_CONVOCC_ENFORCE_PNP_RACIAL))
        {
            SetPRCSwitch(PRC_CONVOCC_RAKSHASA_FEMALE_APPEARANCE, TRUE);
            SetPRCSwitch(PRC_CONVOCC_GENASI_ENFORCE_DOMAINS, TRUE);
            SetPRCSwitch(PRC_CONVOCC_DROW_ENFORCE_GENDER, TRUE);
            SetPRCSwitch(PRC_CONVOCC_TIEFLING_TAIL, TRUE);
            SetPRCSwitch(PRC_CONVOCC_FEYRI_TAIL, TRUE);
            SetPRCSwitch(PRC_CONVOCC_FEYRI_WINGS, TRUE);
            SetPRCSwitch(PRC_CONVOCC_AVARIEL_WINGS, TRUE);
        }
    }
    if(GetPRCSwitch(PRC_USE_BIOWARE_DATABASE) == 0)
        SetPRCSwitch(PRC_USE_BIOWARE_DATABASE, 300);//100 HBs = 1800sec = 30min
    if(GetPRCSwitch(PRC_USE_BIOWARE_DATABASE))
        DelayCommand(1.0, CheckDB());

    if(GetPRCSwitch(PRC_USE_DATABASE))
    {
        PRC_SQLInit();
        if(GetPRCSwitch(PRC_DB_SQLITE))
            StartSQLiteCommitHB();
    }
    if(GetPRCSwitch(PRC_DB_PRECACHE))
        Cache_2da_data();
    //pre-made cohorts
    //DelayCommand(6.0, AddPremadeCohortsToDB());
    //done differently now

    //check for letoscript dir
    /*    if(GetLocalString(oModule, PRC_LETOSCRIPT_NWN_DIR) == "")
    {
        string sDir = Get2DACache("directory", "Dir", 0);
        if(sDir != "")
            SetLocalString(oModule, PRC_LETOSCRIPT_NWN_DIR, sDir);
    } */

    //delay the 2da lookup stuff
    DelayCommand(12.0, MakeLookupLoopMaster());

    //mark server as loading
    float fDelay = IntToFloat(GetPRCSwitch(PRC_PW_LOGON_DELAY))*60.0;
    if(fDelay>0.0)
    {
        SetLocalInt(GetModule(), PRC_PW_LOGON_DELAY+"_TIMER", TRUE);
        DelayCommand(fDelay, DeleteLocalInt(GetModule(), PRC_PW_LOGON_DELAY+"_TIMER"));
    }
}


SIMTools Modload

Code:

//::////////////////////////////////////////////////////////////////////////:://
//:: SIMTools V3.0 Speech Integration & Management Tools Version 3.0        :://
//:: Created By: FunkySwerve                                                :://
//:: Created On: April 4 2006                                               :://
//:: Last Updated: March 27 2007                                            :://
//:: With Thanks To:                                                        :://
//:: Dumbo - for his amazing plugin                                         :://
//:: Virusman - for Linux versions, and for the reset plugin, and for       :://
//::    his excellent events plugin, without which this update would not    :://
//::    be possible                                                         :://
//:: Dazzle - for his script samples                                        :://
//:: Butch - for the emote wand scripts                                     :://
//:: The DMFI project - for the languages conversions and many of the emotes:://
//:: Lanessar and the players of the Myth Drannor PW - for the new languages:://
//:: The players and DMs of Higher Ground for their input and playtesting   :://
//::////////////////////////////////////////////////////////////////////////:://
#include "fky_chat_inc"
#include "x2_inc_switches"
void main()
{
    // Init placeholders for ODBC gateway
    SQLInit();
    // Init placeholders for chat gateway
    InitSpeech();
    SetModuleSwitch(MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS ,TRUE);
}


default bioware modload

Code:

//::///////////////////////////////////////////////
//:: Example XP2 OnLoad Script
//:: x2_mod_def_load
//:: (c) 2003 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Put into: OnModuleLoad Event

    This example script demonstrates how to tweak the
    behavior of several subsystems in your module.

    For more information, please check x2_inc_switches
    which holds definitions for several variables that
    can be set on modules, creatures, doors or waypoints
    to change the default behavior of Bioware scripts.

    Warning:
    Using some of these switches may change your games
    balancing and may introduce bugs or instabilities. We
    recommend that you only use these switches if you
    know what you are doing. Consider these features
    unsupported!

    Please do NOT report any bugs you experience while
    these switches have been changed from their default
    positions.

    Make sure you visit the forums at nwn.bioware.com
    to find out more about these scripts.

*/
//:://////////////////////////////////////////////
//:: Created By: Georg Zoeller
//:: Created On: 2003-07-16
//:://////////////////////////////////////////////

#include "x2_inc_switches"
#include "x2_inc_restsys"
void main()
{
   if (GetGameDifficulty() ==  GAME_DIFFICULTY_CORE_RULES || GetGameDifficulty() ==  GAME_DIFFICULTY_DIFFICULT)
   {
        // * Setting the switch below will enable a seperate Use Magic Device Skillcheck for
        // * rogues when playing on Hardcore+ difficulty. This only applies to scrolls
        SetModuleSwitch (MODULE_SWITCH_ENABLE_UMD_SCROLLS, TRUE);

       // * Activating the switch below will make AOE spells hurt neutral NPCS by default
       // SetModuleSwitch (MODULE_SWITCH_AOE_HURT_NEUTRAL_NPCS, TRUE);
   }

   // * AI: Activating the switch below will make the creaures using the WalkWaypoint function
   // * able to walk across areas
   // SetModuleSwitch (MODULE_SWITCH_ENABLE_CROSSAREA_WALKWAYPOINTS, TRUE);

   // * Spells: Activating the switch below will make the Glyph of Warding spell behave differently:
   // * The visual glyph will disappear after 6 seconds, making them impossible to spot
   // SetModuleSwitch (MODULE_SWITCH_ENABLE_INVISIBLE_GLYPH_OF_WARDING, TRUE);

   // * Craft Feats: Want 50 charges on a newly created wand? We found this unbalancing,
   // * but since it is described this way in the book, here is the switch to get it back...
   // SetModuleSwitch (MODULE_SWITCH_ENABLE_CRAFT_WAND_50_CHARGES, TRUE);

   // * Craft Feats: Use this to disable Item Creation Feats if you do not want
   // * them in your module
   // SetModuleSwitch (MODULE_SWITCH_DISABLE_ITEM_CREATION_FEATS, TRUE);

   // * Palemaster: Deathless master touch in PnP only affects creatures up to a certain size.
   // * We do not support this check for balancing reasons, but you can still activate it...
   // SetModuleSwitch (MODULE_SWITCH_SPELL_CORERULES_DMASTERTOUCH, TRUE);

   // * Epic Spellcasting: Some Epic spells feed on the liveforce of the caster. However this
   // * did not fit into NWNs spell system and was confusing, so we took it out...
   // SetModuleSwitch (MODULE_SWITCH_EPIC_SPELLS_HURT_CASTER, TRUE);

   // * Epic Spellcasting: Some Epic spells feed on the liveforce of the caster. However this
   // * did not fit into NWNs spell system and was confusing, so we took it out...
   // SetModuleSwitch (MODULE_SWITCH_RESTRICT_USE_POISON_TO_FEAT, TRUE);

    // * Spellcasting: Some people don't like caster's abusing expertise to raise their AC
    // * Uncommenting this line will drop expertise mode whenever a spell is cast by a player
    // SetModuleSwitch (MODULE_VAR_AI_STOP_EXPERTISE_ABUSE, TRUE);


    // * Item Event Scripts: The game's default event scripts allow routing of all item related events
    // * into a single file, based on the tag of that item. If an item's tag is "test", it will fire a
    // * script called "test" when an item based event (equip, unequip, acquire, unacquire, activate,...)
    // * is triggered. Check "x2_it_example.nss" for an example.
    // * This feature is disabled by default.
   SetModuleSwitch (MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS, TRUE);

   if (GetModuleSwitchValue (MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS) == TRUE)
   {
        // * If Tagbased scripts are enabled, and you are running a Local Vault Server
        // * you should use the line below to add a layer of security to your server, preventing
        // * people to execute script you don't want them to. If you use the feature below,
        // * all called item scrips will be the prefix + the Tag of the item you want to execute, up to a
        // * maximum of 16 chars, instead of the pure tag of the object.
        // * i.e. without the line below a user activating an item with the tag "test",
        // * will result in the execution of a script called "test". If you uncomment the line below
        // * the script called will be "1_test.nss"
        // SetUserDefinedItemEventPrefix("1_");

   }

   // * This initializes Bioware's wandering monster system as used in Hordes of the Underdark
   // * You can deactivate it, making your module load faster if you do not use it.
   // * If you want to use it, make sure you set "x2_mod_def_rest" as your module's OnRest Script
   // SetModuleSwitch (MODULE_SWITCH_USE_XP2_RESTSYSTEM, TRUE);

   if (GetModuleSwitchValue(MODULE_SWITCH_USE_XP2_RESTSYSTEM) == TRUE)
   {

       // * This allows you to specify a different 2da for the wandering monster system.
       // SetWanderingMonster2DAFile("des_restsystem");

       //* Do not change this line.
       WMBuild2DACache();
   }

}

_________________
The Realm of Tharagon NWN PW
Back to top
View user's profile Send private message
Paul R



Joined: 17 Apr 2009
Posts: 42

PostPosted: Wed Nov 11, 2009 21:21    Post subject: Reply with quote

Ta, well not too many NWNX functions in there, if the log can be believed then the crash occurs around these lines:

Code:
    DoDebug("Starting to load 2da cache object from " + sDBName);
    object oChest = RetrieveCampaignObject(sDBName, "CacheChest", lLoc);
    if(!GetIsObjectValid(oChest))
        DoDebug("WARNING: Unable to load 2da cache object (CacheChest) from " + sDBName);
    else
        DoDebug("Finished loading 2da cache object from " + sDBName);


You're also using lLoc but without a check if the Object it's getting the location of up above is valid. So I guess that could be checked first because I don't know how much of a sanity check is done on the args and it wouldn't be the first function to crash the server with an invalid value.
Back to top
View user's profile Send private message
william_hunter



Joined: 31 Jan 2007
Posts: 149

PostPosted: Wed Nov 11, 2009 21:58    Post subject: Reply with quote

I see...so the CacheChest which apparently controls the caching of the 2das on the database is not loading properly which makes sense if you consider this:

Code:

[Wed Nov 11 09:57:57] Loading Module: The Shard Beta
[Wed Nov 11 09:58:31] Module 2da cache fingerprint: The Shard_352_1061460218
[Wed Nov 11 09:58:31] Starting to load 2da cache object from prc_datac2


Which is where the load process is when it goes down.

..time to pick at the brains of the PRC people now!

Thanks for the help. Getting closer is good..

As for the shell scripting, also, thanks! I will have to re-write that script and add in some rotation for the logs. I was using Webmin before to do that, but I prefer not to use that if I can help it
_________________
The Realm of Tharagon NWN PW
Back to top
View user's profile Send private message
Paul R



Joined: 17 Apr 2009
Posts: 42

PostPosted: Wed Nov 11, 2009 23:13    Post subject: Reply with quote

Yeah but what I meant is that this function is fairly standard:

Code:
object oChest = RetrieveCampaignObject(sDBName, "CacheChest", lLoc);


and the only suspect thing is there is lLoc as the Object returned is not checked.

Code:
location lLoc = GetLocation(GetObjectByTag("HEARTOFCHAOS"));


This is not part of PRC so personally I would check that object first before using it. Then I would be looking at RCO if that is being hooked and look at nwnx*.so versions.
Back to top
View user's profile Send private message
william_hunter



Joined: 31 Jan 2007
Posts: 149

PostPosted: Thu Nov 12, 2009 0:07    Post subject: Reply with quote

That script came from PRC and is unmodified. HEARTOFCHAOS refers to a chest that is included in the erf.
_________________
The Realm of Tharagon NWN PW
Back to top
View user's profile Send private message
Paul R



Joined: 17 Apr 2009
Posts: 42

PostPosted: Thu Nov 12, 2009 0:25    Post subject: Reply with quote

Ah fair enough if you're sure. Try commenting out the RCO, set oChest to OBJECT_INVALID and see if that gets to the if statement below.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux technical support All times are GMT + 2 Hours
Goto page 1, 2  Next
Page 1 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