EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   undef (https://www.eqemulator.org/forums/showthread.php?t=29057)

eqwarrior 07-29-2009 04:23 AM

undef
 
How important is undef?

Just from other peoples examples, I've used

$variable = undef;

but now I'm seeing

undef $variable;

Is either ok? Which is the proper way? Do I use it for just qglobals or any my $variables? Is it important, such as freeing up memory? Sorry for the noob questions lol. Trying to optimize my quest files.

And would this be a possible cause of a zone taking up more RAM the longer zone is up?

-Thanks

trevius 07-29-2009 04:36 AM

Unless you were using a TON of variables, I don't think that would effect memory at all. You should really only need to undef them if you need to clear them out for some reason so they don't get used later on. Like, if you have an NPC do something and set a variable and you use that variable for an event or something for a particular player, you might not want that variable to be set the next time that event starts or the next time another player interacts with that NPC. You shouldn't really need to use undef on qglobals as long as you are using $qglobals{qglobalname} in your scripts and not just pulling qglobal information with variables named the same as your qglobal. You can check if a qglobal is not defined by doing a (!defined(qglobals{qglobalname})), and so on.

I am certainly no perl expert, so, I might be wrong, but that is my understanding of the answers to your questions.

eqwarrior 07-29-2009 08:20 AM

Maybe I'm doing globals wrong, with setglobal then my $variable = globalname; I'm trying to figure out why sometimes Anguish uses 1 gig ram after 12 hours of raiding etc. Been google searching for answers too.

eqwarrior 07-29-2009 08:41 AM

Here is example of quest in Anguish, maybe memory leak for not enough undef? Every one of the 17 Bosses have a similar script:

For Overlord_Mata_Muram:

Code:

#####################################################################

### NPC ID :  2700489

### NPC NAME: Overlord_Mata_Muram

### Anguish Boss: Level 17

#####################################################################



sub EVENT_SPAWN

{

  $BaseNumber = 3;                                ### Minimin number of times to pop NPCs waves

  $Additional = 0;                                ### and additional number for max pop NPCs waves

  $wavenum = int (rand($Additional)) + $BaseNumber + 1;  ###(3 to 3)                         

  $gap = 100;

  $gap /= int $wavenum;                            ### percentage of gap between spawns 

  $gap = int $gap;                                ### Remove Decimal Point

  $percent = int (rand($gap));                    ### Random number in that percentage 

  $nextwave = ($gap * $wavenum) - $percent;        ### percentage - (random percentage)

  quest::setnexthpevent("$nextwave");              ### set next wave                   

} # end EVENT_SPAWN


sub EVENT_HP 

{

  if($hpevent == "$nextwave") {                      ### when the current HP == setnexthpevent

      if($wavenum > 0) {                              ### If waves left > 0

        $wavenum -= 1;                              ### deincrement number (-1) of waves

        $percent = int (rand($gap));                ### Random number in that percentage   

        $nextwave = ($gap * $wavenum) - $percent;    ### percentage - (random percentage)

        quest::say("Help!");
        my $a = 2700505;                    ### ID of Add to spawn 2 (an_ikaav_Mastermind) 2.0 Trash

        my $x = $npc->GetX();                ### Get Trash mob X

        my $y = $npc->GetY();                ### Get Trash mob Y

        my $z = $npc->GetZ();                ### Get Trash mob Z

        my $h = $npc->GetHeading();          ### Get Trash mob H

        quest::spawn2($a,0,0,$x,$y,$z,$h);  ### Spawn Add
        quest::spawn2($a,0,0,$x,$y,$z,$h);  ### Spawn Add
        quest::spawn2($a,0,0,$x,$y,$z,$h);  ### Spawn Add
        quest::spawn2($a,0,0,$x,$y,$z,$h);  ### Spawn Add
        $npc->WipeHateList();
        if($nextwave >= 0) { 

            quest::setnexthpevent("$nextwave");

            } # end $nextwave >= 0

        else {                                      ### Last wave will have a negative number

            quest::setnexthpevent(0);

            } # end else

        } # end $wavenum > 0

      } # end $hpevent == $nextwave

  } # end EVENT_HP


sub EVENT_ATTACK
{
  my $anguish_boss_one = $entity_list->GetMobByNpcTypeID(2700469); # 1
  my $anguish_boss_two = $entity_list->GetMobByNpcTypeID(2700471); # 2
  my $anguish_boss_three = $entity_list->GetMobByNpcTypeID(2700468); # 3
  my $anguish_boss_four = $entity_list->GetMobByNpcTypeID(2700467); # 4
  my $anguish_boss_five = $entity_list->GetMobByNpcTypeID(2700464); # 5
  my $anguish_boss_six = $entity_list->GetMobByNpcTypeID(2700474); # 6
  my $anguish_boss_seven = $entity_list->GetMobByNpcTypeID(2700472); # 7
  my $anguish_boss_eight = $entity_list->GetMobByNpcTypeID(2700473); # 8
  my $anguish_boss_nine = $entity_list->GetMobByNpcTypeID(2700470); # 9
  my $anguish_boss_ten = $entity_list->GetMobByNpcTypeID(2700463); # 10
  my $anguish_boss_eleven = $entity_list->GetMobByNpcTypeID(2700466); # 11
  my $anguish_boss_twelve = $entity_list->GetMobByNpcTypeID(2700465); # 12
  my $anguish_boss_thirteen = $entity_list->GetMobByNpcTypeID(2700462); # 13
  my $anguish_boss_fourteen = $entity_list->GetMobByNpcTypeID(2700461); # 14
  my $anguish_boss_fifteen = $entity_list->GetMobByNpcTypeID(2700460); # 15
  my $anguish_boss_sixteen = $entity_list->GetMobByNpcTypeID(2700488); # 16


  if ($anguish_boss_one) { # 1
    my $hate_anguish_boss_one = $anguish_boss_one->CastToNPC();
    $hate_anguish_boss_one->AddToHateList($client, 1); }

  if ($anguish_boss_two) { # 2
    my $hate_anguish_boss_two = $anguish_boss_two->CastToNPC();
    $hate_anguish_boss_two->AddToHateList($client, 1); }

  if ($anguish_boss_three) { # 3
    my $hate_anguish_boss_three = $anguish_boss_three->CastToNPC();
    $hate_anguish_boss_three->AddToHateList($client, 1); }

  if ($anguish_boss_four) { # 4
    my $hate_anguish_boss_four = $anguish_boss_four->CastToNPC();
    $hate_anguish_boss_four->AddToHateList($client, 1); }

  if ($anguish_boss_five) { # 5
    my $hate_anguish_boss_five = $anguish_boss_five->CastToNPC();
    $hate_anguish_boss_five->AddToHateList($client, 1); }

  if ($anguish_boss_six) { # 6
    my $hate_anguish_boss_six = $anguish_boss_six->CastToNPC();
    $hate_anguish_boss_six->AddToHateList($client, 1); }
   
  if ($anguish_boss_seven) { # 7
    my $hate_anguish_boss_seven = $anguish_boss_seven->CastToNPC();
    $hate_anguish_boss_seven->AddToHateList($client, 1); }

  if ($anguish_boss_eight) { # 8
    my $hate_anguish_boss_eight = $anguish_boss_eight->CastToNPC();
    $hate_anguish_boss_eight->AddToHateList($client, 1); }

  if ($anguish_boss_nine) { # 9
    my $hate_anguish_boss_nine = $anguish_boss_nine->CastToNPC();
    $hate_anguish_boss_nine->AddToHateList($client, 1); }

  if ($anguish_boss_ten) { # 10
    my $hate_anguish_boss_ten = $anguish_boss_ten->CastToNPC();
    $hate_anguish_boss_ten->AddToHateList($client, 1); }

  if ($anguish_boss_eleven) { # 11
    my $hate_anguish_boss_eleven = $anguish_boss_eleven->CastToNPC();
    $hate_anguish_boss_eleven->AddToHateList($client, 1); }

  if ($anguish_boss_twelve) { # 12
    my $hate_anguish_boss_twelve = $anguish_boss_twelve->CastToNPC();
    $hate_anguish_boss_twelve->AddToHateList($client, 1); }

  if ($anguish_boss_thirteen) { # 13
    my $hate_anguish_boss_thirteen = $anguish_boss_thirteen->CastToNPC();
    $hate_anguish_boss_thirteen->AddToHateList($client, 1); }

  if ($anguish_boss_fourteen) { # 14
    my $hate_anguish_boss_fourteen = $anguish_boss_fourteen->CastToNPC();
    $hate_anguish_boss_fourteen->AddToHateList($client, 1); }

  if ($anguish_boss_fifteen) { # 15
    my $hate_anguish_boss_fifteen = $anguish_boss_fifteen->CastToNPC();
    $hate_anguish_boss_fifteen->AddToHateList($client, 1); }

  if ($anguish_boss_sixteen) { # 16
    my $hate_anguish_boss_sixteen = $anguish_boss_sixteen->CastToNPC();
    $hate_anguish_boss_sixteen->AddToHateList($client, 1); }

} # End EVENT_ATTACK


sub EVENT_DEATH {

  quest::spawn2(2700493,0,0,504,4921,296,0);  ### Spawn Chest
  quest::spawn2(2700520,0,0,512,5012,297,0);  ### Spawn Chest
  quest::spawn2(2700521,0,0,543,4967,298,0);  ### Spawn Chest
  quest::spawn2(2700522,0,0,468,4971,299,0);  ### Spawn Chest
  quest::spawn2(2700523,0,0,505,4972,300,0);  ### Spawn Chest

  my $npc_name = $npc->GetCleanName();
  $datetime = localtime();

  quest::write("Anguish_Boss_Kills.txt","$datetime -- $name killed Level 17 $npc_name.");
  quest::setglobal("killed_overlord_mata_muram","$datetime","7","F");

  $datetime=undef;
  $killed_overlord_mata_muram=undef;



} # End EVENT_DEATH

And here is one from a Trash Mob:


Code:

#####################################################################

### NPC ID : 

### NPC NAME:

### Anguish Trash 1.0

#####################################################################



sub EVENT_SPAWN {

}

sub EVENT_AGGRO {

my $Phrase1 = "For Mata Muram! Now you die!";

my $Phrase2 = "I shall rid Anguish of another infamous villain.";

my $Phrase3 = "Your foul deeds have earned my contempt.";

my $Phrase4 = "${class}s like you are better left dead than alive.";

my $Phrase5 = "It's ${races}s like you who have ruined your own lands, You'll not Anguish!";

my $Phrase6 = "Heathen! Unbeliever! Anguish must be cleansed!";

my $Phrase7 = "Your beliefs are an insult to us all!";

my $Phrase8 = "Your actions force me to kill you.";

my $Phrase9 = "Your intolerable reputation insults all in Anguish.";

my $Phrase10 = "It's time for you to take your blasphemy into the next realm.";

my $Phrase11 = "${race}s like you are better left dead than alive.";
my $Phrase12 = "No loots for you! Go away!";

my $Phrase = quest::ChooseRandom($Phrase1,$Phrase2,$Phrase3,$Phrase4,$Phrase5,$Phrase6,$Phrase7,$Phrase8,$Phrase9,$Phrase10,$Phrase11,$Phrase12);

quest::say("$Phrase");

}

sub EVENT_ATTACK {
}



sub EVENT_HP {

}



sub EVENT_DEATH {

$random_one = int (rand(100));                ### random_one 100 for a 3% chance
if($random_one > 96) {                        ### 3% chance spawn on death
  my $x = $npc->GetX();

  my $y = $npc->GetY();

  my $z = $npc->GetZ();

  $random_two = int (rand(100));            ### random_two 100 for 1%, 33%, and 66% chances
  if($random_two > 33) {                    ### 66% chance spawn Chest 2700496

      quest::spawn2(2700496,0,0,$x,$y,$z,0);  ### Spawn Chest 2700496
      quest::say("Don't touch my treasures!");
      } # end if random_two
  elsif ($random_two < 1) {                  ### 1% chance spawn Rare Chest 2700491
      quest::spawn2(2700491,0,0,$x,$y,$z,0);  ### Spawn Rare Chest 2700491
      quest::say("You found my rare loot! Don't steal it!");
      } # end elsif random_two
  else {                                    ### else 33% chance spawn Named
      my $namednpc = quest::ChooseRandom(2700507,  # Shalvo
                                        2700508,  # Ofanso
                                        2700509,  # Novara
                                        2700510,  # Jansio
                                        2700511,  # Arisisi
                                        2700512,  # Laveng
                                        2700513,  # Vonaasha
                                        2700514,  # Yhinra
                                        2700515); # Uchti
      quest::spawn2($namednpc,0,0,$x,$y,$z+5,0);  ### Spawn named npc (5 higher Z)
      quest::say("My friend will avenge my death!");
      } # end else random_two
  } # end if random_one
} # End EVENT_DEATH


Let me know if you see anything wrong. Thanks.

AndMetal 07-29-2009 06:54 PM

Unless you need other scripts to be able to access your variables, you should consider using my for all of your defined variables. This will cause them to be erased from memory once the script is done running (read: mob is dead).

You may actually need to declare them out of the subs so that you can access them throughout the script, but it doesn't bleed over into other scripts (potentially leaking memory). Example:

Code:

#####################################################################

### NPC ID :  2700489

### NPC NAME: Overlord_Mata_Muram

### Anguish Boss: Level 17

#####################################################################

my($BaseNumber, $Additional, $wavenum, $gap, $percent, $nextwave); #from EVENT_SPAWN

sub EVENT_SPAWN

{

  $BaseNumber = 3;                                ### Minimin number of times to pop NPCs waves

  $Additional = 0;                                ### and additional number for max pop NPCs waves

  $wavenum = int (rand($Additional)) + $BaseNumber + 1;  ###(3 to 3)                         

  $gap = 100;

  $gap /= int $wavenum;                            ### percentage of gap between spawns 

  $gap = int $gap;                                ### Remove Decimal Point

  $percent = int (rand($gap));                    ### Random number in that percentage 

  $nextwave = ($gap * $wavenum) - $percent;        ### percentage - (random percentage)

  quest::setnexthpevent("$nextwave");              ### set next wave                   

} # end EVENT_SPAWN


sub EVENT_HP 

{

  if($hpevent == "$nextwave") {                      ### when the current HP == setnexthpevent

      if($wavenum > 0) {                              ### If waves left > 0

        $wavenum -= 1;                              ### deincrement number (-1) of waves

        $percent = int (rand($gap));                ### Random number in that percentage   

        $nextwave = ($gap * $wavenum) - $percent;    ### percentage - (random percentage)

        quest::say("Help!");
        my $a = 2700505;                    ### ID of Add to spawn 2 (an_ikaav_Mastermind) 2.0 Trash

        my $x = $npc->GetX();                ### Get Trash mob X

        my $y = $npc->GetY();                ### Get Trash mob Y

        my $z = $npc->GetZ();                ### Get Trash mob Z

        my $h = $npc->GetHeading();          ### Get Trash mob H

        quest::spawn2($a,0,0,$x,$y,$z,$h);  ### Spawn Add
        quest::spawn2($a,0,0,$x,$y,$z,$h);  ### Spawn Add
        quest::spawn2($a,0,0,$x,$y,$z,$h);  ### Spawn Add
        quest::spawn2($a,0,0,$x,$y,$z,$h);  ### Spawn Add
        $npc->WipeHateList();
        if($nextwave >= 0) { 

            quest::setnexthpevent("$nextwave");

            } # end $nextwave >= 0

        else {                                      ### Last wave will have a negative number

            quest::setnexthpevent(0);

            } # end else

        } # end $wavenum > 0

      } # end $hpevent == $nextwave

  } # end EVENT_HP


sub EVENT_ATTACK
{
  my $anguish_boss_one = $entity_list->GetMobByNpcTypeID(2700469); # 1
  my $anguish_boss_two = $entity_list->GetMobByNpcTypeID(2700471); # 2
  my $anguish_boss_three = $entity_list->GetMobByNpcTypeID(2700468); # 3
  my $anguish_boss_four = $entity_list->GetMobByNpcTypeID(2700467); # 4
  my $anguish_boss_five = $entity_list->GetMobByNpcTypeID(2700464); # 5
  my $anguish_boss_six = $entity_list->GetMobByNpcTypeID(2700474); # 6
  my $anguish_boss_seven = $entity_list->GetMobByNpcTypeID(2700472); # 7
  my $anguish_boss_eight = $entity_list->GetMobByNpcTypeID(2700473); # 8
  my $anguish_boss_nine = $entity_list->GetMobByNpcTypeID(2700470); # 9
  my $anguish_boss_ten = $entity_list->GetMobByNpcTypeID(2700463); # 10
  my $anguish_boss_eleven = $entity_list->GetMobByNpcTypeID(2700466); # 11
  my $anguish_boss_twelve = $entity_list->GetMobByNpcTypeID(2700465); # 12
  my $anguish_boss_thirteen = $entity_list->GetMobByNpcTypeID(2700462); # 13
  my $anguish_boss_fourteen = $entity_list->GetMobByNpcTypeID(2700461); # 14
  my $anguish_boss_fifteen = $entity_list->GetMobByNpcTypeID(2700460); # 15
  my $anguish_boss_sixteen = $entity_list->GetMobByNpcTypeID(2700488); # 16


  if ($anguish_boss_one) { # 1
    my $hate_anguish_boss_one = $anguish_boss_one->CastToNPC();
    $hate_anguish_boss_one->AddToHateList($client, 1); }

  if ($anguish_boss_two) { # 2
    my $hate_anguish_boss_two = $anguish_boss_two->CastToNPC();
    $hate_anguish_boss_two->AddToHateList($client, 1); }

  if ($anguish_boss_three) { # 3
    my $hate_anguish_boss_three = $anguish_boss_three->CastToNPC();
    $hate_anguish_boss_three->AddToHateList($client, 1); }

  if ($anguish_boss_four) { # 4
    my $hate_anguish_boss_four = $anguish_boss_four->CastToNPC();
    $hate_anguish_boss_four->AddToHateList($client, 1); }

  if ($anguish_boss_five) { # 5
    my $hate_anguish_boss_five = $anguish_boss_five->CastToNPC();
    $hate_anguish_boss_five->AddToHateList($client, 1); }

  if ($anguish_boss_six) { # 6
    my $hate_anguish_boss_six = $anguish_boss_six->CastToNPC();
    $hate_anguish_boss_six->AddToHateList($client, 1); }
   
  if ($anguish_boss_seven) { # 7
    my $hate_anguish_boss_seven = $anguish_boss_seven->CastToNPC();
    $hate_anguish_boss_seven->AddToHateList($client, 1); }

  if ($anguish_boss_eight) { # 8
    my $hate_anguish_boss_eight = $anguish_boss_eight->CastToNPC();
    $hate_anguish_boss_eight->AddToHateList($client, 1); }

  if ($anguish_boss_nine) { # 9
    my $hate_anguish_boss_nine = $anguish_boss_nine->CastToNPC();
    $hate_anguish_boss_nine->AddToHateList($client, 1); }

  if ($anguish_boss_ten) { # 10
    my $hate_anguish_boss_ten = $anguish_boss_ten->CastToNPC();
    $hate_anguish_boss_ten->AddToHateList($client, 1); }

  if ($anguish_boss_eleven) { # 11
    my $hate_anguish_boss_eleven = $anguish_boss_eleven->CastToNPC();
    $hate_anguish_boss_eleven->AddToHateList($client, 1); }

  if ($anguish_boss_twelve) { # 12
    my $hate_anguish_boss_twelve = $anguish_boss_twelve->CastToNPC();
    $hate_anguish_boss_twelve->AddToHateList($client, 1); }

  if ($anguish_boss_thirteen) { # 13
    my $hate_anguish_boss_thirteen = $anguish_boss_thirteen->CastToNPC();
    $hate_anguish_boss_thirteen->AddToHateList($client, 1); }

  if ($anguish_boss_fourteen) { # 14
    my $hate_anguish_boss_fourteen = $anguish_boss_fourteen->CastToNPC();
    $hate_anguish_boss_fourteen->AddToHateList($client, 1); }

  if ($anguish_boss_fifteen) { # 15
    my $hate_anguish_boss_fifteen = $anguish_boss_fifteen->CastToNPC();
    $hate_anguish_boss_fifteen->AddToHateList($client, 1); }

  if ($anguish_boss_sixteen) { # 16
    my $hate_anguish_boss_sixteen = $anguish_boss_sixteen->CastToNPC();
    $hate_anguish_boss_sixteen->AddToHateList($client, 1); }

} # End EVENT_ATTACK


sub EVENT_DEATH {

  quest::spawn2(2700493,0,0,504,4921,296,0);  ### Spawn Chest
  quest::spawn2(2700520,0,0,512,5012,297,0);  ### Spawn Chest
  quest::spawn2(2700521,0,0,543,4967,298,0);  ### Spawn Chest
  quest::spawn2(2700522,0,0,468,4971,299,0);  ### Spawn Chest
  quest::spawn2(2700523,0,0,505,4972,300,0);  ### Spawn Chest

  my $npc_name = $npc->GetCleanName();
  my $datetime = localtime();

  quest::write("Anguish_Boss_Kills.txt","$datetime -- $name killed Level 17 $npc_name.");
  quest::setglobal("killed_overlord_mata_muram","$datetime","7","F");

  #$datetime=undef; #we don't need this
  #$killed_overlord_mata_muram=undef; #we don't need this either since we don't call $killed_overlord_mata_muram anywhere



} # End EVENT_DEATH

Code:

#####################################################################

### NPC ID : 

### NPC NAME:

### Anguish Trash 1.0

#####################################################################



sub EVENT_SPAWN {

}

sub EVENT_AGGRO {

my $Phrase1 = "For Mata Muram! Now you die!";

my $Phrase2 = "I shall rid Anguish of another infamous villain.";

my $Phrase3 = "Your foul deeds have earned my contempt.";

my $Phrase4 = "${class}s like you are better left dead than alive.";

my $Phrase5 = "It's ${races}s like you who have ruined your own lands, You'll not Anguish!";

my $Phrase6 = "Heathen! Unbeliever! Anguish must be cleansed!";

my $Phrase7 = "Your beliefs are an insult to us all!";

my $Phrase8 = "Your actions force me to kill you.";

my $Phrase9 = "Your intolerable reputation insults all in Anguish.";

my $Phrase10 = "It's time for you to take your blasphemy into the next realm.";

my $Phrase11 = "${race}s like you are better left dead than alive.";
my $Phrase12 = "No loots for you! Go away!";

my $Phrase = quest::ChooseRandom($Phrase1,$Phrase2,$Phrase3,$Phrase4,$Phrase5,$Phrase6,$Phrase7,$Phrase8,$Phrase9,$Phrase10,$Phrase11,$Phrase12);

quest::say("$Phrase");

}

sub EVENT_ATTACK {
}



sub EVENT_HP {

}



sub EVENT_DEATH {

my $random_one = int (rand(100));                ### random_one 100 for a 3% chance
if($random_one > 96) {                        ### 3% chance spawn on death
  my $x = $npc->GetX();

  my $y = $npc->GetY();

  my $z = $npc->GetZ();

  my $random_two = int (rand(100));            ### random_two 100 for 1%, 33%, and 66% chances
  if($random_two > 33) {                    ### 66% chance spawn Chest 2700496

      quest::spawn2(2700496,0,0,$x,$y,$z,0);  ### Spawn Chest 2700496
      quest::say("Don't touch my treasures!");
      } # end if random_two
  elsif ($random_two < 1) {                  ### 1% chance spawn Rare Chest 2700491
      quest::spawn2(2700491,0,0,$x,$y,$z,0);  ### Spawn Rare Chest 2700491
      quest::say("You found my rare loot! Don't steal it!");
      } # end elsif random_two
  else {                                    ### else 33% chance spawn Named
      my $namednpc = quest::ChooseRandom(2700507,  # Shalvo
                                        2700508,  # Ofanso
                                        2700509,  # Novara
                                        2700510,  # Jansio
                                        2700511,  # Arisisi
                                        2700512,  # Laveng
                                        2700513,  # Vonaasha
                                        2700514,  # Yhinra
                                        2700515); # Uchti
      quest::spawn2($namednpc,0,0,$x,$y,$z+5,0);  ### Spawn named npc (5 higher Z)
      quest::say("My friend will avenge my death!");
      } # end else random_two
  } # end if random_one
} # End EVENT_DEATH

Try that out and see if it helps.

On a somewhat unrelated note, you may want to consider changing the sub EVENT_ATTACK section for the Overlord to use arrays & for loops to make it simpler since you're doing the same thing for each of them (like maybe 8 lines total for n number of mobs?)

trevius 07-29-2009 07:50 PM

Yeah, other than the one qglobal you are setting, I don't see anywhere that you are pulling qglobal information in those scripts, just a bunch of variables. If you do ever need to pull qglobal values, just make sure to use the $qglobals{killed_overlord_mata_muram} way to do it instead of $killed_overlord_mata_muram. For example:

This is the correct way:

Code:

if (defined($qglobals{killed_overlord_mata_muram})) {
  if ($qglobals{killed_overlord_mata_muram} == 1) {
    #Do what you want here
  }
}

This is the incorrect way to pull a qglobal value:

Code:

if ($killed_overlord_mata_muram == 1) {
    #Do what you want here
}

Though the second way may work most of the time, it will definitely cause major issues in many different scenarios. The defined check I did for the correct way is not required, but I added that in there as an extra example.

Also, if you think the memory problem might be quest related, try enabling quest logging in your log.ini file and then check out your quest logs. If the quest log is getting flooded by errors, that could definitely cause some issues.

eqwarrior 07-30-2009 02:53 AM

Thanks very much!

I will try using "my" outside of the sub and see if that makes a difference.

I'll probably have to revamp a lot of quest I have to use qglobal the right way now.

I learned a bit how to do stuff the right way now. I appreciate the help.

Yes, I agree that the aggro can be compiled with arrays and for loops.

I got lots of quest to edit now heh. More than just Anguish, but Anguish was biggest problem so I'll start there.

eqwarrior 07-30-2009 03:13 AM

Also, how important is undef? Or does "my" take care of everything for removing variable from memory?

eqwarrior 07-30-2009 03:40 AM

Quote:

Originally Posted by eqwarrior (Post 175526)
Also, how important is undef? Or does "my" take care of everything for removing variable from memory?

Never mind, just saw the red text about undef, thanks much. Don't need it since I'm not calling a global. :)

