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

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

Reply
 
Thread Tools Display Modes
  #16  
Old 03-18-2008, 02:07 AM
So_1337
Dragon
 
Join Date: May 2006
Location: Cincinnati, OH
Posts: 689
Default

I see. I hadn't considered that. Good call.

Here's what you should really, do, though:

$text =~/\bme\b/ - Would not match the "me" in name. The "\b" means there must not be text next to the match so "me" must be by itself.

Just use that in your trigger, and it will only match "bend" when there's nothing else around it. So it will match "Go ahead and bend my mind", but not "You're such a crazy mindbender".
Reply With Quote
  #17  
Old 03-18-2008, 02:27 AM
Ut0pia
Sarnak
 
Join Date: Feb 2008
Posts: 72
Default

I did just get through reading that in Lexicon's Guide. However, I'm testing right now if that includes white spaces. Because I would want say "me and my friend" to work instead of just "me" But yeah, I yeah, I just got doing adding \b to my scripts and hopefuly that will work :P.

Still does anyone know what ~ does?
Reply With Quote
  #18  
Old 03-18-2008, 02:58 AM
Ut0pia
Sarnak
 
Join Date: Feb 2008
Posts: 72
Default

Ok the \b works like a charm, My buff bots work like a charm. Everything I want them to do they are doing.

Still wanna know what's up with the ~ :P
Reply With Quote
  #19  
Old 03-18-2008, 03:14 AM
So_1337
Dragon
 
Join Date: May 2006
Location: Cincinnati, OH
Posts: 689
Default

There's a lot of different comparisons that can be done with perl.

Quote:
Originally Posted by From the quest tutorial wiki
Note, special operators apply to string comparisons in perl!

Operators:
$1 == $2 : If variable $1 is the same as variable $2, carry on.
$1 != $2 : If variable $1 is NOT the same as variable $2, carry on.
$1 > $2 : If variable $1 is greater than variable $2, carry on.
$1 < $2 : If variable $1 is less than variable $2, carry on.
$1 >= $2 : If variable $1 is greater than or equal to variable $2, carry on.
$1 <= $2 : If variable $1 is less than or equal to variable $2, carry on.
$1 eq $2 : If string variable $1 is the same as string variable $2, carry on.
$1 ne $2 : If string variable $1 is NOT the same as string variable $2, carry on.
$1 =~ $2 : If string variable $1 contains/matches the string variable $2, carry on.
Yours is the last on the list. It makes text-based chat with NPCs a little more forgiving.
Reply With Quote
  #20  
Old 03-18-2008, 03:54 AM
Ut0pia
Sarnak
 
Join Date: Feb 2008
Posts: 72
Default

Ahh, I see, Sometime tells me I should read the wiki completely. I'm not sure if that was in my pdf guides that I downloaded or not.

But that's all good. I'm very pleased with how this all turned out. I'm looking foward to working on this stuff.

I'll go ahead and post the finished scripts

Code:
#Illusionist_Nomaad.pl
#zone:poknowledge
#Magicdragon

sub EVENT_SAY
{
	if($text=~/hail/i)
	{
		$npc->SetAppearance(0);
		quest::emote("sighs at $name");
		quest::say("Once upon a time, I was a very powerful Enchanter. However, during one of my Drunken rampages I slaughtered the guards in High Keep. They started to hate me so much that they would want to [kill] me on sight.");
	}
	if($text=~/kill\b/i)
	{
		$npc->SetAppearance(0);
		quest::emote("shakes his fists in anger");
		quest::say("Then one of those damn nobles got me from behind. She killed me.... ME!!! I wanted to [hurt] myself!");
	}
	if($text=~/hurt\b/i)
	{
		$npc->SetAppearance(0);
		quest::say("I went to bed that night. Sadly, in my drunken mess, I forgot that I bound my soul right there in High Keep. The guards slaughtered me over and over till I woke up and I was level 17. Now instead of KEI, all I have for you are these [crap buffs].");
	}
	if($text=~/crap buffs\b/i && $ulevel>=11)
	{
		$npc->SetAppearance(0);
		quest::say("Yes, for someone of your level, I can cast [intellectual superiority] for 1 Platinum.");
		quest::emote("begins to cry over the loss of income");
	}
	if($text=~/crap buffs\b/i && $ulevel<=10)
	{
		$npc->SetAppearance(0);
		quest::say("Yes, fucking crap buffs. I can cast this [intellectual advancement] buff on you for 1 Platinum.");
		quest::emote("begins to cry over the loss of income");
	}
	if($text=~/intellectual superiority\b/i)
	{
		$npc->SetAppearance(0);
		quest::say("Intellectual Superiority: Increases your Effective Casting by 6, and lasts for 27 minutes. Open trade and hand me 1 Platinum for the buff.");
	}
	if($text=~/intellectual advancement\b/i)
	{
		$npc->SetAppearance(0);
		quest::say("Intellectual Advancement: Increases your Effective Casting by 3, and lasts for 27 minutes. There is an upgraded version once you come back here at level 11. Open trade and hand me 1 Platinum for the buff.");
	}
}

