EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Can I get another set of eyes on these quests? (https://www.eqemulator.org/forums/showthread.php?t=35104)

chrsschb 03-24-2012 03:47 PM

Can I get another set of eyes on these quests?
 
For some reason they aren't working completely so hoping another set of eyes can spot any errors:

First quest, so far the dialogue is working fine but I'm getting repeats of some messages and when I turn in items I'm getting the item return message even though the turn in is correct (and fires correctly).

Code:

#######################################
####          Saylinks            ####
#######################################

sub EVENT_SAY
        {

        my $deal = quest::saylink("deal", 1);
        my $coin = quest::saylink("coin", 1);
        my $estate = quest::saylink("Estate", 1);
        my $inny = quest::saylink("Innoruuk", 1);
        my $bladesmith = quest::saylink("bladesmith", 1);

#######################################
####        Quest Dialogue        ####
#######################################

        if($text=~/hail/i && $hateblade == 1)
                {
                plugin::Whisper("I said it was splendid; I did not say it was useful!");
                quest::doanim(54);
                plugin::Whisper("It truly IS one of a kind... literally; however, I hear it may be of more use when forged with a rare sword from the old [$estate].");
                }
               
        if($text=~/hail/i && $hateblade == 2)       
                {
                plugin::Whisper("Did you fashion the blade? Let me see it!");
                }

                       
        if($text=~/hail/i && $hateblade == 3)
                {
                plugin::Whisper("Seek out Tirapulin V'Thex, the master bladesmith.");
                }

        if($text=~/hail/i && $hateblade == 4)
                {
                plugin::Whisper("You have returned! Let me see the blade!");
                }

        if($text=~/hail/i && $hateblade == 5)
                {
                plugin::Whisper("Ever have the strangest feeling of dejavu?");
                }

        if($text=~/hail/i && $hateblade == 6)
                {
                plugin::Whisper("Ever have the strangest feeling of dejavu?");
                }

        if($text=~/hail/i && $hateblade == 7)
                {
                plugin::Whisper("Ever have the strangest feeling of dejavu?");
                }                       
                       
                       
        if($text=~/hail/i && $hateblade == undef && $class eq "Warrior")
                {
                plugin::Whisper("Hello fellow Warrior, I may have a splendid [$deal] for you!");
                }                       
                       
        if($text=~/hail/i && $hateblade == undef)
                        {
                        plugin::Whisper("Hello traveler.  Where have all the traders gone?  Please browse my wares.");
                        }                       
                       
        if($text=~/deal/i && $class eq "Warrior")
                {
                plugin::Whisper("If you have the [$coin], I may be able to provide you with a splendid blade!");
                }       
                       
        if($text=~/coin/i && $class eq "Warrior")
                {
                plugin::Whisper("For a measly 250 platinum pieces, I will provide you with a blade no warrior has seen the likes of!");
                }       
                       
        if($text=~/estate/i && $hateblade == 1)
                {
                plugin::Whisper("Unrest of course.  Here, take these notes.  Now leave me alone.");
                quest::summonitem(2669);
                quest::setglobal("hateblade", 2, 5, "F");
                }       
               
               
        if($text=~/innoruuk/i && $hateblade == 2)
                {
                plugin::Whisper("That is right, Innoruuk himself gave a blade to King Thex of the Tier'Dal, that has resemblance to that of which you hold.  Perhaps a maaster Tier'Dal [$bladesmith] may assist you further.");
                }       
                       
        if($text=~/bladesmith/i && $hateblade == 2)
                {
                plugin::Whisper("Seek out Tirapulin V'Thex in the Bazaar.  I imagine he has migrated his wares there like every other trader.");
                quest::setglobal("hateblade", 3, 5, "F");
                }       
               
        }
       
#######################################
####          Turn-Ins            ####
#######################################       

sub EVENT_ITEM
        {

        if(($platinum==250)&& $class eq "Warrior")
                {
                quest::summonitem(2667);
                quest::setglobal("hateblade", 1, 5, "F");
                }
               
        elsif(plugin::check_handin(\%itemcount, 2666=>1) && $hateblade == 2)
                {
                plugin::Whisper("I told you it was a blade no warrior had seen the likes of!  Legend tells it may be a shard of King Thex's royal blade!  Perhaps it was forged by [$inny] himself.");
                quest::summonitem(2666);
                }
               
        elsif(plugin::check_handin(\%itemcount, 2668=>1) && $hateblade == 4})
                {
                plugin::Whisper("It's mine! Finally!  At last my King will have his Hateblade returned to him once and for all!");
                quest::emote("runs towards Nektulos Forest");
                quest::setglobal("hateblade", 5, 5, "F");
                $npc->MoveTo(837, 1281, -17, 128, 0);
                quest::settimer("depop", 30);
                }               
               
        else
                {
                plugin::return_items(\%itemcount);
                plugin::Whisper("It looks like you forgot something.");
                }       
               
        }       

