Regen.ecl not finding module npc

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 097.
Note: Core 097 is no longer officially supported.

Moderator: POL Developer

goqsane
Neophyte Poster
Posts: 38
Joined: Mon Sep 29, 2008 2:25 am

Regen.ecl not finding module npc

Post by goqsane »

Welcome!

Today, after a very long session of converting my scripts for the POL97 standard I finally danced in joy, when ecompile said that all the scripts were updated and recompiled.
My happiness didn't last long though, I discovered soon enough that there was something wrong with my regen files, and I don't quite understand what might be wrong

the error I'm getting is

Code: Select all

WARNING: pkg/foundations/hooks/regen.ecl: Unable to find module npc
Error reading configuration file pkg/foundations/hooks/vitals.cfg:
        Export Script pkg/foundations/hooks/regen.ecl not found
        Element: Vital Life, found on line 1
Server Shutdown: load_vitals_cfg: load_packed_cfgs
Execution aborted due to: Configuration file error
and regen.src

Code: Select all

use attributes;
use basic;
use uo;
use cfgfile;

include "include/tempmods";
include ":wearwolf:wearwolf";

const MAX_VITAL_VALUE := 200;

var npcdesccfg := ReadConfigFile(":*:npcdesc");

program regen()
    return 1;
endprogram

exported function GetLifeRegenRateExported(mob)

    if(IsWearWolfMorphed(mob))
        return 6000;
    endif

    if(IsWearWolf(mob))
        return 2500;
    endif  

    var rate := GetObjProperty(mob, CPROP_NAME_PREFIX_REGEN_RATE+VITALID_LIFE);
    if(rate != error)
        return CInt(rate);
    endif

    return 1200;

endfunction

exported function GetLifeMaximumValueExported(mob)

    var maxlife := 0;
    if(mob.isa(POLCLASS_NPC))
        var lifestat := CInt(npcdesccfg[mob.npctemplate].HITS);
        if(CInt(GetObjProperty(mob,VITALID_LIFE)))
            lifestat := CInt(GetObjProperty(mob,VITALID_LIFE));
        endif
        if(!lifestat)
            maxlife := GetAttribute(mob, ATTRIBUTEID_STRENGTH) * 100;
        else
            maxlife := lifestat * 100;
        endif
        maxlife := maxlife + (GetStrengthMod(mob) * 100);
    else
        maxlife := GetAttribute(mob, ATTRIBUTEID_STRENGTH) * 100;
        maxlife := maxlife + (CInt(GetEffectiveSkill(mob,SKILLID_ANATOMY) / 20) * 100);
        maxlife := maxlife + (GetTempModAmount(mob,MOD_LIFE) * 100);
        if(maxlife > MAX_VITAL_VALUE * 100 and !mob.cmdlevel)
            maxlife := MAX_VITAL_VALUE * 100;
        endif
    endif

    if(maxlife)
        return maxlife;
    endif

endfunction

exported function GetStaminaRegenRateExported(mob)

    if(IsWearWolfMorphed(mob))
        return 1200 + (GetEffectiveSkill(mob, SKILLID_WEARWOLF) * 50);
    endif

    var rate := GetObjProperty(mob, CPROP_NAME_PREFIX_REGEN_RATE+VITALID_STAMINA);
    if( rate == error )
        rate := 1200;
    else
        rate := CInt(rate);
    endif

    if(GetEquipmentByLayer(mob, 25))
        rate := rate * 2;
    endif

    return rate;

endfunction