sub EVENT_SPAWN
{
	$x = $npc->GetX();
	$y = $npc->GetY();
	quest::set_proximity($x - 90, $x + 90, $y - 90, $y + 90);
}

sub EVENT_ENTER
{
	$npc->SetAppearance(1);
}

sub EVENT_ITEM
{
	if ($platinum >= '1' && $ulevel <= '10')
	{
		$npc->SetAppearance(0);
		quest::selfcast(2561);
		quest::say("Thanks for the donation, check with Illusionist Mindbender for some mind buffs or Vicar Qadar for health buffs.");
	}
	if($platinum >= '1' && $ulevel >= '11')
	{
		$npc->SetAppearance(0);
		quest::selfcast(2562);
		quest::say("Thanks for the donation, check with Illusionist Mindbender for some mind buffs or Vicar Qadar for health buffs.");
	}
	if($platinum < '1')
	{
		quest::emote("looks very upset with $name");
		quest::say("Thanks for the donation, but it sucked ... I mean, I've been downgraded to this rubble of shit and yet you won't even give me the minimum amount of platnium that I requested. What do I look like to you! Get lost and forget about getting your money back. Your paying just to hear this you fuck tard!");
	}
}
And here is the other:

Code:
#Illusionist_Mindbender.pl
#zone:poknowledge
#Magicdragon

sub EVENT_SAY
{
	if(($text=~/hail/i))
	{
		$npc->SetAppearance(0);
		quest::emote("waves at $name");
		quest::say("Welcome, welcome, I am the mighty Illusionist Mindbender and I'll happily [bend] your mind for a price");
	}
	if($text=~/bend\b/i && $ulevel>= 1 && $ulevel<= 14)
	{
		$npc->SetAppearance(0);
		quest::say("Well my friend, your [will] is only proficient for [breeze], it will cost you 1 platinum.");
	}
	if($text=~/bend\b/i && $ulevel>= 15 && $ulevel<= 29)
	{
		$npc->SetAppearance(0);
		quest::say("A lot of puney rats want my mind buffs, sadly their [will] is not as advanced, sadly you fall in this line and can only obtain [clarity] from me, this spell will cost you 5 platinum.");
	}
	if($text=~/bend\b/i && $ulevel>= 30 && $ulevel<= 45)
	{
		$npc->SetAppearance(0);
		quest::say("Ha, I'd call you a Mid-be, in other words your [will] is strong enough to handle my [clarity 2] spell which still sucks. It's 10 platinum if you want it.");
	}
	if($text=~/bend\b/i && $ulevel>= 46 && $ulevel<= 50)
	{
		$npc->SetAppearance(0);
		quest::say("Nice, you can now forget Illusionist Orange here to my right, your [will] is quite powerful enough for [KEI]. However, it will cost you 30 platinum.");
	}
	if($text=~/bend\b/i && $ulevel>= 51 && $ulevel<= 55)
	{
		$npc->SetAppearance(0);
		quest::say("You have come to the right place friend, your [will] is capable of [tranquility]. It's better then [KEI], but does not last as long. [KEI] is still 30 platinum if you want it. [tranquility] is 35 platinum.");
	}
	if($text=~/bend\b/i && $ulevel>= 56 && $ulevel<= 59)
	{
		$npc->SetAppearance(0);
		quest::say("Wow, your [will] is quite strong, I can sense it pulse with energy. I can offer you [VOQ] which is much better then [KEI], but does not last as long. [KEI] is still 30 platinum if you want it. [VOQ] is 40 platinum.");
	}
	if($text=~/bend\b/i && $ulevel>= 60)
	{
		$npc->SetAppearance(0);
		quest::emote("looks quite happy");
		quest::say("FINALLY, Someone that I can respect! Your [will] is as powerful as mine. If you want [KEI] it's still 30 platinum as always. But why not take advantage of [clairvoyance]. It's much more powerful then [KEI] but doesn't last as long. I can cast it on you for just 50 platinum.");
	}
	if($text=~/will\b/i)
	{
		$npc->SetAppearance(0);
		quest::say("I can offer [breeze] starting at level 1, [clarity] at level 15, [clarity 2] at level 30, [KEI] at level 46, [tranquility] at level 51, [VOQ] at level 56, and finally and definitely something that will keep you up at night, [clairvoyance] at level 60.");
	}
	if($text=~/breeze\b/i)
	{
		$npc->SetAppearance(0);
		quest::say("Breeze: 4 to 6 mana per tick, and lasts 27 minutes. This spell will cost you 1 platinum.");
	}
	if($text=~/clarity\b/i)
	{
		$npc->SetAppearance(0);
		quest::say("Clarity: 7 to 9 mana per tick, and lasts 27 minutes. You need a will of at least level 15 to handle it. This spell will cost you 5 platinum.");
	}
	if($text=~/clarity 2\b/i)
	{
		$npc->SetAppearance(0);
		quest::say("Clarity 2: 9 to 11 mana per tick, and lasts 35 minutes. You will need a will of at least level 30 to handle it. This spell will cost you 10 platinum.");
	}
	if($text=~/KEI\b/i)
	{
		$npc->SetAppearance(0);
		quest::say("Koadic's Endless Intelligence: Increases mana pool by 250, 14 mana per tick, +25 WIS, +25 INT, and lasts 2 hours and 30 minutes. You will need a will of at least level 46 to handle this spell. It will cost you 30 platinum.");
	}
	if($text=~/tranquility\b/i)
	{
		$npc->SetAppearance(0);
		quest::say("Tanquility: Increases mana pool by 260, 16 mana per tick, +26INT, +26WIS, and lasts 1 hour and 20 minutes. You will need a will of at least level 51. This spell will cost you 35 platinum.");
	}
	if($text=~/VOQ\b/i)
	{
		$npc->SetAppearance(0);
		quest::say("Voice of Quellious: Increases mana pool by 275, 18 mana per tick, +28WIS, +28INT, and lasts 1 hour and 20 minutes. You will need a will of at least 56. This spell will cost you 40 platinum.");
	}
	if($text=~/clairvoyance\b/i)
	{
		$npc->SetAppearance(0);
		quest::say("Clairvoyance: Increases mana pool by 400, 20 mana per tick, +32WIS, +32INT, and lasts 1 hour and 20 minutes. You will need a will of at least 60. This spell will cost you 50 platinum.");
	}
}

