few question about reactOnNPC plugins

Other plugins for extending OpenKore's functionality. This forum is only for posting new plugins and commenting on existing plugins. For support, use the Support forum.

Moderator: Moderators

Message
Author
a1628625669
Noob
Noob
Posts: 4
Joined: 26 Apr 2017, 21:35
Noob?: No

few question about reactOnNPC plugins

#1 Post by a1628625669 »

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: Select all

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: Select all

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...

a1628625669
Noob
Noob
Posts: 4
Joined: 26 Apr 2017, 21:35
Noob?: No

Re: few question about reactOnNPC plugins

#2 Post by a1628625669 »

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 ?

a1628625669
Noob
Noob
Posts: 4
Joined: 26 Apr 2017, 21:35
Noob?: No

Re: few question about reactOnNPC plugins

#3 Post by a1628625669 »

well........
I know what's wrong....
add

Code: Select all

use uft8;
:oops: :oops:

Post Reply