Openkore.com

OpenKore Forums
It is currently 22 Jun 2018, 22:25

All times are UTC - 5 hours [ DST ]





Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: few question about reactOnNPC plugins
PostPosted: 26 Apr 2017, 21:59 
Offline
Noob
Noob

Joined: 26 Apr 2017, 21:35
Posts: 4
hey guys,it's been few day i work on reactOnNPC plugin to try to pass the antibot,
I already have a clue how to do it ,but met some trouble.
Code:
antibot1:[Antibot system]
antibot1:五
antibot1:*
antibot1:⑧
antibot1:do the math

i did some change in reactOnNPC.pl
add a hash to convert chineseword to number,
for example:
Code:
my %convnum = (
'五' => '5',
'⑧' => '8'
);

i can run this in perl ,and success return the answer,but in OP,it seens like it doesen't match the chinese...


Top
 Profile  
 
 Post subject: Re: few question about reactOnNPC plugins
PostPosted: 26 Apr 2017, 23:27 
Offline
Noob
Noob

Joined: 26 Apr 2017, 21:35
Posts: 4
sub onNPCTalk {
return if !$config{"reactOnNPC_0"};
my (undef, $args) = @_;
my $ID = unpack("V", substr($args->{RAW_MSG}, 4, 4));
my $msg = unpack("Z*", substr($args->{RAW_MSG}, 8));

$msg = I18N::bytesToString($msg);
my $lenstr = length($msg);
if (!%reactOnNPC || $reactOnNPC{action}) {
undef %reactOnNPC if %reactOnNPC;
$reactOnNPC{index} = 0;
$reactOnNPC{ID} = $ID;
$reactOnNPC{msg}[$reactOnNPC{index}] = $msg;
} else {
$reactOnNPC{index}++;
if($lenstr >10){
$msg =~ s/五/5/g;
$reactOnNPC{msg}[$reactOnNPC{index}] = $msg;
}else{
$reactOnNPC{msg}[$reactOnNPC{index}] = $msg;

}
}
message "[reactOnNPC] NPC message saved ($reactOnNPC{index}): \"$reactOnNPC{msg}[$reactOnNPC{index}]\" lenstr = $lenstr.\n", "plugin" if $config{"reactOnNPC_debug"};
}

the red code is the changes i make,when $msg =~ s/五/5/g; ,it doesn't work ,so the problem is the chinese number ?


Top
 Profile  
 
 Post subject: Re: few question about reactOnNPC plugins
PostPosted: 27 Apr 2017, 00:18 
Offline
Noob
Noob

Joined: 26 Apr 2017, 21:35
Posts: 4
well........
I know what's wrong....
add
Code:
use uft8;

:oops: :oops:


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group