Thanks for the support so far. We're getting close.
[ENG] IT WORKS, but partially. The player exclusion is broken. Nevermind my last post, sys.txt was targetting another playerRecorder.pl... Sorry, I'm very rusty. I'm using the following code, based on previous suggestions:
[PT-BR] TÁ FUNCIONANDO, mas ainda têm alguns erros. A exclusão de jogadores roda parcialmente e precisa de conserto. O código ficou assim, baseado nas sugestões prévias:
Code: Select all
package playerRecord;
use strict;
use Plugins;
use Log qw(message);
use Globals;
use Settings;
use Actor;
Plugins::register("prec", "playerRecord", \&on_unload, \&on_reload);
my $hook = Plugins::addHook('charNameUpdate', \&write_player, undef);
sub on_unload {
Plugins::delHook("charNameUpdate", $hook);
}
sub on_reload {
message "playerRecord plugin reloading, ";
Plugins::delHook("charNameUpdate", $hook);
}
sub write_player {
my (undef, $args) = @_;
my $targetId = $args->{player}{nameID};
my $targetName = $args->{player}{name};
my $selfName = $char->name();
my $file = "$Settings::logs_folder/players_$selfName.txt";
my @notPlayers = ("~º kaoru º~", "kaoru®", "kaoru", "Ka Oru");
for (@notPlayers) {
if ($targetName eq $_) {
return;
}
}
my @notInMap = ("prontera", "geffen", "alberta");
for (@notInMap) {
if ($field->baseName eq $_) {
return;
}
}
message "Player Exists: $targetName ($targetId)\n";
open FILE, ">>:utf8", $file;
my $time=localtime time;
print FILE "[$time] " . $field->baseName . "\t$targetId $targetName\n";
close FILE;
}
1;
[ENG] The map exclusion (
@notInMap) works perfectly. It has room for improvement, but I'll cover it in another post.
My issues:
1. The player exclusion (
@notPlayers) is not working properly with players that have special characters in their names. While "kaoru" and "Ka Oru" are excluded, "~º kaoru º~" and "kaoru®" are still logged, despite being in the exclusion list.
2. Not a very important issue, but still needs to be looked after: after the changes, the plugin is uptading the non-excluded players much more often then before. As soon as the player goes out of sight and returns, he is logged again, while before it had a certain "delay" to log him again. Maybe a problem with charNameUpdate?
3.
$time=localtime time returns me time in "DDD MMM dd HH:HH:HH YYYY" (Thu Dec 6 01:25:40 2012) format. How do I make it "dd mm HH:HH" (6 12 01:25, or anything similar)?
[PT-BR] A exclusão dos mapas (
@notInMap) está funcionando perfeitamente. Tem espaço para melhoras, mas cobrirei isso depois.
Os problemas:
1. A exclusão dos jogadores (
@notPlayers) não está funcionando adequadamente com personagens que têm caracteres especiais nos nomes. Enquanto "kaoru" e "Ka Oru" são excluídas, "~º kaoru º~" e "kaoru®" são registradas no log, apesar de estarem incluídas na exclusão.
2. Esse problema não incomoda muito, mas precisa de atenção: depois das mudanças, o plugin tá atualizando os jogadores não excluídos com muito mais frequência. Assim que o jogador sai da vista do bot e retorna, ele é logado novamente, diferente de antes, que tinha um certo delay. Talvez um problema com charNameUpdate?
3.
$time=localtime time retorna tempo no formato "DDD MMM dd HH:HH:HH YYYY" (Thu Dec 6 01:25:40 2012). Como eu passo pro formato "dd mm HH:HH" (6 12 01:25)? Ou algo similar.