Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Quests

Archive::Quests Archive area for Quests's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #1  
Old 09-21-2004, 05:48 AM
Magoth78
Discordant
 
Join Date: Jun 2003
Posts: 345
Default $race related

Hello,

I'm pretty new at quest scripting and i've looked for $race in the search forum but I did not find the solution at my problem.
I'm just trying to get a npc to say the race of the player that hails him... pretty simple you say me... probably not for me...

Code:
sub EVENT_SAY
{
	if ($text=~ /Hail/i)
		{
  		if($race == Erudite)
    			{
    			quest::say("Erudit");
			}

		if($race == Darkelf)
			{
    			quest::say("Dark elf");
			}

		}
}
I've tested whit a human character, hailed the npc and he says me Erudit then Dark elf, even if I'm a human. I think it's due to the $race == xx.

Can someone help me please?
thx by advance
Reply With Quote
  #2  
Old 09-21-2004, 06:55 AM
Cisyouc
Demi-God
 
Join Date: Jun 2004
Location: Heaven.
Posts: 1,260
Default Re: $race related

Quote:
Originally Posted by Magoth78
Hello,

I'm pretty new at quest scripting and i've looked for $race in the search forum but I did not find the solution at my problem.
I'm just trying to get a npc to say the race of the player that hails him... pretty simple you say me... probably not for me...

Code:
sub EVENT_SAY
{
	if ($text=~ /Hail/i)
		{
  		if($race == Erudite)
    			{
    			quest::say("Erudit");
			}

		if($race == Darkelf)
			{
    			quest::say("Dark elf");
			}

		}
}
I've tested whit a human character, hailed the npc and he says me Erudit then Dark elf, even if I'm a human. I think it's due to the $race == xx.

Can someone help me please?
thx by advance
Try this code. I think all you need are quotes around the race and correct spelling (Dark Elf not Darkelf).
Code:
sub EVENT_SAY
{
if($text~/hail/i)
  {
  if($race == "Human")
    {
    quest::say("You are a human.");
    }
   else
    {
    quest::say("FOOL! You are a $race not a human!");
    }
  }
}
__________________
namespace retval { template <class T> class ReturnValueGen { private: T x; public: ReturnValueGen() { x = 0; }; T& Generator() { return x; }; }; } int main() { retval::ReturnValueGen<int> retvalue; return retvalue.Generator(); }
C++ is wonderful.
Reply With Quote
  #3  
Old 09-21-2004, 06:57 AM
smogo
Discordant
 
Join Date: Jan 2004
Location: 47
Posts: 339
Default

and preferably use
Code:
"aaa" eq $race
for string compare (eq is better than ==)
__________________
EQEMu Quest Repository is down until something new :(
Reply With Quote
  #4  
Old 09-21-2004, 06:59 AM
Cisyouc
Demi-God
 
Join Date: Jun 2004
Location: Heaven.
Posts: 1,260
Default

Quote:
Originally Posted by smogo
and preferably use
Code:
"aaa" eq $race
for string compare (eq is better than ==)
Hmm. Ive never gotten eq to work BUT I have gotten == to work with race >.&lt;
__________________
namespace retval { template <class T> class ReturnValueGen { private: T x; public: ReturnValueGen() { x = 0; }; T& Generator() { return x; }; }; } int main() { retval::ReturnValueGen<int> retvalue; return retvalue.Generator(); }
C++ is wonderful.
Reply With Quote
  #5  
Old 09-21-2004, 07:06 AM
Magoth78
Discordant
 
Join Date: Jun 2003
Posts: 345
Default

Hello Cisyouc and thanks for your answer. I've tried your script but it always returns me 'Your are a human' even if I m an other race (just tested whit a dark elf)
Reply With Quote
  #6  
Old 09-21-2004, 07:08 AM
Cisyouc
Demi-God
 
Join Date: Jun 2004
Location: Heaven.
Posts: 1,260
Default

Quote:
Originally Posted by Magoth78
Hello Cisyouc and thanks for your answer. I've tried your script but it always returns me 'Your are a human' even if I m an other race (just tested whit a dark elf)
Code:
sub EVENT_SAY 
{ 
if($text~/hail/i) 
  { 
  $xrace = ($race);
  if($xrace == "Human") 
    { 
    quest::say("You are a human."); 
    } 
   else 
    { 
    quest::say("FOOL! You are a $xrace not a human!"); 
    } 
  } 
}
Dont know if this will improve anything but try this?
__________________
namespace retval { template <class T> class ReturnValueGen { private: T x; public: ReturnValueGen() { x = 0; }; T& Generator() { return x; }; }; } int main() { retval::ReturnValueGen<int> retvalue; return retvalue.Generator(); }
C++ is wonderful.
Reply With Quote
  #7  
Old 09-21-2004, 07:10 AM
Magoth78
Discordant
 
Join Date: Jun 2003
Posts: 345
Default

Neither, but i've just got it to work. (tried eq as smogo said)

Here's my modified code:

Code:
sub EVENT_SAY
{
if($text=~/hail/i)
  {
  if($race eq Human)
    {
    quest::say("You are a human.");
    }
   else
    {
    quest::say("FOOL! You are a $race not a human!");
    }
  }
}
Now i'm gonna try whit composed name, like Dark Elf, Half Elf etc..
Reply With Quote
  #8  
Old 09-21-2004, 07:11 AM
Cisyouc
Demi-God
 
Join Date: Jun 2004
Location: Heaven.
Posts: 1,260
Default

Quote:
Originally Posted by Magoth78
Neither, but i've just got it to work. (tried eq as smogo said)

Here's my modified code:

Code:
sub EVENT_SAY
{
if($text=~/hail/i)
  {
  if($race eq Human)
    {
    quest::say("You are a human.");
    }
   else
    {
    quest::say("FOOL! You are a $race not a human!");
    }
  }
}
Now i'm gonna try whit composed name, like Dark Elf, Half Elf etc..
Hm. Fascinating.
__________________
namespace retval { template <class T> class ReturnValueGen { private: T x; public: ReturnValueGen() { x = 0; }; T& Generator() { return x; }; }; } int main() { retval::ReturnValueGen<int> retvalue; return retvalue.Generator(); }
C++ is wonderful.
Reply With Quote
  #9  
Old 09-21-2004, 07:20 AM
Magoth78
Discordant
 
Join Date: Jun 2003
Posts: 345
Default

Ok, now for Dark Elf (example).

Here is the code:
Code:
sub EVENT_SAY
{
if($text=~/hail/i)
  {
  if($race eq Human)
    {
    quest::say("You are a Human.");
    }
  if($race eq Dark Elf)
    {
    quest::say("You are a Dark Elf.");
    }
   else
    {
    quest::say("FOOL! You are a $race not a human or a dark elf!");
    }
  }
}
Nothing happens when I hail the npc.
The error in the zone.exe is:
Message: Hail, evil side representant
[Status] Script error: qst76::EVENT_SAY - Perl runtime error: Can't locate object method "Dark" via package "Elf" (perhaps you forgot to load "Elf"?) at (eval 29) line 9.

Now, let's try
Code:
 if ($race eq Dark_Elf)
I hail the npc (I'm a dark elf), he answers me: "FOOL! You are a Dark Elf not a human or a dark elf!"

Sigh... now, let's try
Code:
 if ($race eq "Dark Elf")
And yeh, it works..

Thanks for the help guys,
Mag
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:11 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