sub EVENT_SPAWN
{
	$x = $npc->GetX();
	$y = $npc->GetY();
	quest::set_proximity($x - 120, $x + 120, $y - 120, $y + 120);
}

sub EVENT_ENTER
{
	$npc->SetAppearance(1);
	my $random_result = int(rand(100));
	if($random_result <= '50')
	{
		quest::shout("Casting Mind Buffs for donations on the rock behind the main bank!");
	}
	else
	{
		#Do Nothing
	}
}

sub EVENT_ITEM
{
	if($platinum >= '1' && $platinum <= '4' && $ulevel <= '45')
	{
		$npc->SetAppearance(0);
		quest::selfcast(697);
		quest::say("Thanks for the donation, check with Vicar Qadar for health buffs.");
	}
	if($platinum >= '5' && $platinum <= '9' && $ulevel <= '45' && $ulevel >= '15')
	{
		$npc->SetAppearance(0);
		quest::selfcast(174);
		quest::say("Thanks for the donation, check with Vicar Qadar for health buffs.");
	}
	if($platinum >= '10' && $platinum <= '29' && $ulevel <= '45' && $ulevel >= '30')
	{
		$npc->SetAppearance(0);
		quest::selfcast(1693);
		quest::say("Thanks for the donation, check with Vicar Qadar for health buffs.");
	}
	if($platinum >= '30' && $platinum <= '34' && $ulevel >= '46')
	{
		$npc->SetAppearance(0);
		quest::selfcast(2570);
		quest::say("Thanks for the donation, check with Vicar Qadar for health buffs.");
	}
	if($platinum >= '35' && $platinum <= '39' && $ulevel >= '51')
	{
		$npc->SetAppearance(0);
		quest::selfcast(3350);
		quest::say("Thanks for the donation, check with Vicar Qadar for health buffs.");
	}
	if($platinum >= '40' && $platinum <= '49' && $ulevel >= '56')
	{
		$npc->SetAppearance(0);
		quest::selfcast(3360);
		quest::say("Thanks for the donation, check with Vicar Qadar for health buffs.");
	}
	if($platinum >= '50' && $ulevel >= '60')
	{
		$npc->SetAppearance(0);
		quest::selfcast(5522);
		quest::say("Thanks for the donation, check with Vicar Qadar for health buffs.");
	}
	if($platinum < '1')
	{
		quest::say("Thanks, but the amount you gave me was not enough for any of my buffs.");
	}
}
There they are, working quite well. I look forward to taking what I have learned here and continuing on with my custom scripting of my entire server.

Thanks all
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 03:28 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