Page 1 of 44

reactOnNPC v.2.0.2 by hakore

Posted: 08 Apr 2008, 13:58
by Mucilon
This great plugin was made and posted at the old forum by hakore, at the address:

What it does:
This plugin will make you automatically execute commands on an NPC conversation.

Version v.2.0.2
- update reactOnNPC (mod by windows98SE)
- add new options (reactOnNPC_debug, respIgnoreColor)

Version v.2.0.1
- fixed a bug that occurs when using "delay"
- corrected the syntax

Version v.2.0.0
- Fix compatibility bug for SVN versions. (6/25/2008)
- Added attribute: delay (6/25/2008)

Version v.1.1.0
- Fix compatibility bug in Openkore v.1.6.x (5/16/2006)
- Added attribute: useColors (4/26/2006)
- Added keyword: @resp (4/26/2006)
- Implemented nested keywords (4/26/2006)

This is particularly useful on forced NPC conversations such as that which is used by the Anti-bot System in AndzRO.

Code: Select all

You are now: Auto Berserk 
You are now: Gloria 
You are now: Angelus 
You are now: Kyrie Eleison 
You are now: Endure 
You are now: Auto Guard 
You are now: Kaite 
Unknown #110009789: [Anti-bot System] 
: 10 respostas erradas resultarão em ban! 
: 10 respuestas equivocadas resultaran en ban! 
: Auto-continuing talking 
: 8 
: + (PLUS) 
: 5 
: = ? 
: Auto-continuing talking 
NPC Exists: Unknown 110009789 (104, 122) (ID 110009789) - (0) 
Unknown 110009789: Type 'talk num <number>' to input a number. 
[b][reactOnNPC] Reacting to NPC. Executing command "talk num 13". [/b]
You are no longer: Auto Berserk 
You are no longer: Gloria 
You are no longer: Angelus 
You are no longer: Kyrie Eleison 
You are no longer: Endure 
You are no longer: Auto Guard 
You are no longer: Kaite 
AntiBot: [Anti-bot System] 
AntiBot: Thanks for cooperation. 
AntiBot: Done talking	

How to install:
1) Place this plugin in your plugins folder (see the Plugins FAQ how).
2) Add a reactOnNPC config block in your config.txt which defines the command to use and the conditions of the NPC conversation which will trigger Openkore to use the command

How to use:
Use this options at config.txt.

reactOnNPC_debug (boolean flag)
This option enables the display of debug messages plugin

reactOnNPC (command)
This option specifies the command to use if all conditions are met for this block. Special keywords can be used on the specified commands (see below).

Attribute definitions:

type (close|continue|number|responses|text)
This attribute specifies what type of NPC conversation will trigger this block.

1. close - The NPC message box has the "close" button.
2. continue - The NPC message box has the "next" button.
3. number - The NPC shows a number input box.
4. responses - The NPC shows a list of responses.
5. text - The NPC shows a text input box.

Note: If this option is not specified, the block will be triggered on any type of NPC conversation.

useColors (boolean flag) v.1.1.0
By default, matching of NPC messages with the specified patterns on the msg_ attributes exclues the color codes (e.g.
^FF0000). If this attribute is set to 1, the pattern matching will include the color codes so you can inspect these codes on the process.

respIgnoreColor (boolean flag)
Remove RO color codes <npc response>

delay (seconds) v.2.0.0
This specifies the number of seconds to wait before executing the command. (Recommended for anti-bot NPCs that marks the time of response.)

msg_(number) (message|regexp)
This is a list of attributes that specifies the lines of messages that should be checked on the NPC conversation. The number starts from 0 and increses in increments of 1.
You can specify either a simple message or a regexp.

Shared self conditions
This block uses the shared self conditions (see the openkore manual).

Special command keywords:

This keyword can be used to evaluate simple expressions (e.g. math equations).

@resp(pattern) v.1.1.0
This keyword can be used to search the response list for certain patterns and return the index of the found response. This is particularly useful for dynamically changing response list.
The pattern can be a simple string or a regexp.

#(line number)~(match index)
If you use capturing parenthsis in the regexp you specified on a msg_# attribute, this keyword will be resolved to the value of the captured string. The line number corresponds to the number of the msg_# attribute where the regexp is used, while the match index corresponds to the index of the captured string.

Nesting command keywords: v.1.1.0
As of version 1.1.0, you can nest keywords like @resp(@eval(...)). Note however that the characters "@" and ")" are metacharacters and cannot be used normally inside the keywords. If you need to include such metacharacters in your keyword, escape them by preceding these characters with the "@" character (e.g. "@@", "@)").