#######################################
####        Despawn Timer        ####
#######################################               
       
sub EVENT_TIMER
        {
 
        if ($timer eq "depop")
                {
                quest::depop();
                quest::stoptimer("depop");
                }       
               
        }

Second quest, none of the dialogue is working. The turnins work but getting the same issue as first quest.
Code:

#######################################
####          Saylinks            ####
#######################################

sub EVENT_SAY
        {

        my $fineblade = quest::saylink("fine blade", 1);
        my $potential = quest::saylink("potential", 1);
        my $relic = quest::saylink("relic", 1);
        my $shards = quest::saylink("shards", 1);
        my $hateblade = quest::saylink("Hateblade", 1);
       
#######################################
####        Quest Dialogue        ####
#######################################

        if($text=~/hail/i && $hateblade == 3)
                {
                plugin::Whisper("I am Tirapulin, Master Tier'Dal Bladesmith.  I see you have a [$fineblade] in your possession.  May I see it?");
                }

        if($text=~/fine blade/i && $hateblade == 3)
                {
                plugin::Whisper("The Silver Blade of Ire...");
                }       
                               
        if($text=~/potential/i && $hateblade == 3)
                {
                plugin::Whisper("That is the Silver Blade of Ire.  It was once part of a Tier'Dal [$relic] of Hate.");
                }       
                       
        if($text=~/relic/i && $hateblade == 3)
                {
                plugin::Whisper("This is one of three shards of the Relic of Hate given to King Thex, by Innoruuk himself, eons ago.  It was destroyed by Tunare in a mighty battle upon the Plane of hate.  if you can recover the other [$shards] I may be able to reconstruct the [$hateblade].");
                }       
                               
        if($text=~/shards/i && $hateblade == 3)
                {
                plugin::Whisper("One shard was recovered by the undead of Guk and is being used in dark necromantic rituals.  The other fell into the hands of filthy kobold nobles, likely for purposes of escalating their position of status.");
                }       
                       
        if($text=~/hateblade/i && $hateblade == 3)
                {
                plugin::Whisper("The Hateblade is a weapon forged by Innoruuk himself, the Prince of Hate, to inspire hatred within his foes.  Innoruuk knew that anger was the strongest of all emotions and caused his opponents to think brashly and make grave mistakes, ultimately costing them their lives on the battlefield.");
                }       
               
        }                                       

       
#######################################
####          Turn-Ins            ####
#######################################       

sub EVENT_ITEM
        {

        if(plugin::check_handin(\%itemcount, 2666=>1) && $hateblade == 3)
                {
                plugin::Whisper("Most beautiful blade this is.  It has [$potential] to be a weapon suited for a real Warrior.");
                quest::summonitem(2666);
                }
               
        if(plugin::check_handin(\%itemcount, 2666=>1, 2670=>1, 2672=>1) && $hateblade == 3)
                {
                plugin::Whisper("Magnificent.  The essence of Hate embodied within a masterfully forged blade.  Take this relic, Warrior, and return to your Maldan.  Let him see what a REAL blade is supposed to be!");
                quest::summonitem(2668);
                quest::setglobal("hateblade", 4, 5, "F");
                }               
               
        else
                {
                plugin::return_items(\%itemcount);
                plugin::Whisper("It looks like you forgot something.");
                }       
               
        }


Jeknos 03-24-2012 05:17 PM

In the second quest you have $hateblade as a saylink, that might be screwing up your qglobal check and breaking the dialogue.

chrsschb 03-24-2012 08:55 PM

Quote:

Originally Posted by Jeknos (Post 208381)
In the second quest you have $hateblade as a saylink, that might be screwing up your qglobal check and breaking the dialogue.

That got his dialogue working, now the saylink for [$potential] isn't working. All I get is []. I've tried changing the words around and using different saylinks and get the same result.

The handins work too but I'm still getting the "item returned" message even though the handins were successful.

Akkadius 03-24-2012 09:01 PM

Quote:

Originally Posted by chrsschb (Post 208387)
That got his dialogue working, now the saylink for [$potential] isn't working. All I get is []. I've tried changing the words around and using different saylinks and get the same result.

The handins work too but I'm still getting the "item returned" message even though the handins were successful.

