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 
 
NWNX2, Letoscript, and Windows 7! HELP! Scripts posted!
Goto page 1, 2  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows technical support
View previous topic :: View next topic  
Author Message
WardenWolf



Joined: 22 Aug 2010
Posts: 10

PostPosted: Sun Aug 22, 2010 2:34    Post subject: NWNX2, Letoscript, and Windows 7! HELP! Scripts posted! Reply with quote

I'm building a new machine for the game world 12 Dark Secrets. I have everything set up exactly as it is on the old server. We use Letoscript to modify characters ingame. This machine is practicing some bizarre voodoo against me, and I need help getting to the bottom of it. The machine is a quad-core Phenom II 3.4 ghz with 8 gigs of RAM running Windows 7 64-bit.

1. When I try to use NWNX to load the server with a module that has the Letoscript tie-ins, the server crashes. If I try it on a regular module, it works just fine.

2. Since I have read of problems with using madchook.dll on 64-bit systems, I tried it on an XP Virtual Machine with 1.5 gigs of allocated memory. It still crashes.

3. When I try to run the server with NWNX2 over a mapped network drive on MY Windows 7 64-bit machine, using the very same configuration files, plugins, etc, it works FINE. Natively. On 64-bit.

4. I tried it on the new machine with only 4 gigs of RAM, and it still crashes.

Can someone PLEASE help? I have installed virtually everything I have on my machine on the server. They're both AMD Phenom-series CPUs (mine's a Phenom quad 2.6 ghz, server is a Phenom II quad 3.4 ghz), both AMD-based Gigabyte motherboards, etc. All drivers are the same.


Last edited by WardenWolf on Tue Aug 24, 2010 2:32; edited 1 time in total
Back to top
View user's profile Send private message
Zebranky



Joined: 04 Jun 2006
Posts: 415

PostPosted: Sun Aug 22, 2010 6:36    Post subject: Reply with quote

http://www.nwnx.org/phpBB2/viewtopic.php?t=1136 may help.
_________________
Win32 SVN builds: http://www.mercuric.net/nwn/nwnx/

<Fluffy-Kooshy> NWNx plugin is to this as nuclear warheads are to getting rid of fire ants.

<ThriWork> whenever I hear nwn extender, I think what does NWN need a penis extender for?
Back to top
View user's profile Send private message Visit poster's website
WardenWolf



Joined: 22 Aug 2010
Posts: 10

PostPosted: Sun Aug 22, 2010 6:57    Post subject: Reply with quote

Nope. Still doesn't work on the server but works fine on my PC. It's the server that's crashing. Not NWNX.
Back to top
View user's profile Send private message
Zebranky



Joined: 04 Jun 2006
Posts: 415

PostPosted: Sun Aug 22, 2010 8:11    Post subject: Reply with quote

Do you mean the server machine, or just the NWN server? The latter is expected from any NWNX-related crashes -- all NWNX plugins are actually running under the nwserver process, so errors will crash nwserver, not NWNX.

Can you post any scripts that might be related to the crash, particularly Leto initialization scripts, if such things exist? (I don't know -- I've never actually used nwnx_leto.) Someone more experienced with it might spot an issue. Otherwise there are bigger guns we can bring in, such as attaching a debugger.
_________________
Win32 SVN builds: http://www.mercuric.net/nwn/nwnx/

<Fluffy-Kooshy> NWNx plugin is to this as nuclear warheads are to getting rid of fire ants.

<ThriWork> whenever I hear nwn extender, I think what does NWN need a penis extender for?
Back to top
View user's profile Send private message Visit poster's website
WardenWolf



Joined: 22 Aug 2010
Posts: 10

PostPosted: Sun Aug 22, 2010 11:09    Post subject: Reply with quote

Just the NWN server, nwserver.exe. There's no scripts. Any time I try to load a module with Leto tie-ins with NWNX2 running on that machine, it crashes.
Back to top
View user's profile Send private message
Nabla



Joined: 19 Aug 2010
Posts: 4

PostPosted: Sun Aug 22, 2010 13:13    Post subject: Reply with quote

I don't know nwnx-leto plugin, but the following details may help finding the cause.

