View Single Post
  #8  
Old 03-24-2012, 11:48 PM
chrsschb's Avatar
chrsschb
Dragon
 
Join Date: Nov 2008
Location: GA
Posts: 904
Default

Quote:
Originally Posted by lerxst2112 View Post
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");
		}	
		
	}
Reply With Quote