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 =) |
Re: QUest Problems (Help)
Quote:
|
Well one of the main problems is how your checking class
Code:
($class == /rogue) 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") 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) 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 |
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
|
perl isnt basic. perl is perl.
|
Hey everyone, the solutions didn't quite work out...
this is what I have now....... Code:
#Zone: |
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) |
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 |
Quote:
Also instead of using: Code:
sub EVENT_SAY Code:
sub EVENT_SAY |
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:
################################### |
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:
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 ==. |
Quote:
|
Quote:
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 ;) |
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? |
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:
######################################### |
All times are GMT -4. The time now is 07:56 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.