I have been searching the boards for days now on using the default.pl for quests. I can make the quests work by assigning each npc its own 1234.pl file, but the default.pl doesnt want to work for me. im using the simple hail quest for the default.pl located in the eqemu/quests/qeynos/default.pl
Code:
sub EVENT_SAY
{
if ($text=~ /Hail/i){quest::say("Why hello there mister!");}
}
this is the default.pl located in my eqemu/quests/default.pl
Code:
sub EVENT_SAY{
$plugin::debug && quest::say("[debug]in qstdefault::EVENT_SAY");
#plugin::showvars();
plugin::dispatch();
}
sub EVENT_ITEM{
plugin::dispatch();
}
sub EVENT_DEATH{
plugin::dispatch();
}
sub EVENT_ATTACK{
plugin::dispatch();
}
sub EVENT_SPAWN{
plugin::dispatch();
}
sub EVENT_TIMER{
plugin::dispatch();
}
sub EVENT_SLAY{
plugin::dispatch();
}
sub EVENT_WAYPOINT{
plugin::dispatch();
}
and individual quests in the eqemu/quests/qeynos/1234.pl
here is my plugin.pl
Code:
$SERVER="Jennies";
$version="5.9";
#this is the main controller routine for default quests
sub dispatch{
my($pack, $filename, $line, $subr, $has_args, $want_array)=caller(1);
#$debug && quest::say("[debug]in dispatch");
#$debug && quest::say("[debug] package : $pack");
#$debug && quest::say("[debug] subroutine : $subr");
#get all variables in caller's scope
# first, we want to cleanup what was set by previous call
undef $job;
undef $interest;
undef $guild;
undef $mrace;
#$debug=0;
no strict 'refs';
my $package;
($package=$subr) =~ s/::\w+// ;
my $stash = *{$package . '::'}{HASH};
my $n;
foreach $n (keys %$stash) {
my $fullname = $package . '::' . $n;
if( defined $$fullname){
$$n=${$fullname};
#uncomment to get report of what is available
#quest::say("$n -> $$n (eqiv to $fullname)\n");
}
}
#$debug && quest::say("checking event");
#this looks for the correct routine to use, based on l=globals and event type
if(defined $subr){
my $event;
if($subr =~ /EVENT_SAY/) { $event="say";}
if($subr =~ /EVENT_SLAY/) { $event="slay";}
if($subr =~ /EVENT_DEATH/) { $event="death";}
if($subr =~ /EVENT_SPAWN/) { $event="spawn";}
if($subr =~ /EVENT_ITEM/) { $event="item";}
if($subr =~ /EVENT_ATTACK/) { $event="attack";}
if($subr =~ /EVENT_WAYPOINT/) { $event="waypoint";}
#now lookup the routine, and return after first match.
#the following assumes npc have a $job, $mrace and $guild global
# This is where precedence takes place :
# first look for an interest oriented event, then a job oriented match,
# then race dependant, then guild ...
# whatever you set as a global category for the mob
# If guild behaviour is more important (or more specific)
# than race or job, for example, move the line up.
# zone usually comes last, as it allows to reproduce the genuine
# 'default.pl' behavior.
# returning ensures you don't get 2,3 or 4 answers for an event
#$debug && showvars();
defined $interest && defined &{"$interest$event"} && &{"$interest$event"} && return;
defined $job && defined &{"$job$event"} && &{"$job$event"} && return;
defined $mrace && defined &{"$mrace$event"} && &{"$mrace$event"} && return;
defined $guild && defined &{"$guild$event"} && &{"$guild$event"} && return;
#eventually revert to the standard per-zone default.pl
defined &{"$zonesn$event"} && &{"$zonesn$event"} && return;
# we came here if there was no match (i.e. no specific routine
# for that event)
# do nothing then ? or ...
defined &{"default$event"} && &{"default$event"} && &{"default$event"} && return;
}
#we very unlucky to get here
}
sub showvars{
my($pack, $filename, $line, $subr, $has_args, $want_array)=caller(1);
#get all variables in caller's scope
no strict 'refs';
my $package;
($package=$subr) =~ s/::\w+// ;
my $stash = *{$package . '::'}{HASH};
my $n;
foreach $n (sort keys %$stash) {
my $fullname = $package . '::' . $n;
if( defined $$fullname){
$$n=${$fullname};
#uncomment to get report of what is available
quest::say("$n -> $$n (eqiv to $fullname)");
}else{
defined &$fullname && quest::say("function $fullname is defined");
}
}
}
#print "starting plugin for $SERVER\n";
is there something obviously wrong here? if so i apologise, but i tried many different things. any suggestions would be greatly appreciated.