eqwarrior 07-30-2009 04:54 AM

I just made the changes and test. First I cleared the respawn times table, and respawned the whole zone. Then I did a #reloadquest, then end process on the zone, then the (static) zone connected again 5 seconds later. I went in the zone and did a #repop many times, then #aggrozone and killed the whole zone. The Memory never went above 11 megs. Might be fixed, will have to wait until a guild raids it, cause it used to easy go over 1 gig of ram just for Anguish in one day. Might fix all my other custom quest in other zones if this works nicely. Appreciate your help.

eqwarrior 07-30-2009 09:22 PM

Users are raiding Anguish again, and the zone is already up to 250 megs of memory. I've already corrected the quest files and rebooted the server, so I don't know. Qvic is my 2nd biggest problem, but doesn't grow up to 1 gig ram like Anguish does. Sigh.

trevius 07-30-2009 10:24 PM

Have you tried enabling quest logging in your log.ini file?

Here is what I have my log.ini set to atm:

Code:

CHAT=on
CHAT__SAY=on
CHAT__EMOTE=off
CHAT__OOC=on
CHAT__GROUP=on
CHAT__GUILD=on

SPAWNS=off
SPAWNS__MAIN=off
SPAWNS__CONDITIONS=off
SPAWNS__LIMITS=off

