Page 1 of 2
A=? B=? C=?
Posted: 09 Mar 2017, 10:58
by sobad123
I have a Question about the BotKiller.
The BotKiller want to solve a math problem with "How Many is A+B-C" and such things.
But the Solution I found is not working because the BotKiller use more than one variant of Check, its like:
A+B
A-B
A+B-C
A-B+C
and so on. Now my Question do I need more than one block for react on NPC or how does it work?
Re: A=? B=? C=?
Posted: 09 Mar 2017, 11:33
by Mortimal
Use automacro with
console hook that's all.
Something like that:
Code: Select all
automacro countItForMe {
console /(\d+)(-|\+)(\d+)(-|\+(?:\d+))/i
call doCount
}
macro doCount {
pause 1
$doThis = $.lastMatch1$.lastMatch2$.lastMatch3$.lastMatch4$.lastMatch5
$res = @eval($doThis)
do talk num $res
}
Will trigger 2+2, 2-2, 2+2+2, 2-2-2, 2-2+2, 2+2-2
Will not trigger 2+, 2+2+, 2-, 2-2-, 2-2+, 2+2-
Just need to change that for yours corresponding full line:
and this code will work fine i think:
Re: A=? B=? C=?
Posted: 09 Mar 2017, 12:17
by sobad123
could you explain this line a little bit more?
Re: A=? B=? C=?
Posted: 09 Mar 2017, 12:31
by Mortimal
/ /i --> delimiter - regexp inside;
i - means this regexp is case-sensitive.
( ) --> delimiter - whats inside will be remembered as
$.lastMatchN
\d+ -->
\d - digit;
+ means any number of previous statement ->
\d <- but not
none
-|\+ -->
- or
+;
\ here is mirror for
+ because
+ is special
?: --> used to connect
\d+ statement to previous
-|\+ statement (wont work without this i remember we need this but cant remember why we need this x) )
Use this for details:
http://perldoc.perl.org/perlrequick.html
http://perldoc.perl.org/perlretut.html
Re: A=? B=? C=?
Posted: 09 Mar 2017, 12:45
by sobad123
The seconde problem is that the Numbers are not everytime in the right position like in the picture:
Re: A=? B=? C=?
Posted: 09 Mar 2017, 13:23
by Mortimal
Aw i get it:
Code: Select all
automacro countItForMe {
console /Unknown\s#\d+:\s>If\s?:\s([ABC])=(\d+)\s([ABC])=(\d+)\s([ABC])=(\d+).*\nUnknown\s#\d+: How many is A\s(-|\+)\sB\s(-|\+)\sC.*/i
call doCount
}
macro doCount {
pause 1
switch ($.lastMatch1) {
case (== A){$a = $.lastMatch2}
case (== B){$b = $.lastMatch2}
case (== C){$c = $.lastMatch2}
}
switch ($.lastMatch3) {
case (== A){$a = $.lastMatch4}
case (== B){$b = $.lastMatch4}
case (== C){$c = $.lastMatch4}
}
switch ($.lastMatch5) {
case (== A){$a = $.lastMatch6}
case (== B){$b = $.lastMatch6}
case (== C){$c = $.lastMatch6}
}
$doThis = $a$.lastMatch7$b$.lastMatch8$c
$res = @eval($doThis)
do talk num $res
}
I think this will work...
..........or letters in second line also change places?
Re: A=? B=? C=?
Posted: 09 Mar 2017, 14:00
by sobad123
no only in first line but they can be 2 or 3
I will try thank you!
but it doesnt work, it doesnt trigger and have a error on switch
Re: A=? B=? C=?
Posted: 09 Mar 2017, 14:05
by Mortimal
use second AM
Code: Select all
automacro countItForMe2 {
console /Unknown\s#\d+:\s>If\s?:\s([AB])=(\d+)\s([AB])=(\d+).*\nUnknown\s#\d+: How many is A\s(-|\+)\sB.*/i
call doCount2
}
macro doCount2 {
pause 1
switch ($.lastMatch1) {
case (== A){$a = $.lastMatch2}
case (== B){$b = $.lastMatch2}
}
switch ($.lastMatch3) {
case (== A){$a = $.lastMatch4}
case (== B){$b = $.lastMatch4}
}
$doThis = $a$.lastMatch5$b$
$res = @eval($doThis)
do talk num $res
}
Re: A=? B=? C=?
Posted: 09 Mar 2017, 14:08
by Mortimal
What error? Better give me log console...
Re: A=? B=? C=?
Posted: 09 Mar 2017, 14:12
by sobad123
this one