If you lauch the server without nwnx2 did it crash?
If it doesn't work, try to test alone all nwnx2 plugin. For removing a nwnx2 plugin, you move it outside of nwn directory.
Then more detail on when the server crash and the message that it gave may help.

What version of nwn, nwnx2, and plugin are you using?

Like say before, a nwnx2 plugin may make crash nwn server.

I am not a specialist but a possibility in think is that for some reason that i don't know the offset are different or other funny think that make that memory is different in the two machine.
Back to top
View user's profile Send private message
Fireboar



Joined: 17 Feb 2008
Posts: 323

PostPosted: Sun Aug 22, 2010 16:45    Post subject: Reply with quote

Just to check... you are using Leto 24 and not Leto 26, right? And does the module in question still crash nwserver even without NWNX?
Back to top
View user's profile Send private message
Zebranky



Joined: 04 Jun 2006
Posts: 415

PostPosted: Sun Aug 22, 2010 17:12    Post subject: Reply with quote

WardenWolf wrote:
Just the NWN server, nwserver.exe. There's no scripts. Any time I try to load a module with Leto tie-ins with NWNX2 running on that machine, it crashes.

This seems self-contradictory to me -- we may have another misunderstanding here. What do you mean by "Leto tie-ins"? To me, that means you must have some sort of scripts in that module that are calling nwnx_leto.
_________________
Win32 SVN builds: http://www.mercuric.net/nwn/nwnx/

<Fluffy-Kooshy> NWNx plugin is to this as nuclear warheads are to getting rid of fire ants.

<ThriWork> whenever I hear nwn extender, I think what does NWN need a penis extender for?
Back to top
View user's profile Send private message Visit poster's website
WardenWolf



Joined: 22 Aug 2010
Posts: 10

PostPosted: Sun Aug 22, 2010 23:51    Post subject: Reply with quote

There's scripts in the module to tie in, yes. We have a device in the module that adjusts player's stats, and it uses nwnx_leto. I dare not touch it, as it's a very complex and sensitive part of the game. I'm using Leto version 24. Nwserver.exe does NOT crash when I load the module without NWNX2. However, invariably it crashes when I try to use it with NWNX2. It's an instant crash as soon as the module finishes loading. Instead of going, "Running, login at will", it crashes. It ONLY crashes on that machine, and it ONLY crashes when loading a module with Leto tie-ins. It does not crash on my machine running Windows 7. At this point, I have NO idea what's going on here. It doesn't even work in an XP Virtualbox container on that machine, yet it works over a network share to my machine.
Back to top
View user's profile Send private message
WardenWolf



Joined: 22 Aug 2010
Posts: 10

PostPosted: Mon Aug 23, 2010 8:15    Post subject: Reply with quote

Here are the 4 main scripts we use:

qd_inc_lsfunks
Quote:
//*//////////////////////
//* Created by: Quasi
//* Date: 4/18/2006
//*//////////////////////


/*
qd_inc_lsfunks
Functions to make LS scripting easier
Leto Script build 23 & 24 (either should work)
*/


// Change a PC in some way, as specified in Script.
// This just sets up the Script on the PC as LocalInt
// The onmodexit script takes care of running it when the PC exits
void ApplyWishScriptToPC(string Script, object PC);

// Just run some Leto Script. Blocks during execution, and returns it's
// result. For like exporting NPCs, changing erfs etc.
// onmodexit looks to see if PC has a script set on exit, if exists
// then executes it - this is how the bic is edited. But can be read anytime
string WishScript(string Script);