AI=off
AI__ERROR=on
AI__WAYPOINTS=off
AI__BUFFS=off
AI__SPELLS=off

QUESTS=off
QUESTS__PATHING=off

SPELLS=off
SPELLS__LOAD=off
SPELLS__LOAD_ERR=off
SPELLS__CASTING_ERR=off
SPELLS__CASTING=off
SPELLS__EFFECT_VALUES=off
SPELLS__RESISTS=off
SPELLS__STACKING=off
SPELLS__BARDS=off
SPELLS__BUFFS=off
SPELLS__PROCS=off
SPELLS__MODIFIERS=off

FACTION=off

ZONE=off
ZONE__GROUND_SPAWNS=off
ZONE__INIT=on
ZONE__INIT_ERR=on
ZONE__WORLD=off
ZONE__WORLD_ERR=on
ZONE__WORLD_TRACE=off

TRADING=off
TRADING__ERROR=off
TRADING__CLIENT=off
TRADING__NPC=off
TRADING__HOLDER=off

INVENTORY=off
INVENTORY__ERROR=off
INVENTORY__SLOTS=off

TRADESKILLS=off
TRADESKILLS__IN=off
TRADESKILLS__OUT=off
TRADESKILLS__SQL=off
TRADESKILLS__TRACE=off

TRIBUTE=off
TRIBUTE__ERROR=off
TRIBUTE__IN=off
TRIBUTE__OUT=off

