EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Quests (https://www.eqemulator.org/forums/forumdisplay.php?f=624)
-   -   $race related (https://www.eqemulator.org/forums/showthread.php?t=15966)

Magoth78 09-21-2004 05:48 AM

$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

Cisyouc 09-21-2004 06:55 AM

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!");
    }
  }
}


smogo 09-21-2004 06:57 AM

and preferably use
Code:

"aaa" eq $race
for string compare (eq is better than ==)

Cisyouc 09-21-2004 06:59 AM

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 >.<

Magoth78 09-21-2004 07:06 AM

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)

Cisyouc 09-21-2004 07:08 AM

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?

Magoth78 09-21-2004 07:10 AM

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..

Cisyouc 09-21-2004 07:11 AM

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.

Magoth78 09-21-2004 07:20 AM

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


All times are GMT -4. The time now is 02:26 PM.

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