void ApplyWishScriptToPC(string Script, object PC)
{
string sSV = GetLocalString(GetModule(), "SERVERVAULT");
string sSV4PC = sSV + GetPCPlayerName(PC) + "/";
string sIP = GetCampaignString("12dark2","ip1");
string sPass = "";
float fTiming = 3.0;
string sPC = GetPCPlayerName(PC);
Script =
"$RealFile = q<" + sSV4PC + "> + FindNewestBic q<" + sSV4PC + ">;" +
"$EditFile = $RealFile + '.utc';FileRename $RealFile, $EditFile;" +
"%bic = $EditFile or die;" + Script + "%bic = '>';close %bic;" +
"FileRename $EditFile, $RealFile;";

SetLocalString(PC, "WishScript", Script);

//*Below is for troubleshooting the scripts going to LS
//*it just sends them to the log - comment out as needed
//SetLocalString(PC, "NWNX!LETO!LOG", Script);

//SendMessageToPC(PC, "portal ip is: " + sIP);

if(sIP != "")
{
ExportSingleCharacter(PC);
DelayCommand(2.7,SetCampaignInt("duo_ck_12ds",sPC,0));
DelayCommand(fTiming, ActivatePortal(PC, sIP, sPass, "", TRUE) );
}
else
{
DelayCommand(fTiming, BootPC(PC) );
}
}

string WishScript(string Script)
{
SetLocalString(GetModule(), "NWNX!LETO!SCRIPT", Script);
return GetLocalString(GetModule(), "NWNX!LETO!SCRIPT");
}


qd_inc_wishgonks
Quote:
//*//////////////////////
//* Created by: Quasi
//* Date: 4/18/2006
//*//////////////////////

/*
Various functions for gonkulating wish info
Make sure to #include "qd_inc_wishgonks"
*/

//Checks Qty of wishes in oPC inventory
int GetQtyWishes(object oPC);

//Checks Greater Wishes in oPC inventory
int GetGrtWishes(object oPC);

//Checks Supreme Wishes in oPC inventory
int GetSupWishes(object oPC);

// iAS = Ability Score iAsk = how many points oPC wants
// returns true or false
int HasMinWish(int iAS, int iAsk, object oPC);

// iAS = Ability Score iAsk = how many points oPC wants
// returns Integer of how many are required
int WishesRequired(int iAS, int iAsk, object oPC);

// Does what is says - just tell it how many
// returns how many wishes taken
int TakeWishes(object oPC, int iQty);

// Does what is says - just tell it how many
// returns how many greater wishes taken
int TakeGWishes(object oPC, int iQty);

// Does what is says - just tell it how many
// returns how many supreme wishes taken
int TakeSWishes(object oPC, int iQty);


// Get Base Stat of PC where stat is iAT
// iAT = ABILITY_TYPE_*
// returns 0 on error
int GetBaseStat(object oPC, int iAT);

//Simple method while to transfer script ownership to PC
//so animations can executed on them during other SpecialFX
//oPC is just that and nEffect is a number 0-2x for which effect
void WishEffect(object oPC, int nEffect);

//just a quick one for counting anything (added as after thought or
//I would have just used this ONE for wishes & gws and eveyrhintg else I need
int GetQty(object oPC, string sTag);

// actual wishes in inventory
int GetQtyWishes(object oPC)
{
int nWishes = 0;
object oItem = GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oItem))
{
if (GetTag(oItem) == "wish")
{
nWishes++;
}
oItem = GetNextItemInInventory(oPC);
}
return (nWishes);
}

// actual Greater Wishes in inventory
int GetGrtWishes(object oPC)
{
int nGWishes = 0;
object oItem = GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oItem))
{
if (GetTag(oItem) == "wish001")
{
nGWishes++;
}
if (GetTag(oItem) == "greaterwish")
{
nGWishes++;
}
oItem = GetNextItemInInventory(oPC);
}
return (nGWishes);
}

// supreme wishes in inventory
int GetSupWishes(object oPC)
{
int nWishes = 0;
object oItem = GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oItem))
{
if (GetTag(oItem) == "supremewish")
{
nWishes++;
}
oItem = GetNextItemInInventory(oPC);
}
return (nWishes);
}

// iAS = Ability Score iAsk = how many points oPC wants
int HasMinWish(int iAS, int iAsk, object oPC)
{
if (iAS+iAsk >= 41) return FALSE;
int iCostLvl;
int iQtyNeeded = 0;
int i;
for(i=0; i < iAsk; i++)
{
iCostLvl = (iAS+i-20)/5;
switch (iCostLvl)
{
case 0: iQtyNeeded ++;break;
case 1: iQtyNeeded += 2;break;
case 2: iQtyNeeded += 3;break;
case 3: iQtyNeeded += 4;break;
default: return FALSE;
}

}
return GetQtyWishes(oPC) >= iQtyNeeded;
}

