It is currently Tue Dec 02, 2008 6:01 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Problem with Regen.src
PostPosted: Sun Sep 30, 2007 2:17 am 
Offline

Joined: Sun Sep 30, 2007 1:00 am
Posts: 4
Hey,

I've been trying to compile regen.src, found in /pkg/character/regen.src. The following error comes up when I try:

Expected an identifier, got User Function GetStaminaRegenRate instead.
Near: exported function GetStaminaRegenRate(character)
File: C:\EquinoxUO\pkg\character\regen.src, Line 77
Error reading function.
Compilation failed.
Execution aborted due to: Error compiling file

Thing is, I've looked over the whole script and I cannot find anything wrong. It's probably just an oversight on my part, but if anyone has any insight it would be much appreciated.

Thanks :D

The problematic script:
Code:
use uo;

include "include/dotempmods";

program regen()
   return 1;
endprogram

exported function GetLifeRegenRate (character)
   // 1 point per 5 seconds
   // ... is 12 points per minute
   // ... is 1200 hundredths per minute

   //No regen if poisoned
   if (character.poisoned)
      return 0;
   endif

   //NPCs regenerate faster if they have more HP
   if (!character.acctname)
      if (GetAttributeBaseValue (character, "Strength") < 1500)
         return 1200;
      endif
      return (CINT (GetAttributeBaseValue (character, "Strength")/10) * 12);
   endif

   //If they're hungry, don't regenerate HP as fast or at all
   var hunger := CINT (GetObjProperty (character, "hunger"));
   if (!hunger)
      hunger := 0;
   endif

   if (hunger >= 9)
      return 0;
   elseif (hunger >= 7)
      return 600;
   elseif (hunger > 5)
      return 1000;
   endif
   return 1200;
endfunction

exported function GetLifeMaximumValue(character)
   //Do a stat cap on players
   if (character.acctname)
      if (!character.cmdlevel)
         var maxstr := GetObjProperty (character, "maxstr");
         if (!maxstr)
            maxstr := 75;
         endif
         if (GetAttributeBaseValue (character, "Strength") > maxstr * 10);
            SetAttributeBaseValue (character, "Strength", maxstr*10);
         endif
      endif      
   endif

   //possible bonus MaxHP from spell effects
   if (GetObjProperty (character, "longtermmods"))
      var bonusmaxhp := 0;
      var tempmods := GetObjProperty (character, "longtermmods");
      foreach submod in tempmods
         if (submod[1] == "BonusMaxHP" or submod[1] == "cBonusMaxHP")
            bonusmaxhp := bonusmaxhp + submod[2];
         endif
      endforeach
      if (bonusmaxhp)
         return (GetAttribute (character, "Strength") + bonusmaxhp) * 100;
      endif
   endif

    return GetAttribute (character, "Strength") * 100;

endfunction



exported function GetStaminaRegenRate(character)
   if (character.poisoned)
      return 100;
   endif
   
   //Ignore all this for NPCs
   if (!character.acctname)
      return 1200;
   endif

   //If they're hungry, don't regenerate stamina as fast or at all
   var hunger := CINT (GetObjProperty (character, "hunger"));
   if (!hunger)
      hunger := 0;
   endif
   
   if (hunger >= 9)
      return 100;
   elseif (hunger >= 7)
      return 600;
   endif
   
   //If the last thing they ate was a high food value item, they regenerate stamina faster
   var foodregen := GetObjProperty (character, "#dotempmod_stamina_regen_rate");
   if (!foodregen)
      return 1200;
   endif

   return foodregen;
endfunction



exported function GetStaminaMaximumValue(character)
   //Do a stat cap on players
   if (character.acctname)
      if (!character.cmdlevel)
         var maxdex := GetObjProperty (character, "maxdex");
         if (!maxdex)
            maxdex := 75;
         endif
         if (GetAttributeBaseValue (character, "Dexterity") > maxdex * 10);
            SetAttributeBaseValue (character, "Dexterity", maxdex*10);
         endif
      endif
   endif

   //possible bonus MaxStamina from spell effects
   if (GetObjProperty (character, "longtermmods"))
      var bonusmaxstam := 0;
      var tempmods := GetObjProperty (character, "longtermmods");
      foreach submod in tempmods
         if (submod[1] == "BonusMaxStam" or submod[1] == "cBonusMaxStam")
            bonusmaxstam := bonusmaxstam + submod[2];
         endif
      endforeach
      if (bonusmaxstam)
         return (GetAttribute (character, "Dexterity") + bonusmaxstam) * 100;
      endif
   endif

    return GetAttribute (character, "Dexterity") * 100;
endfunction