The following example is the currently used NPC conversation of the AndzRO Anti-bot System. Use type number because the NPC asks for a numeric input. The 5 lines of messages are specified on the msg_# attributes with the 2nd and 4th lines using a regexp to capture the numbers. The command that will be used contains the keyword @eval() to add the captured numbers.
If you wanna use any text or number from the text of NPC just use parentheses on it and address it as a variable on the code, like this:
The #1~1 means:
#1 = msg_1 -> variable is at line 1.
~1 = first parentheses -> variable is the text, number or anything inside the first parentheses.

Code: Select all

reactOnNPC talk num @eval(#1~1 + #3~1) {  
type number  
msg_1 /^(\d+)$/  
msg_2 + (PLUS)  
msg_3 /^(\d+)$/  
msg_4 = ? 
Harder example:

Code: Select all

[reactOnNPC] NPC message saved (0): "[Bot Check]".
Unknown #110012575: [Bot Check]
[reactOnNPC] NPC message saved (1): "^000000^FFFFFF^000000Type: ^FFFFFF72033163522^0000007961^FFFFFF014582^000000".
Unknown #110012575: Type: 720331635227961014582
[reactOnNPC] NPC message saved (2): "^000000^FFFFFF^000000^FFFFFFType: ^FFFFFF247034^000000^FFFFFF993222^000000^FFFFFF412873^000000^FFFFFF^000000".
Unknown #110012575: Type: 247034993222412873
NPC message saved (3): "^000000^FFFFFF^FFFFFF^FFFFFFType: ^FFFFFF392540^000000^FFFFFF588942^000000^FFFFFF672816^000000^FFFFFF^000000".
Unknown #110012575: Type: 392540588942672816
[reactOnNPC] NPC message saved (4): "^000000^FFFFFF^FFFFFFType: ^FFFFFF772995^000000^FFFFFF672463^000000^FFFFFF398865^000000^FFFFFF^000000".
Unknown #110012575: Type: 772995672463398865
NPC Exists: OnPCLoginEvent (313, 179) (ID 110012575) - (1)
[reactOnNPC] onNPCAction type is: number.
[reactOnNPC] Matching "[Bot Check]" to "You need to enter the code below:" (0)... doesn't match.
[reactOnNPC] One or more lines doesn't match for "reactOnNPC_0" (0).
OnPCLoginEvent: Type 'talk num <number #>' to input a number.
Calculating lockMap route to: Vally of Gyoll(nif_fild02)
On route to: Vally of Gyoll(nif_fild02): , 
CalcMapRoute - initialized.

Code: Select all

reactOnNPC talk num @eval(my $color1 = #1~1;my $color2 = #2~1;my $color3 = #3~1;my $color4 = #4~1;my $number1 = #1~2;my $number2 = #2~2;my $number3 = #3~2;my $number4 = #4~2;my $numberout = 0; if ($color1 eq '^000000'@) {$numberout = $number1;} if ($color2 eq '^000000'@) {$numberout = $number2;} if ($color3 eq '^000000'@) {$numberout = $number3;} if ($color4 eq '^000000'@) {$numberout = $number4;} my @@colors = split /\^/,$numberout; my $anwser = ''; foreach my $number (@@colors@) { if ($number eq /000000(\d+@)/@) {$anwser .= $1;}} return $anwser;){
        type number
        useColors 1
        msg_0 [Bot Check]
        msg_1 /(\^[0-9a-fA-F]{6})Type: (.+)/i
        msg_2 /(\^[0-9a-fA-F]{6})Type: (.+)/i
        msg_3 /(\^[0-9a-fA-F]{6})Type: (.+)/i
        msg_4 /(\^[0-9a-fA-F]{6})Type: (.+)/i
TIP1: to know how regexp works, search in here: ( is my perl bible)
Quick regexp tutorial
Complete regexp tutorial

TIP2:Search at the old forum, there are a lot of made configs in there.

If you think the plugin does not respond to your NPC, you may have misconfigured your reactOnNPC block. Set debug to 1 in your config.txt and read how the reactOnNPC plugin works whenever you talk to the NPC.


Known Bugs: by Mucilon
This nesting command wasn't work when I try to use it at a Brazilian server, so I had to change it to use, but what I made works just to nesting commands and isn't the one posted in here. I can post it further at discussion forum to try make it general, need advanced regexp knowledge!

I hope you enjoy it! ;)

plugin in SVN

Re: reactOnNPC v.1.1.1

Posted: 09 Apr 2008, 23:12
by -Fallen-
hey mucilon.just asking, does this plugin screw up with the normal kore configs u have set for NPC responses? also, am i able to use this to react with an NPC which appears to be a monster to openkore. cus the situation now is that openkore thinks that npc (nine tail) is a monster and attacks it.den the nine tail will talk and i get stuck was wondering if this would work in solving the problem

Re: reactOnNPC v.1.1.1

Posted: 10 Apr 2008, 10:26
by Mucilon
You just need to configure the messages sent by the npc and select the answers.
You could also make a macro to answer, using console to trigger and the talknpc command to answer, did you try it? I'm assuming the npc only ask questions, which the answers are: ok, next, select an answer, cancel, ...

Re: reactOnNPC v.1.1.1

Posted: 10 Apr 2008, 10:48
by -Fallen- currently using a macro to do that.but u think u could gimme a mini tutorial via PM on how to config the NPC chat reply for this plugin? lol.i'm totally stumped on this one xD

Re: reactOnNPC v.1.1.1

Posted: 10 Apr 2008, 14:33
by Mucilon
I beleave that the macro is the best option, otherwise you should use one reactOnNPC block to each answer. This plugin was meant to the quality of the answer and not for many answers.

Re: reactOnNPC v.1.1.1

Posted: 10 Apr 2008, 21:32
by -Fallen-
ahh.okay.then that would actually be more of a hassle. i'll stick to the macros and using mon_control to avoid this problem then. thanks :D

Re: reactOnNPC v.1.1.1

Posted: 11 Apr 2008, 10:35
by Uemor
>< i need your help Mucilon my friend Brazilian ^^

new anti-bot Sux -.-'

the log

Code: Select all

My Configs no working -.-'

Code: Select all

reactOnNPC talk num @eval (my $color = '#1~1';my $color2 = '#1~2';my $number1 = #3~2;my $number2 = #3~5;my $number3 = #3~8;my $number4 = #3~11;my $number1 = #3~2;my $number2 = #3~5;my $number3 = #3~8;my $number4 = #3~11;my $numberout1 = 0;my $numberout2 = 0;if ($color1 == '#3~1'@) {$numberout1 = $number1;}if ($color1 == '#3~4'@) {$numberout1 = $number2;} if ($color1 == '#3~7'@) {$numberout1 = $number3;} if ($color1 == '#3~10'@) {$numberout1 = $number4;}if ($color2 == '#3~1'@) {$numberout2 = $number1;}if ($color2 == '#3~4'@) {$numberout2 = $number2;} if ($color2 == '#3~7'@) {$numberout2 = $number3;} if ($color2 == '#3~10'@) {$numberout2 = $number4;}  return ($numberout1 + $numverout2)
	type number
	useColors 1
	msg_0 /\[Anti-Bot\]/i
	msg_1 /\^([0-9a-fA-F]{6})\^[0-9a-zA-Z_]\^([0-9a-fA-F]{6})\ plus \^([0-9a-fA-F]{6})\^[0-9a-zA-Z_]\^([0-9a-fA-F]{6})/i
	msg_2 /\^([0-9a-fA-F]{6})\[(\d)\]\^[0-9a-fA-F]{6}\^([0-9a-fA-F]{6})\[(\d)\]\^[0-9a-fA-F]{6}\^([0-9a-fA-F]{6})\[(\d)\]\^[0-9a-fA-F]{6}\^([0-9a-fA-F]{6})\[(\d)\]\^[0-9a-fA-F]{6}/i
this anti-bot have lot of colors -.- examples: RED, Blue, green, black,ETC....and you note de mofications in a reactNPC lines....for obvius the maker of this anti-bot look this topic -.-'

PS: in brazilian language xD

Cara eu sou muito chato mesmo né xD, tentei aprender mas na hora de ajuntar tds comandos sempre fica faltando algo O.o

tranlation on google:

Man I am very annoying even xD right, I tried to learn but at the time of
Adding All commands is always missing something O.o

Re: reactOnNPC v.1.1.1

Posted: 12 Apr 2008, 12:13
by Mucilon
You forgot somethings and made other things wrong...
You used the same variable twice, forgot to end the return command, misplaced a lot of things at the msg_1 and _2, misplace the [] and at msg_2 was missing two blocks of [\s*\^([0-9a-fA-F]{6})(\d)\^[0-9a-fA-F]{6}\s*\].
Try this one now:

Code: Select all

reactOnNPC talk num @eval (my $color = '#1~1';my $color2 = '#1~2';my $number1 = #2~2;my $number2 = #2~4;my $number3 = #2~6;my $number4 = #2~8;my $number5 = #2~10;my $number6 = #2~12;my $numberout1 = 0;my $numberout2 = 0;if ($color1 == '#2~1'@) {$numberout1 = $number1;} if ($color1 == '#2~4'@) {$numberout1 = $number2;} if ($color1 == '#2~7'@) {$numberout1 = $number3;} if ($color1 == '#2~10'@) {$numberout1 = $number4;} if ($color2 == '#2~1'@) {$numberout2 = $number1;} if ($color2 == '#2~4'@) {$numberout2 = $number2;} if ($color2 == '#2~7'@) {$numberout2 = $number3;} if ($color2 == '#2~10'@) {$numberout2 = $number4;} return ($numberout1 + $numberout2@);)
   type number
   useColors 1
   msg_0 /\[Anti-Bot\]/i
   msg_1 /\^([0-9a-fA-F]{6})\^[0-9a-zA-Z]\w+\^([0-9a-fA-F]{6})\s+plus\s+\^([0-9a-fA-F]{6})\w+\^[0-9a-zA-Z]/i
   msg_2 /\[\s*\^([0-9a-fA-F]{6})(\d)\^[0-9a-fA-F]{6}\s*\] \s*\[\s*\^([0-9a-fA-F]{6})(\d)\^[0-9a-fA-F]{6}\s*\] \s*\[\s*\^([0-9a-fA-F]{6})(\d)\^[0-9a-fA-F]{6}\s*\] \s*\[\s*\^([0-9a-fA-F]{6})(\d)\^[0-9a-fA-F]{6}\s*\] \s*\[\s*\^([0-9a-fA-F]{6})(\d)\^[0-9a-fA-F]{6}\s*\] \s*\[\s*\^([0-9a-fA-F]{6})(\d)\^[0-9a-fA-F]{6}\s*\]/i

Re: reactOnNPC v.1.1.1

Posted: 13 Apr 2008, 11:58
by zidane86
Sorry i try to do it myself but end up more than a dozen of character in jail sqatting

Code: Select all

You have look: Cloaking
You are in Frozen state
NPC image: kafra_07.bmp (0)
[GM] BotKiller Police: I'm sorry, I need to know if you're playing or botting..
Unknown #110015471: [ BotKiller Police ]
[reactOnNPC] NPC message saved (0): "[^0000FF BotKiller Police ^000000]".
Unknown #110015471: Please enter the following code into the box and click
[reactOnNPC] NPC message saved (1): "Please enter the following code into the
box and click next.".
Unknown #110015471: ¡El bot que verifica tiempo!
[reactOnNPC] NPC message saved (2): "¡El bot que verifica tiempo!".
Unknown #110015471: Auto-continuing talking
[reactOnNPC] onNPCAction type is: continue.
[reactOnNPC] Conditions for reactOnNPC_0 not met.
Unknown #110015471: Access Code: 163818966121898
[reactOnNPC] NPC message saved (0): "Access Code:
Unknown #110015471:
[reactOnNPC] NPC message saved (1): " ".
Unknown #110015471: Please don't include spaces in answer.
[reactOnNPC] NPC message saved (2): "Please don't include spaces in answer.".
Unknown #110015471: Huwag po lagyan ng spacebar!
[reactOnNPC] NPC message saved (3): "Huwag po lagyan ng
Unknown #110015471: no incluya spacebar!
[reactOnNPC] NPC message saved (4): "no incluya ^FF0000spacebar!^000000".
Unknown #110015471:
[reactOnNPC] NPC message saved (5): " ".
Unknown #110015471:
[reactOnNPC] NPC message saved (6): " ".
Unknown #110015471: Example/Ejemplo:15  20
[reactOnNPC] NPC message saved (7): "Example/Ejemplo:^FF000015  20^000000".
Unknown #110015471: Answer/Respuesta/Sagot=1520!
[reactOnNPC] NPC message saved (8):
Unknown #110015471:
[reactOnNPC] NPC message saved (9): " ".
Unknown #110015471: You have 90 seconds to respond..
[reactOnNPC] NPC message saved (10): "You have ^FF000090 seconds^000000 to
Unknown #110015471: Using @go or logout will result to +1
[reactOnNPC] NPC message saved (11): "^FF0000Using @go or logout will result to
+1 mistake/error/pagkakamali.^000000".
NPC Exists: BotKillerFnc1 (156, 138) (ID 110015471) - (3)
BotKillerFnc1: Type 'talk num <number #>' to input a number.
[reactOnNPC] onNPCAction type is: number.
[reactOnNPC] Conditions for reactOnNPC_0 not met.
and here is my config
reactOnNPC talk num @resp(my $color2 = #0~0) {
type number
useColors 1
msg_0 /(\^[0-9a-fA-F]{6})Type: (.+)/i
msg_2 Please don't include spaces in answer.

it dosent respond at all and the number is random from a combination of 2 set of single number to 2 set of triplet number
they didnt ask u to add the number up but rather just pair them together and type them as a whole number

Re: reactOnNPC v.1.1.1

Posted: 13 Apr 2008, 18:35
by Mucilon
Ok... but this antibot is very easy!
Try this one:

Code: Select all

reactOnNPC talk num #0~1#0~2 {
type number
useColors 1
msg_0 /Access Code: \^[0-9a-fA-F]{6}\d+\^[0-9a-fA-F]{6}(\d+)\^[0-9a-fA-F]{6}\d+\^[0-9a-fA-F]{6}(\d+)\^[0-9a-fA-F]{6}\d+\^[0-9a-fA-F]{6}/i