// iAS = Ability Score iAsk = how many points oPC wants
int WishesRequired(int iAS, int iAsk, object oPC)
{
if (iAS+iAsk >= 41) return 1000;
int iCostLvl = 0;
int iQtyNeeded = 0;
int i;
for(i=0; i < iAsk; i++)
{
iCostLvl = (iAS+i-20)/5;
switch (iCostLvl)
{
case 0: iQtyNeeded ++;break;
case 1: iQtyNeeded += 2;break;
case 2: iQtyNeeded += 3;break;
case 3: iQtyNeeded += 4;break;
default: iQtyNeeded ++;break;
}

}
return iQtyNeeded;
}


int TakeWishes(object oPC, int iQty)
{
int nCount = 0;
object oItem = GetFirstItemInInventory(oPC);

while (GetIsObjectValid(oItem) == TRUE && nCount < iQty)
{
if (GetTag(oItem) == "wish")
{
DestroyObject(oItem, 1.0);
nCount++;
}
oItem = GetNextItemInInventory(oPC);
}
return nCount;
}

int TakeGWishes(object oPC, int iQty)
{
int nCount = 0;

object oItem = GetFirstItemInInventory(oPC);

while (GetIsObjectValid(oItem) == TRUE && nCount < iQty)
{
if (GetTag(oItem) == "wish001" || GetTag(oItem) == "greaterwish")
{
DestroyObject(oItem,1.0);
nCount++;
}
oItem = GetNextItemInInventory(oPC);
}

return nCount;
}

int TakeSWishes(object oPC, int iQty)
{
int nCount = 0;

object oItem = GetFirstItemInInventory(oPC);

while (GetIsObjectValid(oItem) == TRUE && nCount < iQty)
{
if (GetTag(oItem) == "supremewish" )
{
DestroyObject(oItem,1.0);
nCount++;
}
oItem = GetNextItemInInventory(oPC);
}

return nCount;
}



// iAT = ABILITY_TYPE_*
// not used since the 1.67 update allowed us to get base abilities
int GetBaseStat(object oPC, int iAT)
{
if (!GetIsPC(oPC)) return 0;
int iRace = GetRacialType(oPC); //We will have to check racial bonuses/penalties
int iBS; //actual base stat as saved in your bic file. Then modded by race.
string sAbility; //Abbreviation for ability we'll be checking

//Send current character to the bic by saving.
//ExportSingleCharacter(oPC);

switch (iAT)
{
case 0: sAbility = "Str";break;
case 1: sAbility = "Dex";break;
case 2: sAbility = "Con";break;
case 3: sAbility = "Int";break;
case 4: sAbility = "Wis";break;
case 5: sAbility = "Cha";break;
default: return 0;
}

//Setup script to read proper ability;
string sSV = GetLocalString(GetModule(), "SERVERVAULT");
string sSV4PC = sSV + GetPCPlayerName(oPC) + "/";
string Script = "%bic = q<" + sSV4PC + "> + FindNewestBic q<" + sSV4PC +
">;</" + sAbility + ">;" + "close %bic;";

//read PCs attribs from last saved .bic
SetLocalString(GetModule(), "NWNX!LETO!SCRIPT", Script);
iBS = StringToInt(GetLocalString(GetModule(), "NWNX!LETO!SCRIPT"));

//SendMessageToPC(oPC, "Your base " + sAbility + " is "+ IntToString(iBS) +
// " BEFORE racial adjustment");

// switch(i) is to step through the stats and modify per PC's race
switch (iAT)
{
case 0:
switch (iRace)
{
case 2: iBS -= 2;break;
case 3: iBS -= 2;break;
case 5: iBS += 2;break;
}
break;
case 1:
if (iRace == 1 ||iRace == 3) iBS +=2;break;
case 2:
switch (iRace)
{
case 0: iBS += 2;break;
case 1: iBS -= 2;break;
case 2: iBS += 2;break;
}
break;
case 3:
if (iRace == 5) iBS -= 2; break;
case 5:
if (iRace == 0 ||iRace == 5) iBS -=2;break;
}

//SendMessageToPC(oPC, "Your base " + sAbility + " is "+ IntToString(iBS) +
// " AFTER racial adjustment");

return iBS;
}

