PDA

View Full Version : first quest...


x-scythe
05-28-2004, 11:03 AM
sub EVENT_SAY
{
if($text~=/Hail/i){quest::say("Why hello there $name! My name is
Triton. I used to be the most famed metal shaper in all the lands.
That is, until I lost my [Blue Jade Shard].");}
if($text~=/blue jade shard/i){quest::say("Yes, it created a powerfulsubstance which I added to everything I crafted. Without it...I ama doomed man...would you go and [retrieve] it for me? You would behighly rewarded of course.");}

if($text~=/retrieve/i){quest::say("Really?! Well...let me tell you
where it is then you can decide if you really want to go get it for me.
Let me tell you a [story].");}

if($text~=/story/i){quest::emote("Triton takes a deep breath and
begins his story");
quest::say("A few weeks ago I was traveling in a vast cave that wasinhabited by kobolds, or so I thought it was. I was looking for a newtype of metal that may increase the strength of my armors even more.As I traveled deeper and deeper, I began to see a change in the texture of the cave. I didn't think anything of it at the time, until the cave suddenly expanded above my head and it appeared to have been carved out into a passageway. Me, being curious, traveled deeper still. Thats when I ran into the Fire Giants. I snuck past them and went deeper into the fire giant layer. Then I saw it, like nothing else I'd ever encountered. A fire dragon. I thought since I has hidden the dragon wouldn't be able to see me, boy was I wrong. It raised its wings and blew a huge fire ball in my direction, I was so scared I ran out of the cavern and by the time I was finally above ground again I realized I had left my blue jade shard behind the dragon where I was hiding. So, knowing you will have to get past giants and slay a dragon, are you still willing to go on this quest for me?");}

if($text~=/yes/i)quest::say("Wow! Thank you! You will be GREATLY rewarded, this I promise you. The entrance to the cavern is in the Lavastorm Mountains on a narrow rock ledge on the side of a great crater filled with lava. Good luck!");}
}
sub EVENT_ITEM
{
if($item1==xxxx){quest::say("WOW! THANK YOU! YOU'VE RETURNED IT TO ME! HERE IS THE REWARD I PROMISED YOU!");
quest::summonitem(xxxx);
quest::exp(1000);
}



aight thats it...i had some questions tho as to if i did things right, this is my first quest like the subject says so it might not be %100 great...

when you turn in an item to finish the quest is this the proper code?

{ if($item1==xxxx)


any input would be greatly appreciated

EDIT: forgot to mention i purposely left the item# as "xxxx" since i do not run a server of my own and the item does not exist hehe

Dave987
05-28-2004, 11:25 AM
It's better to use itemcount

if ((itemcount{xxxx} == 2))

That makes it so that the item can be turned in with any slot , only really useful for multi-turn in items, if the quest is only with 1 item to and in, then if ($item 1) is fine.

Nice first quest, keep it up!

x-scythe
05-28-2004, 11:28 AM
thanks for the input. i was wondering about the itemcount command but i wasnt sure how to use it
i do have one question about it tho...why does it use double parenthesis?

animepimp
05-28-2004, 02:17 PM
The only problem I see with your quest is that some of the quest::says are way too long. Each one should be only one sentence, possibly two at most. They can cause problems if they are too long. Just break each one up into multiple quest::says and it will be a lot better. And for your question about parenthesis, it doesn't have to use double ones, thats probably just his coding style and in this case completely unnecessary.

Swampdog
05-28-2004, 04:35 PM
The only problem I see with your quest is that some of the quest::says are way too long. Each one should be only one sentence, possibly two at most. They can cause problems if they are too long. Just break each one up into multiple quest::says and it will be a lot better.

I don't necessarilly agree that they need to be one or two sentences, but agree it needs to be chunked out. You need to keep in mind there is a buffer for says. This seems to hold true with what NPCs say as well. Maybe one of the eqemu devs can comment on how long it can be. I've found that I can have around 5 or 6 lines of text in a single quest::say without the server bombing out with a buffer error. Probably best to keep it at 4 lines (by lines I'm talking about notepad open fullscreen on a 1024x768 monitor with wordwrap on..) Again, I wouldn't hold this as gospel, but my personal feeling is breaking it down by sentence takes away from the output... And again, that is only my personal preference. :D

I think you did good for your first quest.. Quickly skimming it, the large say was the only thing I noticed potentially wrong with it. :wink:

m0oni9
05-28-2004, 06:54 PM
After all the parsing is done it looks like max chars would be 999.

cofruben
05-28-2004, 08:33 PM
I think if($text~=/Hail/i){ should be if($text=~/Hail/i){,not sure but try it,it is =~,not ~=.

Swampdog
05-29-2004, 04:04 AM
Ahh.. You are right cofruben.. I missed that. I keep meaning to throw a comment on the how-to for the perl quests. The one has a lot of them backwards like that in the examples. I made the same mistake with my first quests... :P

x-scythe
05-29-2004, 11:55 AM
thanks for all the input. ill keep in mind to make the says shorter and change the ~= to =~

Dave987
05-30-2004, 10:46 AM
And for your question about parenthesis, it doesn't have to use double ones, thats probably just his coding style and in this case completely unnecessary.

Yep , whenever I do a calculation , such as if ($itemcount{xx} == 2 ) && ($itemcount{xy} == 1) I always write it like:

((($itemcount{xx} == 2 )) && (($itemcount{xy} == 1)))

Just the way I write . :wink:

Charmy
05-31-2004, 05:21 PM
((($itemcount{xx} == 2 )) && (($itemcount{xy} == 1)))


You will notice if you use the parentesis like you have them you will actually see if you turn in item XX without item xy the quest will still execute becuase you have the item XX closing out before the && and it won't need to check, if you however only hand in xy it won't work without XX.


sub EVENT_ITEM
{
if(($itemcount{xx} && $itemcount{xy} ==1))
{
quest::say("Joly Good.");
}
}


this will make sure that both item XX and XY are turned in and only 1 of each is turned in. one thing that i have added to all my quests, (hopefully over on EQA we will get global scripts working sooner than later.) but in every script i write after any item turnin i always add.


sub EVENT_ITEM
{
if(($itemcount{xx} && $itemcount{xy} ==1))
{
quest::say("Joly Good.");
}
else
{
NoNeed();
}
}

sub NoNeed
{
quest::say("I don't need this item $name, you can have it back.");
if($item1 != "" )
{
quest::summonitem($item1,0);
}
if($item2 != "" )
{
quest::summonitem($item2,0);
}
if($item3 != "" )
{
quest::summonitem($item3,0);
}
if($item4 != "" )
{
quest::summonitem($item4,0);
}
}


Note that the NoNeed sub is not in all my scripts, right now i just include the code in the else command, or if the mob doesn't take turn-ins for quests i just put it under the EVENT_ITEM sub, however as soon as our server starts working correctly with "gaggle" scripts then you can put the NoNeed sub in your "gaggle" script and then call it each time. anyway just wanted to add that.



if($text~=/yes/i)quest::say("Wow! Thank you! You will be GREATLY rewarded, this I promise you. The entrance to the cavern is in the Lavastorm Mountains on a narrow rock ledge on the side of a great crater filled with lava. Good luck!");}


Missing Curly ended bracket after if($text=~/yes/i). won't compile so you should catch this upon trying to run it, but thats one thing i noticed. dunno if anyone else posted about it i am to tired to look. anyway. good luck with the quests =).

Dave987
06-01-2004, 03:27 AM
I like that NoNeed idea, and looking at the time I posted that, I was damn tired ... give me a break :(

Heh ... anywho ..

m0oni9
06-01-2004, 04:11 AM
Note that the NoNeed sub is not in all my scripts...

I have not tried this, but it seems like you would be able to put this elsewhere and call it. For example, in the default script:

sub NoNeed {
...
}

Then call it from another script:

else {
qstdefault::NoNeed ();
}

Again, not tried it out, but seems like it could work.. takers? :)