EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Please help with this quest (https://www.eqemulator.org/forums/showthread.php?t=37516)

rixcraven 11-13-2013 08:47 PM

Please help with this quest
 
Just a few pointers, where am I going wrong?...
this is the Perl script.

sub EVENT_SPAWN {
quest::settimer("eddie", 30);
if ($zonetime < 700 || $zonetime > 1900) { # its after 7pm and before 8am and its night
quest::spawn_conditions($zonesn, 2,0); #live are 2
quest::spawn_conditions($zonesn, 1,1); #undead are 1
quest::shout ("They only come out at night");
}
else { #its between 8am and 7pm ie daylight
quest::spawn_conditions($zonesn, 2,1); #live are 2
quest::spawn_conditions($zonesn, 1,0); #undead are 1
quest::shout ("The Blessed Sunlight!.. Cleansing our world.");

}

}

sub EVENT_WAYPOINT{
if ($zonetime < 700 || $zonetime > 1900) {
quest::spawn_conditions($zonesn, 2,0); #live are 2
quest::spawn_conditions($zonesn, 1,1); #undead are 1
}
else {
quest::spawn_conditions($zonesn, 2,1); #live are 2
quest::spawn_conditions($zonesn, 1,0); #undead are 1
}
sub EVENT_TIMER
{
#$npc->SetAppearance(1);
if($timer eq "eddie")
{
#my $random_number = int(rand(8));
#if ($random_number == 0 || $random_number == 1 || $random_numer == 2)
{
#$npc->SetAppearance(1);
quest::shout ("I shall return later!");
$npc->Depop(1);
}
}
}
}

The idea is that this npc spawns, checks the zone time, then sets spawn_conditions as applicable.
he then despawns, and begins the cycle again.
I know the timer is short, just for testing, but it doesn't work, he spawns, says nothing, and despawns.
Please advise where I'm going wrong.

joligario 11-13-2013 08:58 PM

Just a quick look yields mismatched brackets.

rixcraven 11-13-2013 09:17 PM

Quote:

Originally Posted by joligario (Post 225935)
Just a quick look yields mismatched brackets.

I followed your advice, and checked it using an online perl checker, it didn't point out any mismatch?.. please tell me where you reckon its wrong.

Kingly_Krab 11-13-2013 09:40 PM

Your sub EVENT_WAYPOINT is wrapped around sub EVENT_TIMER.

P.S. Formatting is sweet when it comes to troubleshooting mismatched or unmatched curly brackets.

Not to do it all for you, but this should work:
Code:

sub EVENT_SPAWN
{
        quest::settimer("eddie", 30);
        if ($zonetime < 700 || $zonetime > 1900)
        { # its after 7pm and before 8am and its night
                quest::spawn_condition($zonesn, 2,0); #live are 2
                quest::spawn_condition($zonesn, 1,1); #undead are 1
                quest::shout ("They only come out at night");
        }
        else
        {        #its between 8am and 7pm ie daylight
                quest::spawn_condition($zonesn, 2,1); #live are 2
                quest::spawn_condition($zonesn, 1,0); #undead are 1
                quest::shout ("The Blessed Sunlight!.. Cleansing our world.");
        }
}

sub EVENT_WAYPOINT
{
        if ($zonetime < 700 || $zonetime > 1900)
        {
                quest::spawn_condition($zonesn, 2,0); #live are 2
                quest::spawn_condition($zonesn, 1,1); #undead are 1
        }
        else
        {       
                quest::spawn_condition($zonesn, 2,1); #live are 2
                quest::spawn_condition($zonesn, 1,0); #undead are 1
        }
}

sub EVENT_TIMER
{
        $npc->SetAppearance(1);
        if($timer eq "eddie")
        {
                my $random_number = quest::ChooseRandom(0, 1, 2, 3, 4, 5, 6, 7, 8);
                if ($random_number == 0 || $random_number == 1 || $random_number == 2)
                {
                        $npc->SetAppearance(1);
                        quest::shout ("I shall return later!");
                        $npc->Depop(1);
                }
        }
}


rixcraven 11-13-2013 11:19 PM

Absolutely Superb,
THANKS Kingly :)

works a dream..
and the overall plan for the quest its part of moves forwards. :)


All times are GMT -4. The time now is 10:01 PM.

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