void WishEffect(object oPC, int nEffect)
{
SetLocalInt(oPC,"nEffect",nEffect);
ExecuteScript("qd_fx_wishfx",oPC);
}

// count number of 1 item in inventory
int GetQty(object oPC, string sTag)
{
int nItems = 0;
object oItem = GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oItem))
{
if (GetTag(oItem) == sTag)
{
nItems++;
}
oItem = GetNextItemInInventory(oPC);
}
return (nItems);
}


Adjust stat points script:
Code:
#include "qd_inc_wishgonks"
#include "qd_inc_lsfunks"

void main()
{
 object PC = GetPCSpeaker();
 string Script;
 int iAbility = GetLocalInt(PC,"iAbility");
 int iBS = GetLocalInt(PC,"BS"+IntToString(iAbility));
 int iWishes = GetQtyWishes(PC);
 int iGrt = GetGrtWishes(PC);
 int iSup = GetSupWishes(PC);
 int iWR = WishesRequired(iBS,1,PC);
 float fTiming = 1.5;

 switch(iAbility)
    {
     case 0: Script = "/Str = /Str + 1;";break;
     case 1: Script = "/Dex = /Dex + 1;";break;
     case 2: Script = "/Con = /Con + 1;";break;
     case 3: Script = "/Int = /Int + 1;";break;
     case 4: Script = "/Wis = /Wis + 1;";break;
     case 5: Script = "/Cha = /Cha + 1;";break;
    }

if (iWishes >= iWR && iBS < 40)
    {
     WishEffect(PC,8);
     TakeWishes(PC, iWR);
     DelayCommand( fTiming, ApplyWishScriptToPC(Script, PC) );
     SetLocalString(PC, "NWNX!LETO!LOG", GetName(PC) + " had " + IntToString(iBS)
     + " in ability: " + IntToString(iAbility) + " and wished for 1 point.");
    }
else if (iGrt >= 1 && iBS >= 40 && iBS <= 49)
    {
     WishEffect(PC,8);
     TakeGWishes(PC, 1);
     DelayCommand( fTiming, ApplyWishScriptToPC(Script, PC) );
    }
else if (iSup >= 1 && iBS >= 50 && iBS <= 59)
    {
     WishEffect(PC,8);
     TakeSWishes(PC, 1);
     DelayCommand( fTiming, ApplyWishScriptToPC(Script, PC) );
    }

else
    {
     SendMessageToPC(PC, "You need to have "+IntToString(iWR)+" wishes.  " +
     "You only have " + IntToString(iWishes));
     SetLocalString(PC, "NWNX!LETO!LOG", GetName(PC) + " tried to cheat by " +
     "dropping wishes from inventory");
    }

}


Max Hitpoints Script:

Code:

#include "qd_inc_wishgonks"
#include "qd_inc_lsfunks"