AA=off
AA__ERROR=off
AA__MESSAGE=off
AA__IN=off
AA__OUT=off


DOORS=off
DOORS__INFO=off

PETS=off
PETS__AGGRO=off

COMBAT=off
COMBAT__ATTACKS=off
COMBAT__TOHIT=off
COMBAT__MISSES=off
COMBAT__DAMAGE=off
COMBAT__HITS=off
COMBAT__RANGED=off
COMBAT__SPECIAL_ATTACKS=off
COMBAT__PROCS=off

GUILDS=off
GUILDS__ERROR=off
GUILDS__ACTIONS=off
GUILDS__DB=off
GUILDS__PERMISSIONS=off
GUILDS__REFRESH=off
GUILDS__IN_PACKETS=off
GUILDS__OUT_PACKETS=off
GUILDS__IN_PACKET_TRACE=off
GUILDS__OUT_PACKET_TRACE=off

CLIENT=off
CLIENT__ERROR=on
CLIENT__DUELING=off
CLIENT__SPELLS=off
CLIENT__NET_ERR=on
CLIENT__NET_IN_TRACE=off

SKILLS=off
SKILLS__GAIN=off

RULES=off
RULES__ERROR=on
RULES__CHANGE=on

NET=off
NET__WORLD=on
NET__OPCODES=on
NET__IDENTIFY=off
NET__IDENT_TRACE=off
NET__STRUCTS=off
NET__STRUCT_HEX=off
NET__ERROR=off
NET__DEBUG=off
NET__APP_TRACE=off
NET__APP_CREATE=off
NET__APP_CREATE_HEX=off
NET__NET_TRACE=off
NET__NET_COMBINE=off
NET__FRAGMENT=off
NET__FRAGMENT_HEX=off
NET__NET_CREATE=off
NET__NET_CREATE_HEX=off
NET__NET_ACKS=off
NET__RATES=off

DATABASE=off

COMMON=off
COMMON__ERROR=on
COMMON__THREADS=off

LAUNCHER=on
LAUNCHER__ERROR=on
LAUNCHER__INIT=on
LAUNCHER__STATUS=on
LAUNCHER__NET=on
LAUNCHER__WORLD=on

WORLD=off
WORLD__CONFIG=on
WORLD__INIT=on
WORLD__INIT_ERR=on
WORLD__CLIENT=off
WORLD__ZONE=on
WORLD__LS=on
WORLD__CLIENT_ERR=on
WORLD__ZONE_ERR=on
WORLD__LS_ERR=on
WORLD__SHUTDOWN=on
WORLD__CLIENTLIST=off
WORLD__CLIENTLIST_ERR=on
WORLD__ZONELIST=on
WORLD__ZONELIST_ERR=on
WORLD__CLIENT_TRACE=off
WORLD__ZONE_TRACE=off
WORLD__LS_TRACE=on
WORLD__CONSOLE=on
WORLD__HTTP=off
WORLD__HTTP_ERR=on
WORLD__PERL=off
WORLD__PERL_ERR=on
WORLD__EQW=on
WORLD__LAUNCH=on
WORLD__LAUNCH_ERR=on
WORLD__LAUNCH_TRACE=on

