Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #10  
Old 05-26-2008, 02:37 AM
Bulle
Hill Giant
 
Join Date: Jan 2008
Posts: 102
Default

I have made a few more tests with the following quest script. It is a bit long but it prints the variables at the start and end of the script :
Code:
my $LevelItemId = 1038; # Tattered Cloth Sandal
my $DefaultMaxLevel = 70;


sub EVENT_SAY
{ if(defined($maxxx_level))
  { print "maxxx_level($name) begin = $maxxx_level"; }
  else
  { print "maxxx_level($name) begin is not defined"; }
  
  if(defined($qglobals{maxxx_level}))
  { print "qglobals{maxxx_level}($name) begin = $qglobals{maxxx_level}"; }
  else
  { print "qglobals{maxxx_level}($name) begin is not defined"; }
  
  if(($text=~/65/i) && ($ulevel >= 70))
  { quest::say("Remember, DO NOT lose that trinket ! Welcome to level 65 !");
    quest::summonitem(1038);
    quest::level(65);
  }
  
  if($text=~/make me a newb/i)
  { quest::say("Arrr Arrr Arrr, my pleasure !");
    quest::level(1);
    quest::delglobal("maxxx_level"); undef($qglobals{maxxx_level});
  }
  if($text=~/make me level 73/i)
  { quest::say("OK, you're the boss after all *sigh*");
    quest::level(73);
    quest::setglobal("maxxx_level", 73, 5, "F"); $qglobals{maxxx_level} = 73;
  }
  if($text=~/make me level 75/i)
  { quest::say("OK, you're the boss after all *sigh*");
    quest::level(75);
    quest::setglobal("maxxx_level", 75, 5, "F"); $qglobals{maxxx_level} = 75;
  }

  if(defined($maxxx_level))
  { print "maxxx_level($name) end = $maxxx_level"; }
  else
  { print "maxxx_level($name) end is not defined"; }
  
  if(defined($qglobals{maxxx_level}))
  { print "qglobals{maxxx_level}($name) end = $qglobals{maxxx_level}"; }
  else
  { print "qglobals{maxxx_level}($name) end is not defined"; }
}


sub EVENT_ITEM
{ if(defined($maxxx_level))
  { print "maxxx_level($name) begin = $maxxx_level"; }
  else
  { print "maxxx_level($name) begin is not defined"; }
  
  if(defined($qglobals{maxxx_level}))
  { print "qglobals{maxxx_level}($name) begin = $qglobals{maxxx_level}"; }
  else
  { print "qglobals{maxxx_level}($name) begin is not defined"; }
  
  if(plugin::check_handin(\%itemcount, $LevelItemId => 1))
  { if(defined($qglobals{maxxx_level}))
    { quest::say("Welcome back to level $qglobals{maxxx_level}, $name");
      quest::level($qglobals{maxxx_level});
    }
    else
    { quest::say("Welcome back to level $DefaultMaxLevel, $name");
      quest::level($DefaultMaxLevel);
    }
  }
  else
  { plugin::return_items(\%itemcount);
    quest::say("I have no use for this item, $name.  Take it back.");
  } 

  if(defined($maxxx_level))
  { print "maxxx_level($name) end = $maxxx_level"; }
  else
  { print "maxxx_level($name) end is not defined"; }
  
  if(defined($qglobals{maxxx_level}))
  { print "qglobals{maxxx_level}($name) end = $qglobals{maxxx_level}"; }
  else
  { print "qglobals{maxxx_level}($name) end is not defined"; }
}
I have removed some level choices for simplicity.

Currently quest::...global do not update the $qglobals map to keep it in sync with DB changes done in the script so you have to update $qglobals explicitly.

As it is the script works fine : it updates the DB globals with quest::...global, and at the same time updates the $qglobals map for consistency, to keep them in sync.
If you code this way you can even re-read the $qglobals in the same sub, and it is consistent with what has been entered in the DB. It could be a nice "coding rule" for script writing. Best would be if the Emu server did that synchronization in quest::...global itself, I will have to look into that.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 05:32 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3