Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::Windows Servers

Support::Windows Servers Support forum for Windows EQEMu users.

Reply
 
Thread Tools Display Modes
  #1  
Old 12-28-2012, 02:53 PM
Hateborne
Hill Giant
 
Join Date: May 2010
Posts: 125
Default Logging Stopping?

I am experimenting with things on a local test environment. I can log in, interact, do normal things, etc etc. What I cannot do is get the logging to continually work. The logging stops after the first error or a ~50 new lines in the zone_* logfile.

Is there some painfully obvious missed step or something specific that is required to get quest logging to stay running?

I am trying to debug quest scripts but with logging stopping after a singular error or ~50 lines, I am forced to restart server to test each new script change (instead of just #reloadquest). As you can imagine, it's slow and cumbersome this way.

Any tips?


-Hate
Reply With Quote
  #2  
Old 12-28-2012, 03:41 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,490
Default

How are you testing? What logging method are you talking about? Are you inserting log file entries into the code and then compiling?
Reply With Quote
  #3  
Old 12-28-2012, 03:46 PM
Hateborne
Hill Giant
 
Join Date: May 2010
Posts: 125
Default

Apologies. The basic logging that seems to occur by default. Goes into the "logs" directory with a variety of file names.

I was trying to watch for the errors spit out in the zone_*.log files about the quest script.

I have not done anything to the code other than the DivineSave change listed in the SpellSupport section.


-Hate
Reply With Quote
  #4  
Old 12-28-2012, 04:05 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,490
Default

If the error logs are stopping, perhaps a disk issue. If you are testing perl scripts, you can also use shouts/says/etc. if you can't get logs to work.
Reply With Quote
  #5  
Old 12-28-2012, 05:27 PM
sorvani
Dragon
 
Join Date: May 2010
Posts: 966
Default

Testing Quest Scripts 101:

#1 open a command prompt and type: perl -c somescriptname.pl
#2 If errors, fix them, go back to #1. If no errors go to #3
#3 The script compiles fine but is not acting as expected. Add in quest::shout("some message"); at various points in the routines to output what is happening.
#4 based on the shouts, edit your script. do not forget to #reloadpl 1 in game.
# Go to #1
Reply With Quote
  #6  
Old 12-28-2012, 05:59 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

Quote:
Originally Posted by sorvani View Post
Testing Quest Scripts 101:

#1 open a command prompt and type: perl -c somescriptname.pl
#2 If errors, fix them, go back to #1. If no errors go to #3
#3 The script compiles fine but is not acting as expected. Add in quest::shout("some message"); at various points in the routines to output what is happening.
#4 based on the shouts, edit your script. do not forget to #reloadpl 1 in game.
# Go to #1
agreed.

and if you're going to write complex scripts on a regular basis, i'd recommend learning to write subroutines and classes which behave as the interfaces found embedded in the server do. the classes don't have to be completely mirrored. just give them the methods you need for testing. it may seem like a daunting task, but you'll learn a hell of a lot about perl and the server while putting it all together. eventually, you won't need to have access to a running server to develop your scripts.

example with timers and entity variables roughly emulated:

Code:
use 5.012;
# NOTE: the following two modules allow the emulation of quest timers
#       and they are not part of the standard perl installation
use EV;
use AnyEvent;

# emulate EVENT_ITEM()
sub EVENT_ITEM 
{
    # NOTE: calls to plugin::check_handin() are done here in production quests
    #       but for now, assume correct items were turned in
    if (1) {
        # define global fuse array reference
        our $fuse = [
            ('--' x  1).'x',
            ('--' x  5).'x',
            ('--' x  9).'x',
            ('--' x 13).'x'
        ];
        # emulate $ent->SetEntityVariable(1, 3);
        SetEntityVariable(1, 3);
        # emulate $client->Message(0, "You carefully light the fuse.");
        say "You carefully light the fuse.\n";
        # print last element of fuse array
        # emulate $client->Message(0, $fuse->[-1]);
        say $fuse->[-1]."\n";
        settimer('explode', 2);
    }
    # NOTE: the following should always be called outside all condition blocks
    #       and at the end of EVENT_ITEM
    # plugin::return_items(\%itemcount);
} 

# emulate EVENT_TIMER()
sub EVENT_TIMER
{
    # NOTE: this just stores the first parameter passed to a local variable
    #       and is not needed in production quests
    my $timer = shift;

    # import global
    our $fuse;
    if ($timer eq 'explode') {
        # emulate my $length = $ent->GetEntityVariable(1);
        my $length = GetEntityVariable(1)-1;
        # length is 0-3
        if ($length ~~ [0..3]) {
            # emulate $client->Message(0, $fuse->[$length]);
            say $fuse->[$length]."\n";
            # emulate $ent->SetEntityVariable(1, $length);
            SetEntityVariable(1, $length);
        }
        # $length is -1
        else {
            # emulate $client->Message(0, "ka-BOOM!");
            say "ka-BOOM!";
            stoptimer($timer);
            print "\n" if keys %$main::timer;
        }
    }
    # stops 'random' timer at random iteration (1-20)
    elsif ($timer =~ /^random_/) {
        my $count = GetEntityVariable($timer."_count")+1;
        say "iteration $count of EVENT_TIMER('$timer') triggered"
            if $timer;
        if ($count >= GetEntityVariable($timer."_limit")) {
            stoptimer($timer);
        }
        else {
            SetEntityVariable($timer."_count", $count);
        }
        print "\n" if keys %$main::timer;
    }
    else {
        warn "I don't know what to do with $timer";
    }
}

# emulate $mob->SetEntityVariable()
sub SetEntityVariable
{
    my ($var, $val) = @_;
    our $entvar;
    if (not $entvar) {
        our $entvar = {
            $var => $val
        };
    }
    else {
        $entvar->{$var} = $val;
    }
}

# emulate $mob->GetEntityVariable()
sub GetEntityVariable
{
    my $var = shift;
    our $entvar;
    $entvar->{$var} // undef;
}

# emulate quest::settimer()
sub settimer
{
    our $timer;
    my ($name, $seconds) = @_;
    stoptimer($name)
        if defined $timer->{$name};
    # fire off EVENT_TIMER($name) after $seconds and every $seconds
    our $timer->{$name} = AE::timer($seconds, $seconds, sub {
        EVENT_TIMER($name);
    });
}

# emulate quest::stoptimer()
sub stoptimer
{
    our $timer;
    my $name = shift;
    $timer->{$name}->stop;
    delete $timer->{$name};
}

print "\n";

foreach (1..2) {
    # set 'random' timer for random amount of time and iteration count
    my $rsecf = rand(2)+1;
    my $limit = int (rand 19)+1;
    say "timer 'random_".$_."' set to a maximum of $limit iterations of $rsecf seconds each\n";
    SetEntityVariable('random_'.$_.'_limit', $limit);
    settimer('random_'.$_, $rsecf);
}

# emulate client giving item to npc
EVENT_ITEM();

# emulate $client->Message(0, You decide it's probably best to get as far away as possible.);
say "You decide it's probably best to get as far away as possible.\n";

# trigger timer loop
# not needed in production quests
EV::loop;
it also never hurts to find something to read:

http://modernperlbooks.com/books/modern_perl/
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 06:46 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3