exported function GetManaRegenRate(character)
   //No regen if poisoned
   if (character.poisoned)
      return 0;
   endif
      
   //Ignore all this for NPCs
   if (!character.acctname)
      return 1200;
   endif

   //If they're hungry, don't regenerate mana as fast or at all
   var hunger := CINT (GetObjProperty (character, "hunger"));
   if (!hunger)
      hunger := 0;
   endif

   if (hunger >= 9)
      return 0;
   elseif (hunger >= 7)
      return 600;
   elseif (hunger > 5)
      return 1000;
   endif

   return 1200;
endfunction

exported function GetManaMaximumValue(character)
   //Do a stat cap on players
   if (character.acctname)
      if (!character.cmdlevel)
         var maxint := GetObjProperty (character, "maxint");
         if (!maxint)
            maxint := 75;
         endif
         if (GetAttributeBaseValue (character, "Intelligence") > maxint * 10);
            SetAttributeBaseValue (character, "Intelligence", maxint*10);
         endif
      endif
   endif

   //possible bonus MaxMana from spell effects
   if (GetObjProperty (character, "longtermmods"))
      var bonusmaxmana := 0;
      var tempmods := GetObjProperty (character, "longtermmods");
      foreach submod in tempmods
         if (submod[1] == "BonusMaxMana" or submod[1] == "cBonusMaxMana")
            bonusmaxmana := bonusmaxmana + submod[2];
         endif
      endforeach
      if (bonusmaxmana)
         return (GetAttribute (character, "Intelligence") + bonusmaxmana) * 100;
      endif
   endif

    return GetAttribute (character, "Intelligence") * 100;
endfunction



Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 30, 2007 3:15 am 
Offline
Certified POL Expert
User avatar

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 580
This looks like the World of Dreams regen.src.
Can you please print your vitals.cfg here.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 30, 2007 3:32 am 
Offline

Joined: Sun Sep 30, 2007 1:00 am
Posts: 4
Code:
Vital Life
{
   RegenWhileDead         0
   Alias            Hits
   RegenRateFunction      regen:GetLifeRegenRate
   MaximumFunction      regen:GetLifeMaximumValue
}

Vital Stamina
{
   RegenWhileDead         0
   Alias            Stam
   RegenRateFunction      regen:GetStaminaRegenRate
   MaximumFunction      regen:GetStaminaMaximumValue
}

Vital Mana
{
   RegenWhileDead         0
   RegenRateFunction      regen:GetManaRegenRate
   MaximumFunction      regen:GetManaMaximumValue
}


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 30, 2007 6:58 am 
Offline
Certified POL Expert
User avatar

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 580
Nothing appears wrong as far as I can tell from what you've posted.
I assume vitals.cfg is in the same directory as regen.src.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 30, 2007 1:25 pm 
Offline

Joined: Sun Sep 30, 2007 1:00 am
Posts: 4
Yup, it is the same directory.

I tried just deleting it, but that just made it worse :P


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 30, 2007 6:05 pm 
Offline

Joined: Sun Sep 30, 2007 1:00 am
Posts: 4
This has been fixed...

Seems the function was already declared in another include; not sure why. :?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 30, 2007 6:31 pm 
Offline
Certified POL Expert
User avatar

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 580
Yeah, I was going to suggest that but it's not often people define vitals functions more than once unless they are mixing together different distros and scriptsets.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 01, 2007 9:27 pm 
Offline
Certified POL Expert
User avatar

Joined: Thu Feb 02, 2006 1:41 pm
Posts: 1222
Location: Southern Central USA
Yes.
Remember that error.
It always means the same thing or atleast in my experience it does.

Gotta wonder about some of those error messages sometimes.

_________________
Sincerely,
Yukiko

I know you think you understand what you thought I said but what you heard is not exactly what I meant.

Titus 2:13


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 26, 2007 6:33 am 
Offline
User avatar

Joined: Fri Oct 26, 2007 5:29 am
Posts: 8
I too have some problems with the regen file..

Everytime it try to start up the server it says:

[list=]"Error loading script pkg/attributes/regen.ecl: Recompile required. Bad version number 8."[/list]

^^


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 26, 2007 11:29 am 
Offline
POL Developer
User avatar

Joined: Sun Feb 12, 2006 9:50 pm
Posts: 843
Location: Bowling Green, KY
The_Visitor wrote:
I too have some problems with the regen file..

Everytime it try to start up the server it says:

[list=]"Error loading script pkg/attributes/regen.ecl: Recompile required. Bad version number 8."[/list]

^^


Bad version means you need to recompile all your scripts.

_________________
POL Developer - The Penguin Scripter


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl