EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Getting double response from NPC (https://www.eqemulator.org/forums/showthread.php?t=39148)

Bandor 12-28-2014 02:40 AM

Getting double response from NPC
 
So I wrote up a simple quest for one of my npcs modeled of another quest I know is working. And for whatever reason Im getting his first 2 lines of text upon hailing. All responses are working however. Any ideas how to fix this slight annoyance?


Code:

#Quest file for Mesa - Bridle Apprentice

sub EVENT_SAY {
  if($text=~/hail/i) {
    quest::say("Hail $class. Do you seek to earn a [bridle]");
  }
  if($text=~/bridle/i) {
    quest::say("I suspect, as most of us these days,that you are a bit low on platinum? Well no need to worry! Simply handle a...well,[situation] for me");
  }
  if($text=~/situation/i) {
    quest::say("I have a high intolerance for the Tuffien these days. If you would be willing to bring me back one of their hides I will be willing to [reward] you");
        }
if($text=~/reward/i) {
    quest::say("Bring me back any color hide and I will give you the corresponding bridle");
  }
        }

        sub EVENT_ITEM {
        if(plugin::check_handin(\%itemcount, 0 => 1)){ # Black Tuffien Hide
                quest::summonitem(21810); # Black Rope Bridle*
        }
  elsif (plugin::check_handin(\%itemcount, 0 => 1, 13317 => 1)) { # White Tuffien Hide
  quest::summonitem(21805); # White Rope Bridle*
        }
        elsif (plugin::check_handin(\%itemcount, 0 => 1, 13317 => 1)) { # Tan Tuffien Hide
  quest::summonitem(21800); # Tan Rope Bridle*
        }
        elsif (plugin::check_handin(\%itemcount, 0 => 1, 13317 => 1)) { # Brown Tuffien Hide
  quest::summonitem(21815); # Brown Rope Bridle*
        }
        }


Kingly_Krab 12-28-2014 02:48 AM

Is its name 'Bridle Apprentice'? If so, you're saying hail and bridle, $text=~/bridle/i checks the whole string for "bridle" and $text=~/hail/i checks the whole string, too. Due to them both being if conditionals it checks each of them individually rather than checking sequentially and stops when it find one. Maybe try this:
Code:

sub EVENT_SAY {
        if($text=~/hail/i) {
                quest::say("Hail $class. Do you seek to earn a [bridle]");
        } elsif($text=~/bridle/i) {
                quest::say("I suspect, as most of us these days,that you are a bit low on platinum? Well no need to worry! Simply handle a...well,[situation] for me");
        } elsif($text=~/situation/i) {
                quest::say("I have a high intolerance for the Tuffien these days. If you would be willing to bring me back one of their hides I will be willing to [reward] you");
        } elsif($text=~/reward/i) {
                quest::say("Bring me back any color hide and I will give you the corresponding bridle");
        }
}


Bandor 12-28-2014 03:57 AM

flawless fix,ty sir.

Kingly_Krab 12-28-2014 01:24 PM

You're welcome, here's a version with saylinks to keep people from spamming the chat.
Code:

sub EVENT_SAY {
        if($text=~/hail/i) {
                quest::say("Hail $class. Do you seek to earn a " . quest::saylink("bridle", 1) . "?");
        } elsif($text=~/bridle/i) {
                quest::say("I suspect, as most of us these days,that you are a bit low on platinum? Well no need to worry! Simply handle a...well, " . quest::saylink("situation", 1) . " for me.");
        } elsif($text=~/situation/i) {
                quest::say("I have a high intolerance for the Tuffien these days. If you would be willing to bring me back one of their hides I will be willing to " . quest::saylink("reward", 1) . " you.");
        } elsif($text=~/reward/i) {
                quest::say("Bring me back any color hide and I will give you the corresponding bridle.");
        }
}



All times are GMT -4. The time now is 06:34 AM.

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