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 WRONG ANSWERS WILL RESULT IN BAN!
: 10 respostas erradas resultarão em ban!
: 10 respuestas equivocadas resultaran en ban!
: Auto-continuing talking
: ANSWER THIS CORRECTLY OR BANNED!
: 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:
@eval(expression)
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. "@@", "@)").
Examples:
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_0 ANSWER THIS CORRECTLY OR BANNED!
msg_1 /^(\d+)$/
msg_2 + (PLUS)
msg_3 /^(\d+)$/
msg_4 = ?
}
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
}
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.
DISCLAIMER
THIS PLUGIN IS DISTRIBUTED "AS IS" AND WITHOUT WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR ANY OTHER WARRANTIES WHETHER EXPRESSED OR IMPLIED. NO WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE IS OFFERED.
THE USER MUST ASSUME THE ENTIRE RISK OF USING THE PLUGIN. <!--
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!
Downloads:
plugin in SVN