Log in

View Full Version : Anyone know whats wrong with this?


mrea
10-05-2004, 01:33 PM
Here is the code I'm trying to use:
sub EVENT_SAY
{
{
if ($text=~ /Hail/i) { quest::say("You look like a strong adventurer. Possibly you could take on this [problem] that ails our citizens of late.");}
if ($text=~ /Problem/i) { quest::say("You see, a brooding Dragon is in the sewers of Freeport. I need you to find him and slay him. If you bring me one of his teeth I will reward you greatly.");}
}
if ($item1 == 00001){ quest::say("Ah yes, I heard the screeches. Congratulations $name!");
quest::summonitem("21820");
quest::shout("All praise $name!");}
}
I can get the mob to do the summon item and shout, but only after I hail them after i do the turn in. Obviously thats not what I wanted.

sotonin
10-05-2004, 01:47 PM
You have an extra bracket set around each one. it should be this.

sub EVENT_SAY {
if ($text=~ /Hail/i) {
quest::say("You look like a strong adventurer. Possibly you could take on this [problem] that ails our citizens of late.");
}
if ($text=~ /Problem/i) {
quest::say("You see, a brooding Dragon is in the sewers of Freeport. I need you to find him and slay him. If you bring me one of his teeth I will reward you greatly.");
}
if ($item1 == 00001){
quest::say("Ah yes, I heard the screeches. Congratulations $name!");
quest::summonitem("21820");
quest::shout("All praise $name!");
}
}

Also make sure you have at least 2 blank lines after the entire script.

m0oni9
10-05-2004, 01:51 PM
Relocate your if($item ...) block to a new sub, EVENT_ITEM.
sub EVENT_SAY
{
if [text x] then do action y
etc.
}

sub EVENT_ITEM
{
if [item x] then do action y
etc.
}
Probably the $item variable is getting pushed to your script when it attempts to run EVENT_ITEM, but since the sub does not exist, there is no effect, other than assigning the variable a value inside the module. Upon the next hail, EVENT_SAY is triggered again, and the $item variable now has the expected value assigned.

sotonin
10-05-2004, 01:55 PM
oh duh. lmfao i didnt even notice he didnt make an event_item sub...

/me makes retard motion with hand. durrrrrrh

mrea
10-05-2004, 01:57 PM
I'm just starting but even I should know that lol, thanks both of you though (this isn't my first) shocking isn't it?! :D