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

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

Reply
 
Thread Tools Display Modes
  #1  
Old 09-01-2007, 05:18 AM
sonicintuition
Hill Giant
 
Join Date: Jan 2005
Posts: 124
Default Aggravated - HELP (please :) )

Hello,

I have a bit of a problem that I'm trying to find the solution for -

I'm trying to create a buff bot that tells non-casting classes (warriors, monks, rogues, berserkers) that they cannot cast spells therefore do not need the buff bot's services. Here is a sample of the code I was trying this with:

sub EVENT_SAY
{
if($text=~/hail/i && $class == 'Warrior')
{
quest::say("You are a warrior. You cannot cast spells.");
}
}

According to other code examples, and logic, this should work. If a warrior hails this NPC, the npc will reply as above - however, even a Shaman, or Necro, or whatever (I tried a few) classes will also see that message. So it seems that the NPC isn't seeing what class the user really is. Is my syntax off, or is this broken? I'm pulling my hair out...

Regards,
Sonic
Reply With Quote
  #2  
Old 09-01-2007, 06:06 AM
tcsmyworld's Avatar
tcsmyworld
Discordant
 
Join Date: Feb 2002
Posts: 452
Default

Been awhile since I even looked at this stuff
Not sure, but seems that should work, but like I said been a long time since I even looked at this.
And the perl quests weren't my favorite anyways
Hope it works/helps. (I have no way to test it)



sub EVENT_SAY{
if($text=~/hail/i) && ($class == 'Warrior' || $class == 'Monk' || $class == 'Rogue' || $class == 'Berserker')
{
quest::say("You are a $class . You cannot cast spells.");
}
}
__________________
Founder PEQ (ProjectEQ)

Last edited by tcsmyworld; 09-01-2007 at 02:09 PM..
Reply With Quote
  #3  
Old 09-01-2007, 06:36 AM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default

This should work (if it does, notice the double brackets added) ;
Code:
sub EVENT_SAY{
if(($text=~/hail/i && $class == 'Warrior')){
quest::say("You are a warrior. You cannot cast spells.");
 }
}

This does work
Code:
sub EVENT_SAY{
  if (($text=~/hail/i&&$race eq 'Human'&&$class eq 'Enchanter')){
  quest::say("I know you!!");
 }
}
The $race is just there to show you how to add more. you can find many examples of stuff like this in my quest pack posted with the database at Rathe Forums. If you do get it, look in Tutorialb, PoK, Gunthak - I remember I did a lot of this stuff in those zones.


Quote:
Originally Posted by sonicintuition View Post
Hello,

I have a bit of a problem that I'm trying to find the solution for -

I'm trying to create a buff bot that tells non-casting classes (warriors, monks, rogues, berserkers) that they cannot cast spells therefore do not need the buff bot's services. Here is a sample of the code I was trying this with:

sub EVENT_SAY
{
if($text=~/hail/i && $class == 'Warrior')
{
quest::say("You are a warrior. You cannot cast spells.");
}
}

According to other code examples, and logic, this should work. If a warrior hails this NPC, the npc will reply as above - however, even a Shaman, or Necro, or whatever (I tried a few) classes will also see that message. So it seems that the NPC isn't seeing what class the user really is. Is my syntax off, or is this broken? I'm pulling my hair out...

Regards,
Sonic
Reply With Quote
  #4  
Old 09-01-2007, 01:25 PM
sfisque
Hill Giant
 
Join Date: Oct 2006
Posts: 248
Default

the error is in the operator.

"==" is for numeric comparison, "eq" is for string comparison.

your if should read:

Code:
if($text=~/hail/i && $class eq 'Warrior' )
{
  # do some work in here
}
== sfisque
Reply With Quote
  #5  
Old 09-01-2007, 04:02 PM
sonicintuition
Hill Giant
 
Join Date: Jan 2005
Posts: 124
Default

Duh, why didn't I think of that? Using a numerical based operator instead of a string based operator ... Thanks for helping out with this all

Regards,
Sonic
Reply With Quote
  #6  
Old 09-02-2007, 12:24 AM
sonicintuition
Hill Giant
 
Join Date: Jan 2005
Posts: 124
Default

Hmm ..seems that using string operators makes no difference either.

Example:
Quote:
sub EVENT_SAY
{
if($text=~/hail/i && $class eq 'Rogue' || $class eq 'Warrior')
{
quest::say("You are a $class. You cannot cast spells.");
}
if($text=~/hail/i && $class ne 'Rogue' || $class ne 'Warrior')
{
quest::say("Would you like me to scribe your spells?");
}
}
According to you guys, this should work ..but it still doesn't work. I hailed this npc with a wizard and the npc said both lines. I hailed her with a rogue, and she said both lines ...I'm stumped? I'm going to try adding the other parenthises to see if that helps.. will post back here if it does.

Regards,
Sonic
Reply With Quote
  #7  
Old 09-02-2007, 12:33 AM
sonicintuition
Hill Giant
 
Join Date: Jan 2005
Posts: 124
Default

I added parenthisis ...does nothing. :(
Reply With Quote
  #8  
Old 09-02-2007, 12:59 AM
sfisque
Hill Giant
 
Join Date: Oct 2006
Posts: 248
Default

Quote:
Originally Posted by sonicintuition View Post
Hmm ..seems that using string operators makes no difference either.

Example:


According to you guys, this should work ..but it still doesn't work. I hailed this npc with a wizard and the npc said both lines. I hailed her with a rogue, and she said both lines ...I'm stumped? I'm going to try adding the other parenthises to see if that helps.. will post back here if it does.

Regards,
Sonic
logic failure. && has higher precedence than ||. you basically want, in this case:

Code:
if($text=~/hail/i && ( $class eq 'Rogue' || $class eq 'Warrior') )
you need to group the two class comparisons because if you dont, the logic says:

if the text contains "hail" and class eq 'Rogue'

OR

class eq 'Warrior'

whereas you want:

if the text contains 'hail'

AND

the class is either Rogue or Warrior

== sfisque
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 07:21 PM.


 

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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3