EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Quests (https://www.eqemulator.org/forums/forumdisplay.php?f=624)
-   -   QUest Problems (Help) (https://www.eqemulator.org/forums/showthread.php?t=15652)

Deimos 09-03-2004 02:40 PM

QUest Problems (Help)
 
Hey all, I am having a huge problem with a quest that won't work for some odd reason. Here it is, thx:

#( Zone:potimea ID:219 -- A_Powerful_Rogue )
sub EVENT_SAY {

if(($text=~/hail/i) && ($class == /rogue) && ($ulevel > 64)){

quest::say("The Plane of Time is a dangerous place.
In this plane is the Father of Time himself. We all
call him Father Time. He has a weapon I would really
love to get my hands on and if you are up to it you
could maybe get this [object] I am in need of.");

else if(($text=~/hail/i) && ($class == /rogue) && ($ulevel < 65))

quest::emote("stares at you knowing that you can
server a purpose for her but that you are not yet
powerful enough to do it.");

else

quest::say("I will only speak with those who have chosen
the same path as me. Begone!");
}
if(($text=~/object/i) && ($class == /rogue) && ($ulevel > 64)){

quest::say("This weapon is called the Staff of Flowing
Time and as a Rogue you will have no need for it. I
need it though for that new Thieves Guild. I can't join
it unless I provide it to them to prove my power. I can't
talk Father Time into giving me the staff though. I am
looking for someone to [kill] him. Are you willing?");
}
if(($text=~/willing/i) && ($class == /rogue) && ($ulevel > 64)){

quest::say("I will reward you for bringing me back
his Staff of Flowing Time. It is the One-Handed Blunt
type so make sure you bring me the right one or I am
going to take it for myself. You reward is a special
spear made specifically for a rogue. It can only be
used for rogues. Bring me the staff and I will give
you the spear.");
}
}
sub EVENT_ITEM {

if($itemcount{69250} == 1){

quest::say("Aha! The Staff of Flowing Time! As promissed
here is your spear as promised!");

quest::emote("hands you the spear.");

quest::summonitem(69011);
}
}

#( END of FILE )

Hope someone knows why it wouldn't work =)

animepimp 09-03-2004 02:55 PM

Re: QUest Problems (Help)
 
Quote:

Originally Posted by Deimos
if(($text=~/hail/i) && ($class == /rogue) && ($ulevel > 64)){

quest::say("The Plane of Time is a dangerous place.
In this plane is the Father of Time himself. We all
call him Father Time. He has a weapon I would really
love to get my hands on and if you are up to it you
could maybe get this [object] I am in need of.");

else if(($text=~/hail/i) && ($class == /rogue) && ($ulevel < 65))

quest::emote("stares at you knowing that you can
server a purpose for her but that you are not yet
powerful enough to do it.");

else

quest::say("I will only speak with those who have chosen
the same path as me. Begone!");
}

Its probably becaise you are missing a few {}s here. The elsif and else are insdie the if so the elses have no if to match with which causes problems. Put { after each if or else and } at the end of the code for every one also. And next time you should say what happens when you try it, like what zone.exe says because that'll tell you what is wrong in most cases.

Charmy 09-03-2004 05:05 PM

Well one of the main problems is how your checking class

Code:

($class == /rogue)
i am guessing your trying to do somthing similar to if($text~= /hail/) and using the / becuase of that.

but actually since your only checking the actual value of the vairable $class, you don't need the / char. and actually its even better to use the text operators to check it instead of the numberical ones.

e.g.
Code:

if($class eq "Rogue")
So this will check their class and if it eq (equals) the string "Rogue" then its true.

Other than that as AP said check your bracket count make sure that you don't have more { than } and make sure that they are all contained in the correct code blocks, otherwise you will get events going off when you don't want them too.

one thing i think AP said it but not sure, this isn't like BASIC, you need to close a code block before and else statment is produced.

e.g.
Code:

if($var1 == 1)
  {
  do this
  }
elsif ($var1 == 2)
  {
  do this
  }
else
  {
  do this
  }

Another thing about perl, you CANNOT use else if, it doesn't compile, you must use the perl term elsif (only one 'E' and no spaces). Add all this into it and it should compile correctly and execute.

since your using perl you can just open a command prompt, naviagte to your eqemu quests directory and (ex. C:\EQEMu\quests\tutorial for tutorial zone) and type at the command prompt

Code:

>perl 23.pl
for quest on mob number 23, and it will try to compile, if you get any errors it will tell you what they are and where to fix them, if it doesn't give you any output period it means it compiled correctly and is ready to use =)

Deimos 09-04-2004 10:29 AM

Tx guys, I fixed the brackets already, but I am going to try the other things, thx. And I dont code in basic, I code in C# and C++, tx

sotonin 09-04-2004 12:38 PM

perl isnt basic. perl is perl.

Deimos 09-04-2004 02:13 PM

Hey everyone, the solutions didn't quite work out...
this is what I have now.......
Code:

#Zone:
#Short Name: potimea
#Long Name: Plane of Time A
#Zone ID:219

#NPC:
#NPC Name: A Powerful Rogue
#NPC ID: 281268

#-----------------------------------------------------------------------------------
sub EVENT_SAY
{
        #HAILING HAILING HAILING HAILING HAILING HAILING HAILING HAILING HAILING HAILING
        if(($text=~/hail/i) && ($class eq "Rogue") && ($ulevel > 64))
        {
                {
                quest::say("The Plane of Time is a dangerous place.
                In this plane is the Father of Time himself. We all
                call him Father Time. He has a weapon I would really
                love to get my hands on and if you are up to it you
                could maybe get this [object] I am in need of.");       
                }
        elsif(($text=~/hail/i) && ($class eq "Rogue") && ($ulevel < 65))
                {
                quest::emote("stares at you knowing that you can
                server a purpose for her but that you are not yet
                powerful enough to do it.");
                }
  else
                {
                quest::say("I will only speak with those who have chosen
                the same path as me. Begone!");
                }
        }
        #OBJECT OBJECT OBJECT OBJECT OBJECT OBJECT OBJECT OBJECT OBJECT OBJECT OBJECT OBJECT
        if(($text=~/object/i) && ($class eq "Rogue") && ($ulevel > 64))
        {
                quest::say("This weapon is called the Staff of Flowing
                Time and as a Rogue you will have no need for it. I
                need it though for that new Thieves Guild. I can't join
                it unless I provide it to them to prove my power. I can't
                talk Father Time into giving me the staff though. I am
                looking for someone to [kill] him. Are you willing?");
        }
        #KILL KILL KILL KILL KILL KILL KILL KILL KILL KILL KILL KILL KILL KILL KILL KILL KILL
        if(($text=~/kill/i) && ($class eq "Rogue") && ($ulevel > 64))
        {
                quest::say("I will reward you for bringing me back
                his Staff of Flowing Time. It is the One-Handed Blunt
                type so make sure you bring me the right one or I am
                going to take it for myself. You reward is a special
                spear made specifically for a rogue. It can only be
                used for rogues. Bring me the staff and I will give
                you the spear.");
        }
}

sub EVENT_ITEM {

        if($itemcount{69250} == 1)
        {

                quest::say("Aha! The Staff of Flowing Time! As promissed
                here is your spear as promised!");

                quest::emote("hands you the spear.");

                quest::summonitem(69011);
        }
}

#( END of FILE )

pwz help, lol

m0oni9 09-04-2004 02:43 PM

Pay closer attention to where you are putting your brackets. Look at Charmy's example above. Also, you might want to try something like this to eliminate duplicate code (untested):

Code:

if ($text =~ /hail/i)
{
  if ($class eq "Rogue")
  {
      if ($ulevel > 64)
      {
        quest::say ("you're over 64!");
      }
      else
      {
        quest::say ("you're not over 64!");
      }
  }
  else
  {
      quest::say ("begone! you're not a rogue!");
  }
}

Also, if you do not know what is causing a problem with your perl, run it with perl, rather than through the emu!

Richardo 09-04-2004 03:07 PM

Ok I took a look at your quest and I dont get any compile errors with this format.. May work, may not...

Code:

sub EVENT_SAY
{
if(($text=~/hail/i) && ($class eq "Rogue") && ($ulevel > 64))
{
quest::say("The Plane of Time is a dangerous place.
In this plane is the Father of Time himself. We all
call him Father Time. He has a weapon I would really
love to get my hands on and if you are up to it you
could maybe get this [object] I am in need of.");       
}
elsif(($text=~/hail/i) && ($class eq "Rogue") && ($ulevel < 65))
{
quest::emote("stares at you knowing that you can
server a purpose for her but that you are not yet
powerful enough to do it.");
}
else
{
quest::say("I will only speak with those who have chosen
the same path as me. Begone!");
}
}

if(($text=~/object/i) && ($class eq "Rogue") && ($ulevel > 64))
{
quest::say("This weapon is called the Staff of Flowing
Time and as a Rogue you will have no need for it. I
need it though for that new Thieves Guild. I can't join
talk Father Time into giving me the staff though. I am
looking for someone to [kill] him. Are you willing?");
}


if(($text=~/kill/i) && ($class eq "Rogue") && ($ulevel > 64))
{
quest::say("I will reward you for bringing me back
his Staff of Flowing Time. It is the One-Handed Blunt
type so make sure you bring me the right one or I am
going to take it for myself. Your reward is a special
spear made specifically for a rogue. It can only be
used for rogues. Bring me the staff and I will give
you the spear.");
}

sub EVENT_ITEM
{

if($itemcount{69250} == 1)
{

quest::say("Aha! The Staff of Flowing Time! As promissed
here is your spear!");

quest::emote("hands you the spear.");

quest::summonitem(69011);
}


Cisyouc 09-04-2004 03:34 PM

Quote:

Originally Posted by Lexen1
Ok I took a look at your quest and I dont get any compile errors with this format.. May work, may not...

Code:

sub EVENT_SAY
{
if(($text=~/hail/i) && ($class eq "Rogue") && ($ulevel > 64))
{
quest::say("The Plane of Time is a dangerous place.
In this plane is the Father of Time himself. We all
call him Father Time. He has a weapon I would really
love to get my hands on and if you are up to it you
could maybe get this [object] I am in need of.");       
}
elsif(($text=~/hail/i) && ($class eq "Rogue") && ($ulevel < 65))
{
quest::emote("stares at you knowing that you can
server a purpose for her but that you are not yet
powerful enough to do it.");
}
else
{
quest::say("I will only speak with those who have chosen
the same path as me. Begone!");
}
}

if(($text=~/object/i) && ($class eq "Rogue") && ($ulevel > 64))
{
quest::say("This weapon is called the Staff of Flowing
Time and as a Rogue you will have no need for it. I
need it though for that new Thieves Guild. I can't join
talk Father Time into giving me the staff though. I am
looking for someone to [kill] him. Are you willing?");
}


if(($text=~/kill/i) && ($class eq "Rogue") && ($ulevel > 64))
{
quest::say("I will reward you for bringing me back
his Staff of Flowing Time. It is the One-Handed Blunt
type so make sure you bring me the right one or I am
going to take it for myself. Your reward is a special
spear made specifically for a rogue. It can only be
used for rogues. Bring me the staff and I will give
you the spear.");
}

sub EVENT_ITEM
{

if($itemcount{69250} == 1)
{

quest::say("Aha! The Staff of Flowing Time! As promissed
here is your spear!");

quest::emote("hands you the spear.");

quest::summonitem(69011);
}


whats this 'eq'? isnt it '=='?

Also instead of using:
Code:

sub EVENT_SAY
{
if(($text=~/hail/i) && ($ulevel >= 64))
  {
  quest::say("");
  }
}

TRY:
Code:

sub EVENT_SAY
{
if($text=~/hail/i)
  {
  if($ulevel >= 64)
    {
    if($class == "Rogue")
      {
      quest::say("");
      }
    }
  }
}


Deimos 09-04-2004 04:57 PM

I think it should work now, I can't wait to test it. I do not own my own server and can't install PERL, so I can't test it until other guy comes on =D. This is now what it looks like =).

Code:

###################################
#Zone:                                                                                                  #
#Short Name: potimea                                                                #
#Long Name: Plane of Time A                                                #
#Zone ID:219                                                                                  #
###################################
#NPC:                                                                                                    #
#NPC Name: A Powerful Rogue                                              #
#NPC ID: 281268                                                                            #
###################################
sub EVENT_SAY
{
        ###############################################################
        if($text=~/hail/i)
        {
                if($class == "Rogue")
                {
                        if($ulevel > 64)
                                {
                                quest::say("The Plane of Time is a dangerous place.
                                In this plane is the Father of Time himself. We all
                                call him Father Time. He has a weapon I would really
                                love to get my hands on and if you are up to it you
                                could maybe get this [object] I am in need of.");
                                }
                else
                        {
                        quest::emote("stares at you knowing that you can
                        server a purpose for her but that you are not yet
                        powerful enough to do it.");
                        }
                }
        else
                {
                quest::say("I will only speak with those who have chosen
                the same path as me. Begone!");
                }
        }
        ###############################################################
        if($text=~/object/i)
        {
                if($class == "Rogue")
                {
                        if($ulevel > 64)
                        {
                        quest::say("This weapon is called the Staff of Flowing
                        Time and as a Rogue you will have no need for it. I
                        need it though for that new Thieves Guild. I can't join
                        it unless I provide it to them to prove my power. I can't
                        talk Father Time into giving me the staff though. I am
                        looking for someone to [kill] him. Are you willing?");
                        }
                }
        }
        ###############################################################
        if($text=~/kill/i)
        {
                if($class == "Rogue")
                {
                        if($ulevel > 64)
                        {
                        quest::say("I will reward you for bringing me back
                        his Staff of Flowing Time. It is the One-Handed Blunt
                        type so make sure you bring me the right one or I am
                        going to take it for myself. Your reward is a special
                        spear made specifically for a rogue. It can only be
                        used for rogues. Bring me the staff and I will give
                        you the spear.");
                        }
                }
        }
}

sub EVENT_ITEM
{
        ###############################################################
        if($itemcount{69250} == 1)
        {

                quest::say("Aha! The Staff of Flowing Time! As promissed
                here is your spear!");

                quest::emote("hands you the spear.");

                quest::summonitem(69011);
        }
}

#( END of FILE )


Charmy 09-04-2004 05:48 PM

Cisyouc == is a numerical operator, it isn't good programming practice to use it when operating with strings, when you use the == it can have a similar effect as using atoi in C++ in which it turns a string into a number, this can, although not very often, cause errors if you have a complex script.

when working with strings you should always use the string comparison operators.

eq equals
ne not equals

From http://www-cgi.cs.cmu.edu
Quote:

eq
String equality (== is numeric equality). For a mnemonic just think of "eq" as a string. (If you are used to the awk behavior of using == for either string or numeric equality based on the current form of the comparands, beware! You must be explicit here.)
two basic ones, there is a greater than and less than, but i don't see much use for them in these types of quests.

perl is a rather loose language and as such you won't get compilation errors when using == but as i said, it can cause errors in complex scripts, and as such you should use eq over ==.

Cisyouc 09-04-2004 06:25 PM

Quote:

Originally Posted by Charmy
Cisyouc == is a numerical operator, it isn't good programming practice to use it when operating with strings, when you use the == it can have a similar effect as using atoi in C++ in which it turns a string into a number, this can, although not very often, cause errors if you have a complex script.

Ah, very well then. Thanks for the clarification. :D

smogo 09-05-2004 01:03 AM

Quote:

perl is a rather loose language and as such you won't get compilation errors
No, perl is not loose :)

It makes perfect sense to write $string1==$string2, it means 'are they the same scalar object ?' , that's why you get no error.

Testing string for equalty requires the eq operator
Testing for identity requires ==


***edit ***
if what's above is not clear, it means if you want to know if two string have the same value, use eq

just my 2 coppers ;)

Charmy 09-05-2004 11:52 AM

I can't argue with smogo on the equality operators, i learned that you should always use the text comparison operators when working with strings but <shrug>, but smogo knows more about perl than i will probably ever know., however i still stand by the fact that perl is 'loose' =P you don't have to define variable types, arrays and hashes can be filled with int, chars, strings all in the same array, unlike many other C languages. I am not saying its a weak language, infact i think perl is the best you can use for web/networking apps, but it isn't a "strict" language.

Ya?

Deimos 09-05-2004 02:49 PM

Well, I am not arguing with Smogo either. I tried eq and it didn't work, the last thing I am going to try is ==, then I dont know what to do, hehe. This is what the code is looking like now:

Code:

#########################################
#Zone:                                        #
#Short Name: potimea                        #
#Long Name: Plane of Time A                #
#Zone ID:219                                #
#########################################
#NPC:                                        #
#NPC Name: A Powerful Rogue                #
#NPC ID: 281268                                #
#########################################
sub EVENT_SAY
{
        ###############################################################
        if($text=~/hail/i)
        {
                if($class == "Rogue")
                {
                        if($ulevel > 64)
                                {
                                quest::say("The Plane of Time is a dangerous place.
                                In this plane is the Father of Time himself. We all
                                call him Father Time. He has a weapon I would really
                                love to get my hands on and if you are up to it you
                                could maybe get this [object] I am in need of.");
                                }
                else
                        {
                        quest::emote("stares at you knowing that you can
                        server a purpose for her but that you are not yet
                        powerful enough to do it.");
                        }
                }
        else
                {
                quest::say("I will only speak with those who have chosen
                the same path as me. Begone!");
                }
        }
        ###############################################################
        if($text=~/object/i)
        {
                if($class == "Rogue")
                {
                        if($ulevel > 64)
                        {
                        quest::say("This weapon is called the Staff of Flowing
                        Time and as a Rogue you will have no need for it. I
                        need it though for that new Thieves Guild. I can't join
                        it unless I provide it to them to prove my power. I can't
                        talk Father Time into giving me the staff though. I am
                        looking for someone to [kill] him. Are you willing?");
                        }
                }
        }
        ###############################################################
        if($text=~/kill/i)
        {
                if($class == "Rogue")
                {
                        if($ulevel > 64)
                        {
                        quest::say("I will reward you for bringing me back
                        his Staff of Flowing Time. It is the One-Handed Blunt
                        type so make sure you bring me the right one or I am
                        going to take it for myself. Your reward is a special
                        spear made specifically for a rogue. It can only be
                        used for rogues. Bring me the staff and I will give
                        you the spear.");
                        }
                }
        }
}

sub EVENT_ITEM
{
        ###############################################################
        if($itemcount{69250} == 1)
        {

                quest::say("Aha! The Staff of Flowing Time! As promissed
                here is your spear!");

                quest::emote("hands you the spear.");

                quest::summonitem(69011);
        }
}

#( END of FILE )



All times are GMT -4. The time now is 07:56 AM.

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