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

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

Reply
 
Thread Tools Display Modes
  #1  
Old 04-03-2014, 02:51 PM
Trackye
Sarnak
 
Join Date: Feb 2008
Posts: 87
Default Help with this script please?

To start :P the script works fine in terms of it accomplishes what it is supposed to.

The problem is that the script completely ignores the level check for the player.

I would like it to be so that the script will not work and hand back the items if the player is NOT exactly level 65.

Checking the script with a command line prompt using perl it goes through without problem.
I just came back to scripting for eqemu and am sure I am missing something simple so would anyone please allow me to feel very stupid and point out what im missing lol

Code:
sub EVENT_SAY{

my $saylink1 = quest::saylink("Experienced");

if ($text =~/Hail/i){
$client->Message(315, "Greetings $class, I have been waiting for someone [$saylink1] such as yourself");
 }
	  if ($text=~ /Experienced/i) {
    $client->Message(315, "To prove your experience I require a Tooth from Trakanon in Sebelis, a Robe of the Kedge from Phingegl Autropos in Kedge Keep and an Incarnadine Helm from Overking Bathezid in Chardok");
  }
 }
 
 sub EVENT_ITEM
  {
	if($ulevel = 65)
	{
    if(plugin::check_handin(\%itemcount, 7276 => 1, 1253 => 1, 4132 => 1))
	{
	$client->Message(315, "Shado Feralis will be quite impressed with your progress you should speak to him.");
	quest::level(66);
	}
	else {
    $client->Message(315, "I have no need for this item $name, you can have it back.");

    plugin::return_items(\%itemcount);
  }
 }
 }
Reply With Quote
  #2  
Old 04-03-2014, 03:14 PM
Dunge0nMastr
Hill Giant
 
Join Date: Oct 2002
Location: Rockville, MD
Posts: 124
Default