exported function GetStaminaMaximumValueExported(mob)

    var maxstam;
    if(mob.isa(POLCLASS_NPC))
        var stamstat := CInt(npcdesccfg[mob.npctemplate].STAM);
        if(CInt(GetObjProperty(mob,VITALID_STAMINA)))
            stamstat := CInt(GetObjProperty(mob,VITALID_STAMINA));
        endif
        if(!stamstat)
            maxstam := GetAttribute(mob, ATTRIBUTEID_DEXTERITY) * 100;
        else
            maxstam  := stamstat * 100;
        endif
        maxstam := maxstam + (GetDexterityMod(mob) * 100);
    else
        maxstam := GetAttribute(mob, ATTRIBUTEID_DEXTERITY) * 100;
        maxstam := maxstam + (GetTempModAmount(mob,MOD_STAMINA) * 100);
        if(maxstam > MAX_VITAL_VALUE * 100 and !mob.cmdlevel)
            maxstam := MAX_VITAL_VALUE * 100;
        endif
    endif

    if(maxstam)
        return maxstam;
    endif

endfunction

exported function GetManaRegenRateExported(mob)

    var rate := GetObjProperty(mob, CPROP_NAME_PREFIX_REGEN_RATE+VITALID_MANA);
    if( rate != error )
        return CInt(rate);
    endif

    return 1200 + (GetEffectiveSkill(mob, SKILLID_MEDITATION) * 25);

endfunction

exported function GetManaMaximumValueExported(mob)

    var maxmana := 0;
    if(mob.isa(POLCLASS_NPC))
        var manastat := CInt(npcdesccfg[mob.npctemplate].MANA);
        if(CInt(GetObjProperty(mob,VITALID_MANA)))
            manastat := CInt(GetObjProperty(mob,VITALID_MANA));
        endif
        if(!manastat)
            maxmana := GetAttribute(mob, ATTRIBUTEID_INTELLIGENCE) * 100;
        else
            maxmana  := manastat * 100;
        endif
        maxmana := maxmana + (GetIntelligenceMod(mob) * 100);
    else
        maxmana := GetAttribute(mob, ATTRIBUTEID_INTELLIGENCE) * 100;
        maxmana := maxmana + (CInt(GetEffectiveSkill(mob, SKILLID_EVALINT) / 20) * 100);
        maxmana := maxmana + (GetTempModAmount(mob, MOD_MANA) * 100);
        if(maxmana > MAX_VITAL_VALUE * 100 and !mob.cmdlevel)
            maxmana := MAX_VITAL_VALUE * 100;
        endif
    endif

    if(maxmana)
        return maxmana;
    endif

endfunction
none of them ever use "use npc;" anywhere, no dependencies of the script have that line, yet the error is strikingly awkward.

Now, I am more than willing to update my POL to 97, first of all, because of the fact how ****tty POL 96.7 runs on FreeBSD (I think I don't have to mention the fact that multithreading is broken, when not multithreaded it takes up 100% CPU unless I set inactivitytimeout to 10 which gives an insane lag ingame), so my only hopes lie in POL97

If I had missed something trivial in my research to update my POL, please, do not kill me. I have been a member of the POL family for many, many years.. ;)
Luth
Former Developer
Posts: 200
Joined: Mon Jan 30, 2006 8:10 am

Re: Regen.ecl not finding module npc

Post by Luth »

Could it be that one of your includes (tempmods or wearwolf) is using functions from NPC.EM and not use-ing it in the .inc file?
goqsane
Neophyte Poster
Posts: 38
Joined: Mon Sep 29, 2008 2:25 am

Re: Regen.ecl not finding module npc

Post by goqsane »

but then it wouldn't compile, or would it?

adding use npc; to the .inc files didn't help in any case
Luth
Former Developer
Posts: 200
Joined: Mon Jan 30, 2006 8:10 am

Re: Regen.ecl not finding module npc

Post by Luth »

"Export Script pkg/foundations/hooks/regen.ecl not found"

I would try three things:
1) show me your .cfg file, just for kicks
2) use the cleanup menu to delete all .ecl and .dep files, and recompile everything. Make sure that script is being compiled w/o errors, and is in the right location,
3) save a backup of the script, replace all functions bodies with "return 100;" and remove the using/include lines, recompile, try again.

Its a bit of a shotgun approach, but I don't know what the problem is to be able to fix it off hand. >_<
goqsane
Neophyte Poster
Posts: 38
Joined: Mon Sep 29, 2008 2:25 am

