# Openkore.com

OpenKore Forums
 It is currently 25 Jan 2020, 13:55

 All times are UTC - 5 hours [ DST ]

 Page 1 of 2 [ 14 posts ] Go to page 1, 2  Next
 Print view Previous topic | Next topic
Author Message
 Post subject: A=? B=? C=?Posted: 09 Mar 2017, 10:58
 Human

Joined: 17 Mar 2015, 06:48
Posts: 48
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?

Top

 Post subject: Re: A=? B=? C=?Posted: 09 Mar 2017, 11:33
 Developers

Joined: 01 Nov 2008, 15:31
Posts: 391
Use automacro with console hook that's all.

Something like that:
Code:
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:
Code:
/(\d+)(-|\+)(\d+)(-|\+(?:\d+))/i

and this code will work fine i think:

 Attachments: 12431241qaaaaaa.png [ 5.46 KiB | Viewed 3269 times ]

_________________

Last edited by Mortimal on 09 Mar 2017, 12:25, edited 2 times in total.
Top

 Post subject: Re: A=? B=? C=?Posted: 09 Mar 2017, 12:17
 Human

Joined: 17 Mar 2015, 06:48
Posts: 48
could you explain this line a little bit more?

Code:
/(\d+)(-|\+)(\d+)(-|\+(?:\d))/i

Top

 Post subject: Re: A=? B=? C=?Posted: 09 Mar 2017, 12:31
 Developers

Joined: 01 Nov 2008, 15:31
Posts: 391
Code:
/(\d+)(-|\+)(\d+)(-|\+(?:\d+))/i

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

_________________

Top

 Post subject: Re: A=? B=? C=?Posted: 09 Mar 2017, 12:45
 Human

Joined: 17 Mar 2015, 06:48
Posts: 48
The seconde problem is that the Numbers are not everytime in the right position like in the picture:

 Attachments: billltt.png [ 4.51 KiB | Viewed 3253 times ]
Top

 Post subject: Re: A=? B=? C=?Posted: 09 Mar 2017, 13:23
 Developers

Joined: 01 Nov 2008, 15:31
Posts: 391
Aw i get it:
Code:
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?

_________________

Top

 Post subject: Re: A=? B=? C=?Posted: 09 Mar 2017, 14:00
 Human

Joined: 17 Mar 2015, 06:48
Posts: 48
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

Top

 Post subject: Re: A=? B=? C=?Posted: 09 Mar 2017, 14:05
 Developers

Joined: 01 Nov 2008, 15:31
Posts: 391
use second AM

Code:
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
}

_________________

Top

 Post subject: Re: A=? B=? C=?Posted: 09 Mar 2017, 14:08
 Developers

Joined: 01 Nov 2008, 15:31
Posts: 391
What error? Better give me log console...

_________________

Top

 Post subject: Re: A=? B=? C=?Posted: 09 Mar 2017, 14:12
 Human

Joined: 17 Mar 2015, 06:48
Posts: 48
this one

 Attachments: abcdefghaaaa.png [ 8.03 KiB | Viewed 3229 times ]
Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 2 [ 14 posts ] Go to page 1, 2  Next

 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 forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ Announcements    Announcements Support    Frequently Asked Questions & Guides    Resolved Questions    Official Servers       bRO       fRO       iRO       idRO       kRO       jRO       tRO       twRO       pRO       Private Servers       Other OpenKore support Discussions    Discussion    Tips & Tricks    Feature suggestions Plugins    Howto write plugins    Macro Plugin       Share your macro's    Other Plugins Technical    Developers Corner    Development Help    Tester's corner    Bug reports       Fixed bugs       Unresolvable bugs    Commit Queue Off Topic    Misc    Trashcan Links    OpenKore Manual    Official GitHub    Download Openkore .zip    AJAX IRC Client (Chat)    Developer Manual