LOG_CATEGORY( MAIL )
LOG_TYPE( MAIL, INIT, ENABLED )
LOG_TYPE( MAIL, ERROR, ENABLED )
LOG_TYPE( MAIL, CLIENT, DISABLED )
LOG_TYPE( MAIL, TRACE, DISABLED )
LOG_TYPE( MAIL, PACKETS, DISABLED)

LOG_CATEGORY( CHANNELS )
LOG_TYPE( CHANNELS, INIT, ENABLED )
LOG_TYPE( CHANNELS, ERROR, ENABLED )
LOG_TYPE( CHANNELS, CLIENT, DISABLED )
LOG_TYPE( CHANNELS, TRACE, DISABLED )
LOG_TYPE( CHANNELS, PACKETS, DISABLED)

LOG_CATEGORY( UCS )
LOG_TYPE( UCS, INIT, ENABLED )
LOG_TYPE( UCS, ERROR, ENABLED )
LOG_TYPE( UCS, CLIENT, ENABLED )
LOG_TYPE( UCS, TRACE, ENABLED )
LOG_TYPE( UCS, PACKETS, DISABLED )

If you set "QUESTS=on", it might help to show if you have any quest issues that could be causing weird issues.

Other than that, a work-around for your problem might be to set the zone to do a daily reset using my Zone Reset Script posted in the custom quest section of the forums. Resetting the zone should clear out any RAM usage.

