crapy clawn forums http://crapyclawn.net/lolwords/ |
|
perl program to find rage quitters http://crapyclawn.net/lolwords/viewtopic.php?t=2817 |
Page 1 of 1 |
Author: | Agent_137 [ Tue Aug 11, 2009 12:43 am ] |
Post subject: | perl program to find rage quitters |
hi! in july hogg wished for a way to keep track of all the rage quits so we can post them on the wikipenia, point, and laugh. Here ya go: to get a log from console put -condebug in your l4d launch options then check: C:\program files\steam\steamapps\common\left 4 dead\left4dead\console.log here's the goods: http://www.crapyclawn.net/wikipenia/ind ... Rage_Quits Code: #suck my shebang. # declare variables my $inp; my $out; my %joiners; my @quits; # Find all detailed connects with playerId and gamertag. Add them to the hash. open($inp, "<", "console.log"); while (<$inp>) { if (/New client. Client Info: ID: (\d+?), Players: 1, Gamertag: (.+?),/) { # print "$1 - "; # print "$2\n"; $joiners{$1} = $2; } } # Match the playerID and gamertag to any disconnects missing a gamertag, then store that gamertag. open($inp, "<", "console.log"); while (<$inp>) { while (($key, $value) = each(%joiners)){ # print $key." ".$value."\n"; if (/Dropped player: $key/) { push (@quits, "*$value\n"); } } } # store any clean quits. open($inp, "<", "console.log"); while (<$inp>) { if (/Player (.+?) left the game/) { push (@quits, "*$1\n"); } } # De dupe any repeats in the list. my %hash = map { $_, 1 } @quits; # or a hash slice: @hash{ @array } = (); # or a foreach: $hash{$_} = 1 foreach ( @array ); my @unique = keys %hash; #Store them for posterity: open($out, ">>", "ragelog.txt"); print $out @unique; close $out; print "These rage quitters have been logged:\n"; print @unique; # thank you to http://perldoc.perl.org/perlfaq4.html#How-can-I-remove-duplicate-elements-from-a-list-or-array%3f for the dedupe. |
Author: | assrott [ Tue Aug 11, 2009 4:07 pm ] |
Post subject: | |
http://www.pointpark.edu/default.aspx?id=1454 Rager quit. |
Page 1 of 1 | All times are UTC-06:00 |
Powered by phpBB® Forum Software © phpBB Limited https://www.phpbb.com/ |