Re: Regen.ecl not finding module npc

Post by goqsane »

Code: Select all

Vital Life
{
    RegenWhileDead              0
    Alias                       Hits
    RegenRateFunction           regen:GetLifeRegenRateExported
    MaximumFunction             regen:GetLifeMaximumValueExported
}

Vital Mana
{
    RegenWhileDead              0
    RegenRateFunction           regen:GetManaRegenRateExported
    MaximumFunction             regen:GetManaMaximumValueExported
}

Vital Stamina
{
    RegenWhileDead              0
    Alias                       Stam
    RegenRateFunction           regen:GetStaminaRegenRateExported
    MaximumFunction             regen:GetStaminaMaximumValueExported
}
and attributes.cfg

Code: Select all

////////////////////////////////////////////////////////////////////////////////////
//
//    ATTRIBUTES.CFG:     Attributes Definitions
//
//    The following can be defined for an Attribute:
//
//    Attribute <attribute Name>
//    {
//        Alias    <alias>        The alias for this attribute.
//                    Can have multiple instance of this one
//    }
//
//    If you define additional aliases, you will want to add them to attributes.inc
//    both as a const and in the function GetSkillIDByAttributeID.
////////////////////////////////////////////////////////////////////////////////////

Attribute Strength
{
    Alias       STR
}

Attribute Intelligence
{
    Alias       INT
}

Attribute Dexterity
{
    Alias       DEX
}

Attribute Alchemy
{
}

Attribute Anatomy
{
}

Attribute AnimalLore
{
}

Attribute ItemId
{
}

Attribute ArmsLore
{
}

Attribute Parry
{
}

Attribute Begging
{
}

Attribute Blacksmithy
{
}

Attribute Bowcraft
{
}

Attribute Peacemaking
{
}

Attribute Camping
{
}

Attribute Carpentry
{
}

Attribute Cartography
{
}

Attribute Cooking
{
}

Attribute DetectingHidden
{
    Alias       DetectHidden
}

Attribute Enticement
{
}

Attribute EvaluatingIntelligence
{
    Alias       EvaluatingInt
    Alias       EvalInt
}

Attribute Healing
{
}

Attribute Fishing
{
}

Attribute ForensicEvaluation
{
    Alias       ForensicEval
    Alias       Forensics
}

Attribute Herding
{
}

Attribute Hiding
{
}

Attribute Provocation
{
}

Attribute Inscription
{
}

Attribute Lockpicking
{
}

Attribute Magery
{
}

Attribute MagicResistance
{
    Alias       MagicResist
    Alias       ResistingSpells
    Alias       Resist
}

Attribute Tactics
{
}

Attribute Snooping
{
}

Attribute Musicianship
{
}

Attribute Poisoning
{
}

Attribute Archery
{
}

Attribute SpiritSpeak
{
}

Attribute Stealing
{
}

Attribute Tailoring
{
}

Attribute AnimalTaming
{
}

Attribute TasteIdentification
{
    Alias       TasteIdent
}

Attribute Tinkering
{
}

Attribute Tracking
{
}

Attribute Veterinary
{
}

Attribute Swordsmanship
{
    Alias       Swords
}

Attribute Macefighting
{
    Alias       Mace
}

Attribute Fencing
{
}

Attribute Wrestling
{
}

Attribute Lumberjacking
{
}

Attribute Mining
{
}

Attribute Meditation
{
}

Attribute Stealth
{
}

Attribute RemoveTrap
{
}

Attribute Magicitemmaking
{
}

Attribute Painting
{
}

Attribute Weaving
{
}

Attribute Wearwolf
{
}

Attribute Vampire
{
}

Attribute Axefighting
{
    Alias       Axes
}

Attribute Berzerker
{
}
I've recompiled everything and it still doesn't work.. this is very odd isn't it?
Luth
Former Developer
Posts: 200
Joined: Mon Jan 30, 2006 8:10 am

Re: Regen.ecl not finding module npc

Post by Luth »

Quite odd. Did you try #3, replacing the function bodies with "return 100;", removing the using/includes, and trying again?
goqsane
Neophyte Poster
Posts: 38
Joined: Mon Sep 29, 2008 2:25 am

Re: Regen.ecl not finding module npc

Post by goqsane »

I replaced everything to return 1200 and now I get this error, I'm thinking there must be something wrong with exported functions in general, take a look

Code: Select all

WARNING: pkg/foundations/hooks/shilSkill.ecl: Unable to find module npc
WARNING: pkg/foundations/hooks/newCombat.ecl: Unable to find module npc
WARNING: pkg/foundations/hooks/newParry.ecl: Unable to find module npc
WARNING: pkg/foundations/hooks/pushhook.ecl: Unable to find module npc
Hooking Login Packets...
WARNING: pkg/megacliloc/toolTips.ecl: Unable to find module npc
Error reading configuration file pkg/megacliloc/uopacket.cfg:
        Export Script pkg/megacliloc/toolTips.ecl not found
        Element: Packet 0xD6, found on line 1
Server Shutdown: loading packet hooks
User avatar
CWO
POL Expert
Posts: 1159
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Re: Regen.ecl not finding module npc

Post by CWO »

Something has got to be doing "use npc;" somewhere....
goqsane
Neophyte Poster
Posts: 38
Joined: Mon Sep 29, 2008 2:25 am

Re: Regen.ecl not finding module npc

Post by goqsane »

none of my .inc files have that line :(
Luth
Former Developer
Posts: 200
Joined: Mon Jan 30, 2006 8:10 am

Re: Regen.ecl not finding module npc

Post by Luth »

It sounds to me like you have old .ecl files lurking around. That's caught me a couple times.
Pierce
Forum Regular
Posts: 420
Joined: Thu Feb 02, 2006 8:33 am

Re: Regen.ecl not finding module npc

Post by Pierce »

For me it sounds that you have a directory error, like Luth thought before:
and is in the right location,
What does the folder/directory tree look like for that packet hook? All directories and subs?
goqsane
Neophyte Poster
Posts: 38
Joined: Mon Sep 29, 2008 2:25 am

Re: Regen.ecl not finding module npc

Post by goqsane »

The directories are fine, every file is present in the directory supplied, unfortunately.
User avatar
CWO
POL Expert
Posts: 1159
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Re: Regen.ecl not finding module npc

Post by CWO »

Still kinda weird that its trying to use NPC... It does seem to be finding the files ok in the error, the only reason its not found is because of course POL refuses to load them due to it thinking they're trying to use npc.em... Just as a really stupid check which I don't think will result in any findings, look in your .em files for use npc;... I know its stupid and ecompile will probably never use it like that (it does load constants from those files though so it may load more) but we can take a few shots in the dark and see if we hit something... Also, if you solved the problem in regen by removing all of the code, start by trying to put some of that code back in and seeing if you can find exactly what it is that you put in that triggers this.
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Regen.ecl not finding module npc

Post by Yukiko »

Let me ask you a couple things:

First when you upgraded the Core files to POL 0.97 did you first remove all old POL 0.96 Core files such as the ecompile.exe and modules directory etc.?

Second, you said that all scripts compiled but the error states that regen.ecl wasn't found. Did you visually check to verify that regen.ecl is missing or present?

Third the first line in the error states "WARNING: pkg/foundations/hooks/regen.ecl: Unable to find module npc". Is that module present in your \scripts\modules directory?
qrak
Grandmaster Poster
Posts: 198
Joined: Sun Feb 05, 2006 4:35 pm
Location: Poland

Re: Regen.ecl not finding module npc

Post by qrak »

had similar problem long time ago, check this out http://forums.polserver.com/viewtopic.p ... +NPC#p5694
Nando
POL Developer
Posts: 282
Joined: Wed Sep 17, 2008 6:53 pm
Contact:

Re: Regen.ecl not finding module npc

Post by Nando »

Goqsane, you should post your solution here. It's common netiquette to post when you find solutions, so others can easily find it if they have the same problem.
goqsane
Neophyte Poster
Posts: 38
Joined: Mon Sep 29, 2008 2:25 am

Re: Regen.ecl not finding module npc

Post by goqsane »

I don't have a solution, I had to remake 1291 scripts by hand to find out that the "POL module uptader" is responsible for this error. Anyway, I will never understand you distro devs complicating our lives SO MUCH with those changes for 97, now I realize some of my scripts don't work, just because I didn't include some modules (usually npc), so now I have to browse through them. Really, I think it's stupid to establish 'new standards' every couple of versions of POL but anyway, I don't want to rant here. Just don't use POL MODULE UDPATER because it doesn't help
Luth
Former Developer
Posts: 200
Joined: Mon Jan 30, 2006 8:10 am

Re: Regen.ecl not finding module npc

Post by Luth »

Well if you can figure out what part wasnt recognizing the use of npc, then we can find and publish a fix for the program. Thats why its ini driven, so its easily updatable and fixable. :)
goqsane
Neophyte Poster
Posts: 38
Joined: Mon Sep 29, 2008 2:25 am