thepoetwarrior 07-31-2009 08:53 AM

I'll set the logs on, thanks much!

I was thinking last resort is rebooting Anguish with that quest we used when we were on windows. I still have it.

The raid is set up that trash and bosses are all 24 hour respawn, and they can't skip around since higher bosses will aggro a lower boss. So its basically a 24 hour raid. So I wouldn't want to reboot every two hours. Maybe every 12 or 24 hours.

Since I did the quest edits, and similar to qvic, our 2nd worst memory hog, after being up all night, Anguish is only taking up 507 megs, not over 1 gig, and Anguish is only taking up 87 megs, not 150-450 megs. So looks to be a bit better. Will check out the logs.

I appreciate the help.

-Hunter

eqwarrior 07-31-2009 09:06 AM

I'm seeing this come up in the logs for Anguish many many times:

"[Quest] Use of uninitialized value $qst2700501::races in concatenation (.) or string at quests/anguish/2700501.pl line 15."

refering this this line of quest code:

Code:

my $Phrase5 = "It's ${races}s like you who have ruined your own lands, You'll not Anguish!";
I don't even know why I put { } around races. Must have been a copy/paste from someone elses aggro code. Shouldn't it be just $races instead of ${race}s? Assuming thats why I'm getting an error.

Also, turning on quest logging to see what else shows up.

eqwarrior 07-31-2009 09:19 AM

Another thing I saw in the logs:

9845 [07.30. - 22:38:48] Path File ./Maps/anguish.path not found.

So I checked my /Maps/ dir and found a.. the *.map but no *.path, could that be a problem?


All times are GMT -4. The time now is 12:04 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.