# HG changeset patch # User Matti Hamalainen # Date 1470773161 -10800 # Node ID 9267d2b51e57042e28effefec16824c049cf4d87 # Parent f4c26eba10af26a305ec17a911431e00a5ffa6a7 Count lines since last spell hit. diff -r f4c26eba10af -r 9267d2b51e57 magestats.pl --- a/magestats.pl Tue Aug 09 23:05:34 2016 +0300 +++ b/magestats.pl Tue Aug 09 23:06:01 2016 +0300 @@ -226,6 +226,8 @@ my $crit_type; my $last_spell = ""; my $staff_worn = 0; +my $spell_active = 0; +my $nline = 0; sub staff_update($$) @@ -272,6 +274,7 @@ { $last_spell = $_[0]; + $spell_active = $nline; my $type = get_spell_type($last_spell); $$spells{$last_spell}{"blasts"}++; @@ -363,6 +366,7 @@ mlog(1, "Parsing log from stdin ..."); while (defined(my $s = )) { + $nline++; if ($s =~ /^You wear (.+?)\.$/) { staff_match($1, 1, $s); } elsif ($s =~ /^You remove (.+?)\.$/) {