PDA

View Full Version : Help with this script please?


Trackye
04-03-2014, 02:51 PM
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


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);
}
}
}

Dunge0nMastr
04-03-2014, 03:14 PM
try if ($ulevel == 65) {

Trackye
04-03-2014, 03:26 PM
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


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


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

Dunge0nMastr
04-03-2014, 03:59 PM
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?

Trackye
04-03-2014, 04:22 PM
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.

Dunge0nMastr
04-03-2014, 04:27 PM
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.

Kingly_Krab
04-03-2014, 06:30 PM
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);
}
}

sorvani
04-04-2014, 12:44 AM
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


sub EVENT_ITEM {
if blah blah blah {
lot of funky logic to do what you want. if/else/elsif/etc.
}
plugin::return_items(\%itemcount);
}

Kingly_Krab
04-04-2014, 07:29 AM
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


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

sorvani
04-04-2014, 10:48 AM
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.

lerxst2112
04-04-2014, 02:50 PM
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.

Kingly_Krab
04-04-2014, 04:00 PM
Yeah, it makes sense. I understand the reasoning behind doing it your way, I just don't do it that way.