//This script requires the classes.2da file be in the NWN\SOURCE\ directory
//This script uses that file to calculate max hp for each class/level
void main()
{
    object PC = GetPCSpeaker();
  SetCutsceneMode(PC,TRUE,TRUE);
 if (GetHitDice(PC) >39 && GetQtyWishes(PC)>= 3)
   {
    string sSrc = GetLocalString(GetModule(),"SOURCEDIR");

    // Add extra effects here
    ApplyEffectToObject(
        DURATION_TYPE_TEMPORARY,
        SupernaturalEffect(EffectKnockdown()),
        PC, 3.0f
    );

    //this is a beautiful piece of script - gorgeous - wish it was mine
    string Script =
    "meta dir => '" + sSrc + "'; $RDD = 0; for(/LvlStatList)" +
    "{ $HD = lookup 'classes', /~/LvlStatClass, 'HitDie';" +
    "if(/~/LvlStatClass == 37) { $RDD++; $HD = $RDD < 4  ? $HD : " +
    "$RDD < 6  ? 8 : $RDD < 11 ? 10 : 12; } /~/LvlStatHitDie = $HD; }";

      TakeWishes(PC,3);
      SendMessageToAllDMs( "3 WISHES has been used to Max HPs");

    DelayCommand( 1.0f, ApplyWishScriptToPC(Script, PC) );

   }

}

    /* **  This makes the above easier to read and understand
       **  This is Leto script - weathersong is this guy's site

    Without RDD this would be 2 lines long

    meta dir => '" + sSrc + "';     //where do I find classes.2da
    $RDD = 0;                       //Set RDD to level 0
    for(/LvlStatList)  //for each level
        {
         $HD = lookup 'classes', /~/LvlStatClass, 'HitDie'; //lookup class hitdice
         if(/~/LvlStatClass == 37)   //if RDD keep track of how many levels
            {                        //so we can add proper hit points to user
             $RDD++;
             $HD = $RDD < 4  ? $HD : $RDD < 6  ? 8 : $RDD < 11 ? 10 : 12;
            }
         /~/LvlStatHitDie = $HD;     //set the hitpoints you rolled for this level
        }                            //to whatever the hit die was we looked up
    */
Back to top
View user's profile Send private message
Fireboar



Joined: 17 Feb 2008
Posts: 323

PostPosted: Tue Aug 24, 2010 14:52    Post subject: Reply with quote

What other NWNX plugins are you using? Isolate the cause of the crash. You can do this by creating a "plugin-unused" directory and moving plugins there to figure out which one(s) is/are causing the crash. I suggest starting with just vanilla NWNX, then adding plugins one by one. Once you've found one it crashes with, try all plugins except that one to confirm that it really is only that one plugin, if not repeat the process.

If you're sure it's Letoscript, you can just disable nwnx_leto in this way and see if it still crashes.
Back to top
View user's profile Send private message
WardenWolf



Joined: 22 Aug 2010
Posts: 10

PostPosted: Wed Aug 25, 2010 1:01    Post subject: Reply with quote

We're ONLY using nwnx_leto. That's all we use. And it only crashes when we load the leto plugin. I disabled the leto plugin and it works. But, of course, we need it for the stats editing.
Back to top
View user's profile Send private message
Lokey



Joined: 02 Jan 2005
Posts: 158

PostPosted: Wed Aug 25, 2010 4:30    Post subject: Re: NWNX2, Letoscript, and Windows 7! HELP! Scripts posted! Reply with quote

WardenWolf wrote:
Windows 7 64-bit

This I'd wager. What version madchook.dll are you running?

If nwnx_funcs for windows is up to snuff, what you have posted can be trivially replaced with that (for the leto portions). Max hitpoints is a server ini setting now, if you need more hitpoints...I don't know if that's been ported.
_________________
Neversummer PW NWNx powered mayhem Wink
Back to top
View user's profile Send private message
WardenWolf



Joined: 22 Aug 2010
Posts: 10

PostPosted: Wed Aug 25, 2010 5:43    Post subject: Reply with quote

The problem is that it also crashes in a Windows XP 32-bit VM. And a 32-bit Linux VM. And it works fine on my Windows 7 64-bit machine over a network share from the server; just not running directly on the server machine. I'm using the last-released version of madchook that comes with NWNX, the 2005 version. If anyone has access to a newer version of madchook, I'd love to have it.

We have Max Hitpoints enabled on the server now, but the Max Hitpoints function is to bring older characters up to snuff, by effectively reformatting them up to max hitpoints without having to relevel. They're paying for convenience.

I need some scripting help here. I'm an expert NWN scripter, but Leto and external tie-ins aren't something I've dealt with before. I inherited this. If anyone could show me how to possibly get this working again with better code, I would be eternally grateful.
Back to top
View user's profile Send private message
Fireboar



Joined: 17 Feb 2008
Posts: 323

PostPosted: Wed Aug 25, 2010 15:46    Post subject: Reply with quote

Help us out here. Any time you see NWNX!LETO!something, add a PrintString before and after to find out what's being sent and where the point of crash is. Debug lines are your friends.
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
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