Log in

View Full Version : default.pl


jenniferrose
10-11-2004, 03:28 AM
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

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

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

$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.

Malignus Wingnut
10-11-2004, 04:32 AM
Well the syntax of your quest is ok, however you dont have your default.pl located in the correct directory.

Default.pl should ALWAYS stay in C:\eqemu\quests
Plugin.pl should ALWAYS stay in C:\eqemu

Question:

Are you trying to make EVERY mob in the zone respond with "why hello there mister!" when you hail them or just one?

If you're just trying to make the one npc respond:

Make certain that the name of your quest file (1234.pl) Matches the NPCID of the npc you are applying it to. You can find NPCIDs by using EQEmu admin tool (easiest).

If you're trying to make ALL mobs in zone respond:

Create a new quest file, put in your quest text, and save this file as default.pl into your quests\qeynos directory.

NOTE:: Do NOT get THIS default.pl mixed up with the default.pl in your C:\eqemu\quests directory.

That should do it.

jenniferrose
10-11-2004, 02:38 PM
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

sry about that, i should of worded it a little better, i can make each npc respond with a single quest named the NPCID.pl , but my zonewide npc quest default.pl isnt working for any mobs.

Are you trying to make EVERY mob in the zone respond with "why hello there mister!" when you hail them or just one?

Yes. Trying to make Every mob in the zone respond to my default.pl file made up of a simple "hello there mister!" script.
Code:
sub EVENT_SAY
{
if ($text=~ /Hail/i){quest::say("Why hello there mister!");}
} [/quote]

Malignus Wingnut
10-11-2004, 03:04 PM
*shrug* It may just be the version of eqemu you are using. 5.9 DR2 is very buggy when it comes to perl.

Look at zone.exe to make sure your perl file is compiling correctly, that there are no errors.

jenniferrose
10-11-2004, 03:34 PM
im using 5.9 DR1 and the zone exe has no errors,
Status Loading Embedded perl
Status Loading Perlemb plugins.
Status entering sleep mode.

gonna mess with it a bit more, maybe my code is off or something. thanks for the replies :)

Malignus Wingnut
10-11-2004, 04:14 PM
I should have worded my response differently.

Try running EQ in windowed mode so you can see the zone.exe as well as eq. Go to north qeynos and hail an NPC...zone.exe should try to compile the default.pl filie in your quests\qeynos directory. If it has no errors it should only take a few second and you should be able to hail the npc and get the response. sometimes it takes as much as 15 seconds for zone.exe to finish depending on if you're trying to play from the same box as you're hosting.

If there IS an error, it will show up in the zone.exe window (this is why you have eq in windowed mode)

jenniferrose
10-13-2004, 10:09 AM
I don't get any errors, it just shows me saying Hail Hail Hail.
i switched the binaries to the 5.9DR2 and now none of the qeusts work. Does the perl quest system work with dr2?

Malignus Wingnut
10-13-2004, 11:00 AM
kinda...its really really buggy

Sakrateri
10-14-2004, 02:39 AM
cant do a zonewide , I have tried for a millenium to get it to work , best you can do is instead of putting the deafault.pl into a eqemu\quests\zone folder just put it in the eqemu\quests folder then all the mobs will be using that one default.pl works for me anyway and no clue why a default.pl wont work in each zone folder , wish i knew.

jenniferrose
10-28-2004, 01:16 PM
anyone figure out the zonewide default.pl ? i got the individual quests going and the serverwide default.pl is good. still no zonewide :(