That's because you are defining saylinks with the 'my' which declares variables only to the enclosing block, meaning they will not traverse outside of the block you have them defined. Right now they are defined at the top level block of the sub EVENT_SAY routine and they will flow through the entire say dialogue just fine. If you take out 'my' and say in a specific situation where a player goes in to that zone, and that script was cleanly loaded and they tried to hand in items it wouldn't work either because they did not speak to the NPC to define those variables at the top of the sub routine. If you are going to pass saylink variables throughout the entire script it is better to put them all in sub EVENT_SPAWN because variables will be defined on spawn. Otherwise if you only need that saylink in sub EVENT_ITEM, simply define it within the sub EVENT_ITEM block.

Does this answer your questions and issues?

Let me know.

~Akkadius

chrsschb 03-24-2012 09:05 PM

Quote:

Originally Posted by Akkadius (Post 208388)
That's because you are defining saylinks with the 'my' which declares variables only to the enclosing block, meaning they will not traverse outside of the block you have them defined. Right now they are defined at the top level block of the sub EVENT_SAY routine and they will flow through the entire say dialogue just fine. If you take out 'my' and say in a specific situation where a player goes in to that zone, and that script was cleanly loaded and they tried to hand in items it wouldn't work either because they did not speak to the NPC to define those variables at the top of the sub routine. If you are going to pass saylink variables throughout the entire script it is better to put them all in sub EVENT_SPAWN because variables will be defined on spawn. Otherwise if you only need that saylink in sub EVENT_ITEM, simply define it within the sub EVENT_ITEM block.

Does this answer your questions and issues?

Let me know.

~Akkadius

Definitely. This is my first time writing this kind of quest and first time putting a saylink within the items portion. How do I set them inside the spawn event block so they work in other event blocks?

Can you shed any light on why my successful handins are giving me the items returned message though?

Appreciate the info.

Akkadius 03-24-2012 09:16 PM

Quote:

Originally Posted by chrsschb (Post 208389)
Definitely. This is my first time writing this kind of quest and first time putting a saylink within the items portion. Appreciate the info. Can you shed any light on why my successful handins are giving me the items returned message though?

First of all you are trying to access your qglobal like it is a local variable defined, in which under your sub EVENT_SAY you have $hateblade defined as a saylink.

To access your qglobal it needs to be accessed as such:

Code:

$qglobals{"hateblade"}
Ex:
Code:

elsif(plugin::check_handin(\%itemcount, 2668=>1) && $qglobals{"hateblade"} == 4})
Help?

Also you can debug your quests by spitting out what the value of your qglobal actually holds by doing this:

Code:

quest::say($qglobals{"hateblade"});

chrsschb 03-24-2012 09:23 PM

In your example:

elsif(plugin::check_handin(\%itemcount, 2668=>1) && $qglobals{"hateblade"} == 4})

Where is that other bracket coming from?

chrsschb 03-24-2012 11:07 PM

Below is the updated trader quest. I moved the saylink to the item section.

Still existing issues: Whenever I hand the platinum to the trader I get the failed turn in message even though the turn in is successful (and I get the global).

Once I have hateblade==1 flag, I'm getting 4 messages when I hail the trader. The messages for hateblade==0 and the messages for hateblade==1. Why is this? I've tried using !defined, hateblade==undef, and hateblade==0. No matter which I use my warrior is sitll getting 4 messages.

I have a shaman standing nearby who is only receiving the first message (which is perfect).

Code:

###Description: Quest NPC for the Hateblade Quest
###Created By: Specialty & Gnomicide of Clumsy's World.
###NPC: Maldan the Trader
###Zone: East Commons

#######################################
####          Saylinks            ####
#######################################