Re: Regen.ecl not finding module npc

Post by goqsane »

Luth, actually, I didn't use POL Module Updater, that's the thing - it just adds way too many modules when you use it.
Luth
Former Developer
Posts: 200
Joined: Mon Jan 30, 2006 8:10 am

Re: Regen.ecl not finding module npc

Post by Luth »

I find it unlikely that "too many modules" caused this, or any problem. Even if you 'use npc;' but don't actually call any npc.em functions, it wont cause a problem UNLESS you actually do not have an npc.em module. If that's the case, then you have other problems aside from the module updater. ;)
Turley
POL Developer
Posts: 670
Joined: Sun Feb 05, 2006 4:45 am

Re: Regen.ecl not finding module npc

Post by Turley »

Not true Luth :)
If i put a use npc; in my regen.src it compiles but the server aborts with the same error msg.
"use npc;" can cause problems regardless if you use functions in it or not.
Luth
Former Developer
Posts: 200
Joined: Mon Jan 30, 2006 8:10 am

Re: Regen.ecl not finding module npc

Post by Luth »

I just threw "use npc;" into a half-dozen scripts that're unrelated to npcs, including regen, oncreate, vitalInit, and ::start. I was able to compile them without problem, and the server started and ran without error.

Using a module should not cause problems, and I would be inclined to say that otherwise is a bug, and should therefore be addressed.
Turley
POL Developer
Posts: 670
Joined: Sun Feb 05, 2006 4:45 am

Re: Regen.ecl not finding module npc

Post by Turley »

I did some research:
If you have somewhere a non used function thats uses a npc.em function and you dont have a "use npc;" no problem, but if you have a "use npc;" the executor throws the error.

Simple example:

Code: Select all

program regen()
return(1);
endprogram

Exported Function GetLifeMaximumValue(mobile)
  return(100);
EndFunction

Function blubb() // Not used
 var m:=Self();
EndFunction
this causes no problem, but if you write an "use npc;" the executor throws the error. The same error comes if you have for example a "char.setwarmode(1);" somewhere, because the executor thinks the module function SetWarMode() is used.

But in all my tests i never had an error when no "use npc;" is used. So goqsane there must be somewhere a "use npc;"
Luth
Former Developer
Posts: 200
Joined: Mon Jan 30, 2006 8:10 am

Re: Regen.ecl not finding module npc

Post by Luth »

So you're saying that if you have an unused function that uses a module-function from npc.em but do not "use npc", it compiles and runs, but if you "use npc" then it throws an error?
Turley
POL Developer
Posts: 670
Joined: Sun Feb 05, 2006 4:45 am

Re: Regen.ecl not finding module npc

Post by Turley »

Yes.
Post Reply