try if ($ulevel == 65) {
__________________
Bront -Server Admin/Owner and Lead Quest Dev for Kildrukaun's Prophecy
http://kpemu.com/
Reply With Quote
  #3  
Old 04-03-2014, 03:26 PM
Trackye
Sarnak
 
Join Date: Feb 2008
Posts: 87
Default

Thank you for the reply I did try that and on changing it disallows any items to be traded correct or not and does not finish the script or give the items back

Any other ideas?

My best guess is I would have to make that change but the problem is the double if section meaning this

Code:
 sub EVENT_ITEM
  {
	if($ulevel = 65)
	{
    if(plugin::check_handin(\%itemcount, 7276 => 1, 1253 => 1, 4132 => 1))
	{
I cannot seem to figure the correct way to handle it.

I tried

Code:
 sub EVENT_ITEM
  {
    if($ulevel = 65)
    if(plugin::check_handin(\%itemcount, 7276 => 1, 1253 => 1, 4132 => 1))
	{
But it just causes the Npc to do nothing
Reply With Quote
  #4  
Old 04-03-2014, 03:59 PM
Dunge0nMastr
Hill Giant
 
Join Date: Oct 2002
Location: Rockville, MD
Posts: 124
Default

Code:
sub EVENT_SAY{

my $saylink1 = quest::saylink("Experienced");

if ($text =~/Hail/i){
$client->Message(315, "Greetings $class, I have been waiting for someone [$saylink1] such as yourself");
 }
	  if ($text=~ /Experienced/i) {
    $client->Message(315, "To prove your experience I require a Tooth from Trakanon in Sebelis, a Robe of the Kedge from Phingegl Autropos in Kedge Keep and an Incarnadine Helm from Overking Bathezid in Chardok");
  }
 }
 
 sub EVENT_ITEM
  {
	if($ulevel == 65) {
    if(plugin::check_handin(\%itemcount, 7276 => 1, 1253 => 1, 4132 => 1)) {
	$client->Message(315, "Shado Feralis will be quite impressed with your progress you should speak to him.");
	quest::level(66);
	}
	else {
    $client->Message(315, "I have no need for this item $name, you can have it back.");
    plugin::return_items(\%itemcount);
	}
 }
 }
Worked fine for me on my server when i tested. Have you had any issues elsewhere with item turn ins? Thinking maybe your missing the plugin folder?
__________________
Bront -Server Admin/Owner and Lead Quest Dev for Kildrukaun's Prophecy
http://kpemu.com/
Reply With Quote
  #5  
Old 04-03-2014, 04:22 PM
Trackye
Sarnak
 
Join Date: Feb 2008
Posts: 87
Default

Ok.. I seem to be making progress Ive made changes to reflect yours. It works thank you:P
The only issue is if you are not eligable to do the quest the NPC does not give you the items back.

I will take it from here and figure it out.

Thank you so much for your help.
Reply With Quote
  #6  
Old 04-03-2014, 04:27 PM
Dunge0nMastr
Hill Giant
 
Join Date: Oct 2002
Location: Rockville, MD
Posts: 124
Default

Check where you have your else statement. At the moment its only set to return items when a level 65 screws up the handin, id move the else statement outside of the level check and see how that works for ya.
__________________
Bront -Server Admin/Owner and Lead Quest Dev for Kildrukaun's Prophecy
http://kpemu.com/
Reply With Quote
  #7  
Old 04-03-2014, 06:30 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,589
Default

Code:
sub EVENT_SAY
{
	my $saylink1 = quest::saylink("Experienced");
	if ($text =~/Hail/i)
	{
		$client->Message(315, "Greetings $class, I have been waiting for someone [$saylink1] such as yourself");
	}
	elsif ($text=~ /Experienced/i)
	{
		$client->Message(315, "To prove your experience I require a Tooth from Trakanon in Sebelis, a Robe of the Kedge from Phingegl Autropos in Kedge Keep and an Incarnadine Helm from Overking Bathezid in Chardok");
	}
}
 
sub EVENT_ITEM
{
	if($ulevel == 65)
	{
		if(plugin::check_handin(\%itemcount, 7276 => 1, 1253 => 1, 4132 => 1))
		{
			$client->Message(315, "Shado Feralis will be quite impressed with your progress you should speak to him.");
			quest::level(66);
		}
		else
		{
			$client->Message(315, "I have no need for this item $name, you can have it back.");
			plugin::return_items(\%itemcount);
		}
	}
	else
	{
		$client->Message(315, "I have no need for this item $name, and you're far too low level to trade with me.");
		plugin::return_items(\%itemcount);
	}
 }
Reply With Quote
  #8  
Old 04-04-2014, 12:44 AM
sorvani
Dragon
 
Join Date: May 2010
Posts: 966
Default

You NEVER EVER EVER put the return items call inside ANY logic blocks.

It goes in a script once and once only at the end of sub EVENT_ITEM

Code:
sub EVENT_ITEM {
    if blah blah blah {
        lot of funky logic to do what you want. if/else/elsif/etc.
    }
    plugin::return_items(\%itemcount);
}
Reply With Quote
  #9  
Old 04-04-2014, 07:29 AM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,589
Default

Quote:
Originally Posted by sorvani View Post
You NEVER EVER EVER put the return items call inside ANY logic blocks.

It goes in a script once and once only at the end of sub EVENT_ITEM

Code:
sub EVENT_ITEM {
    if blah blah blah {
        lot of funky logic to do what you want. if/else/elsif/etc.
    }
    plugin::return_items(\%itemcount);
}
It has worked perfectly well in my other scripts.
This works just fine for me: http://perl.pastebin.mozilla.org/4759052
Reply With Quote
  #10  
Old 04-04-2014, 10:48 AM
sorvani
Dragon
 
Join Date: May 2010
Posts: 966
Default

Just because it works, does not mean it is the best way to handle it. There was a LOT of misundstanding of this functionality when it was first introduced years ago and a lot of working, but technically incorrect scripts went in the quest repo.

Best practice is to put it once at the end of the script. The %itemcount hash will have its contents modified by your prior logic and only ever needs called once to then summon the items still left in the hash onto the player's cursor.

All it takes is a bad logic loop without a return in it to have items never returned as noted by the OP.
Reply With Quote
  #11  
Old 04-04-2014, 02:50 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,743
Default

Unless you really like typing or copy/pasting there's no reason to have the same statement in multiple places, and as a bonus like Sorvani said, you won't miss one accidentally.
Reply With Quote
  #12  
Old 04-04-2014, 04:00 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,589
Default

Yeah, it makes sense. I understand the reasoning behind doing it your way, I just don't do it that way.
Reply With Quote
Reply


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 02:24 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3