sub EVENT_SAY
        {

        my $deal = quest::saylink("deal", 1);
        my $coin = quest::saylink("coin", 1);
        my $estate = quest::saylink("Estate", 1);
        my $inny = quest::saylink("Innoruuk", 1);
        my $bladesmith = quest::saylink("bladesmith", 1);

#######################################
####        Quest Dialogue        ####
#######################################

        if($text=~/hail/i && $globals{"hateblade"} == 0)
                {
                plugin::Whisper("Where have all the traders gone?");
                if($class eq "Warrior")
                        {
                        plugin::Whisper("Hello fellow Warrior, I may have a splendid [$deal] for you!");
                        }
                }

        if($text=~/hail/i && $qglobals{"hateblade"} == 1)
                {
                plugin::Whisper("I said it was splendid; I did not say it was useful!");
                quest::doanim(54);
                plugin::Whisper("It truly IS one of a kind... literally; however, I hear it may be of more use when forged with a rare sword from the old [$estate].");
                }
               
        if($text=~/hail/i && $globals{"hateblade"} == 2)       
                {
                plugin::Whisper("Did you fashion the blade? Let me see it!");
                }

                       
        if($text=~/hail/i && $globals{"hateblade"} == 3)
                {
                plugin::Whisper("Seek out Tirapulin V'Thex, the master bladesmith.");
                }

        if($text=~/hail/i && $globals{"hateblade"} == 4)
                {
                plugin::Whisper("You have returned! Let me see the blade!");
                }

        if($text=~/hail/i && $globals{"hateblade"} == 5)
                {
                plugin::Whisper("Ever have the strangest feeling of dejavu?");
                }

        if($text=~/hail/i && $globals{"hateblade"} == 6)
                {
                plugin::Whisper("Ever have the strangest feeling of dejavu?");
                }

        if($text=~/hail/i && $globals{"hateblade"} == 7)
                {
                plugin::Whisper("Ever have the strangest feeling of dejavu?");
                }                       
                       
        if($text=~/deal/i && $class eq "Warrior")
                {
                plugin::Whisper("If you have the [$coin], I may be able to provide you with a splendid blade!");
                }       
                       
        if($text=~/coin/i && $class eq "Warrior")
                {
                plugin::Whisper("For a measly 250 platinum pieces, I will provide you with a blade no warrior has seen the likes of!");
                }       
                       
        if($text=~/estate/i && $globals{"hateblade"} == 1)
                {
                plugin::Whisper("Unrest of course.  Here, take these notes.  Now leave me alone.");
                quest::summonitem(2669);
                quest::setglobal("hateblade", 2, 5, "F");
                }       
               
               
        if($text=~/innoruuk/i && $globals{"hateblade"} == 2)
                {
                plugin::Whisper("That is right, Innoruuk himself gave a blade to King Thex of the Tier'Dal, that has resemblance to that of which you hold.  Perhaps a maaster Tier'Dal [$bladesmith] may assist you further.");
                }       
                       
        if($text=~/bladesmith/i && $globals{"hateblade"} == 2)
                {
                plugin::Whisper("Seek out Tirapulin V'Thex in the Bazaar.  I imagine he has migrated his wares there like every other trader.");
                quest::setglobal("hateblade", 3, 5, "F");
                }       
               
        }
       
#######################################
####          Turn-Ins            ####
#######################################       

sub EVENT_ITEM
        {

        my $inny = quest::saylink("Innoruuk", 1);
       
        if($platinum==250 && $class eq "Warrior")
                {
                quest::summonitem(2667);
                quest::setglobal("hateblade", 1, 5, "F");
                }
               
        if(plugin::check_handin(\%itemcount, 2666=>1) && $qglobals{"hateblade"} == 2)
                {
                plugin::Whisper("I told you it was a blade no warrior had seen the likes of!  Legend tells it may be a shard of King Thex's royal blade!  Perhaps it was forged by [$inny] himself.");
                quest::summonitem(2666);
                }
               
        if(plugin::check_handin(\%itemcount, 2668=>1) && $qglobals{"hateblade"} == 4)
                {
                plugin::Whisper("It's mine! Finally!  At last my King will have his Hateblade returned to him once and for all!");
                quest::emote("runs towards Nektulos Forest");
                quest::setglobal("hateblade", 5, 5, "F");
                $npc->MoveTo(837, 1281, -17, 128, 0);
                quest::settimer("depop", 30);
                }               
               
        else
                {
                plugin::return_items(\%itemcount);
                plugin::Whisper("It looks like you forgot something.");
                }       
               
        }       

#######################################
####        Despawn Timer        ####
#######################################               
       
sub EVENT_TIMER
        {
 
        if ($timer eq "depop")
                {
                quest::depop();
                quest::stoptimer("depop");
                }       
               
        }


lerxst2112 03-24-2012 11:21 PM

You need to think a little about how if/else works. The else you have will happen if the last if isn't true. If you want it to only happen if all of the other checks fail you need to use if/elsif/else all the way through.

Another thing that might be easier to debug would be to group some things together. Like if($text=~/hail/i) and then check all the qglobal values inside that if. You could also group some together, like if($globals{"hateblade"} >= 5 && $globals{"hateblade"} <= 7), etc.

If you're seeing more than one response, add some debugging to the script. Print out what the qglobal is set to and it will help you determine where things are going wrong.

chrsschb 03-24-2012 11:48 PM

Quote:

