Possible to log PvP kills?
-
Use of uninitialized value in string eq at C:\PROGRA~2\Microsoft Games\Freelancer\EXE\FLPHook\lib\FLPHook\pvplogger.pl line 13.
[PvPLogger]
logfile = pvplog
I also tried pvplog.log
I’m not really sure if it requires a log file to be pre-made or where it would put one if there wasn’t one, but I don’t think the error had to do with that. The error makes me think it is really with this line of code:print “$t - System: $system Killer: $$e{killer} Victim: $$e{victim}\n”;
-
ugh…from the error looks like the file was made, and printed the line to, but either the timestamp, system name, killer name or victim name failed to print, i’ll recheck make sure those values are right (been almost a year since i actually coded plugins for this…)
if you could check the file it attempted to print to and paste one of the lines would help… the file must have been made & printed to, or that error would never have shown up
if you specified the file as:
logfile = pvplog.log
then it would be in the FLPHook directory.also, what version of FLHook are you running? if its been customized and displays kill events in a different format that would break it
-
Syntax42 wrote:
[PvPLogger]
logfile = pvplogi just noticed you have the section listed as [PvPLogger]
change that to [PvPLog] -
LOL my bad…typo’d something in there (not causing your error though)
plugin_register { name => 'pvplogger', author => 'Fenris_Wolf', version => '1.0', date => '12/27/2009', description => 'logs pvp kills to a file' }, undef, { 'kill' => sub{ my $e = shift; return undef unless $e->{type} eq 'player'; my $system = psystem plid('char',$e->{killer}); my $t = localtime(); open FILE, '>>', $Options->{pvplog}{logfile} or return undef; print FILE "$t - System: $system Killer: $$e{killer} Victim: $$e{victim}\n"; close FILE; } }; 1;
double checked the rest of the code should be fine
-
DeathMsgTextPlayerKill=Death: %victim was killed by %killer (%type)
from flhook.ini
Its either 1.6.0 or 1.5.9.
The log file you expected output to is empty.I can get rid of the death message customization if that’s what it takes to make this work.
[PvPLogger] was fixed and I got the same error.
-
heh ya the empty file was due to my typo >.<
-
that shouldnt be…delete the file and try again (if the file reappears, something should get printed, if not its printing somewhere else)
# this line creates/opens the file in write mode, if it cant, it exits (you wouldnt see a error from the next line) open FILE, '>>', $Options->{pvplog}{logfile} or return undef; print FILE "$t - System: $system Killer: $$e{killer} Victim: $$e{victim}\n"; close FILE;
the $Options->{pvplog}{logfile} which points to your config ini, specifically the:
[PvPLog]
logfile = pvplog.logyou could also take the raw eventmode text and print that in case the msgs have been customized
print FILE "$$e{event_text}\n";
-
plugin_register { name => 'pvplogger', author => 'Fenris_Wolf', version => '1.0', date => '12/27/2009', description => 'logs pvp kills to a file' }, undef, { 'kill' => sub{ my $e = shift; open FILE, '>>', $Options->{pvplog}{logfile} or return undef; print FILE "$$e{event_text}\n"; close FILE; } }; 1;
and the log file had
victim=killarr type=suicide
victim=targetpractice type=player by=killarrGood enough for what I want. I can parse that manually and only turn it on when I need it. PvE deaths may be included in my server’s system anyways.
-
interesting….the error msg was apparently in the a bug programs core
it was looking at the line likevictim=* type=* killer=* ```should have been
victim=* type=* by=*
-
there fixed and uploaded new version, the original script (without typo lol) should work ok now
tyvm for being guinea pig LOL -
plugin_register { name => 'pvplogger', author => 'Fenris_Wolf', version => '1.0', date => '12/27/2009', description => 'logs pvp kills to a file' }, undef, { 'kill' => sub{ my $e = shift; my $system = psystem plid('char',$e->{victim}); my $t = localtime(); open FILE, '>>', $Options->{pvplog}{logfile} or return undef; if ($e->{type} eq 'player') { print FILE "$t - System: $system Killer: $$e{killer} \tVictim: $$e{victim}\n"; } else { print FILE "$t - System: $system Killer: $$e{type} \tVictim: $$e{victim}\n"; } close FILE; } }; 1;
I made a small change so it would log both PvP and PvE kills without giving an error. Also, the system had to be changed to the victim’s instead of the killer’s.