Originally Posted by lerxst2112 (Post 208400)
You need to think a little about how if/else works. The else you have will happen if the last if isn't true. If you want it to only happen if all of the other checks fail you need to use if/elsif/else all the way through.

Another thing that might be easier to debug would be to group some things together. Like if($text=~/hail/i) and then check all the qglobal values inside that if. You could also group some together, like if($globals{"hateblade"} >= 5 && $globals{"hateblade"} <= 7), etc.

If you're seeing more than one response, add some debugging to the script. Print out what the qglobal is set to and it will help you determine where things are going wrong.

Using your suggestions, now I'm not getting any responses for anything except hateblade==0. The debugger on my warrior comes back 1, and he still receives 0 responses. My shaman receives a blank response and receives the 0 else response.

ARGH!

Code:

        if($text=~/hail/i)
                {
                if($globals{"hateblade"} == 0)
                        {
                        if($class eq "Warrior")
                                {
                                quest::say($qglobals{"hateblade"});
                                plugin::Whisper("Hello fellow Warrior, I may have a splendid [$deal] for you!");
                                }
                        else
                                {
                                quest::say($qglobals{"hateblade"});
                                plugin::Whisper("Where have all the traders gone?");
                                }
                        }
                               
                if($globals{"hateblade"} == 1)
                        {
                        quest::say($qglobals{"hateblade"});
                        plugin::Whisper("I said it was splendid; I did not say it was useful!");
                        quest::doanim(54);
                        plugin::Whisper("It truly IS one of a kind... literally; however, I hear it may be of more use when forged with a rare sword from the old [$estate].");
                        }

                if($globals{"hateblade"} == 2)
                        {
                        plugin::Whisper("Did you fashion the blade? Let me see it!");
                        }       
               
                if($globals{"hateblade"} == 3)
                        {
                        plugin::Whisper("Seek out Tirapulin V'Thex, the master bladesmith.");
                        }
               
                if($globals{"hateblade"} == 4)
                        {
                        plugin::Whisper("You have returned! Let me see the blade!");
                        }
               
                if($globals{"hateblade"} >=5 && $globals{"hateblade"} <=7)
                        {
                        plugin::Whisper("Ever have the strangest feeling of dejavu?");
                        }
               
                }
               
        if($text=~/deal/i && $class eq "Warrior")
                {
                plugin::Whisper("If you have the [$coin], I may be able to provide you with a splendid blade!");
                }       
                       
        if($text=~/coin/i && $class eq "Warrior")
                {
                plugin::Whisper("For a measly 250 platinum pieces, I will provide you with a blade no warrior has seen the likes of!");
                }       
                       
        if($text=~/estate/i && $globals{"hateblade"} == 1)
                {
                plugin::Whisper("Unrest of course.  Here, take these notes.  Now leave me alone.");
                quest::summonitem(2669);
                quest::setglobal("hateblade", 2, 5, "F");
                }       
               
               
        if($text=~/innoruuk/i && $globals{"hateblade"} == 2)
                {
                plugin::Whisper("That is right, Innoruuk himself gave a blade to King Thex of the Tier'Dal, that has resemblance to that of which you hold.  Perhaps a maaster Tier'Dal [$bladesmith] may assist you further.");
                }       
                       
        if($text=~/bladesmith/i && $globals{"hateblade"} == 2)
                {
                plugin::Whisper("Seek out Tirapulin V'Thex in the Bazaar.  I imagine he has migrated his wares there like every other trader.");
                quest::setglobal("hateblade", 3, 5, "F");
                }       
               
        }


joligario 03-25-2012 09:23 AM

Just started looking at your conversation. Is qglobals set to 1 on this NPC in the npc_types table?

Oh, and you don't need quotes in your $qglobals{hateblade}

chrsschb 03-25-2012 10:30 AM

Quote:

Originally Posted by joligario (Post 208406)
Just started looking at your conversation. Is qglobals set to 1 on this NPC in the npc_types table?

Oh, and you don't need quotes in your $qglobals{hateblade}

Yes, the quotes don't seem to hurt anything. :-D

joligario 03-25-2012 01:50 PM

I know, just letting you know you don't need them.

Missing the "Q" in $qglobals will mess things all up though.

chrsschb 03-25-2012 02:23 PM

Quote:

Originally Posted by joligario (Post 208411)
I know, just letting you know you don't need them.

Missing the "Q" in $qglobals will mess things all up though.

See that's why it's always nice to get a second set of eyes on your work lol.

chrsschb 03-25-2012 02:58 PM

Both quests work great now. Thanks everyone!


All times are GMT -4. The time now is 09:48 AM.

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