Openkore.com

OpenKore Forums
It is currently 21 Aug 2019, 08:18

All times are UTC - 5 hours [ DST ]





Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 14 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: A=? B=? C=?
PostPosted: 09 Mar 2017, 10:58 
Offline
Human
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
 Profile  
 
 Post subject: Re: A=? B=? C=?
PostPosted: 09 Mar 2017, 11:33 
Offline
Developers
Developers

Joined: 01 Nov 2008, 15:31
Posts: 361
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
12431241qaaaaaa.png [ 5.46 KiB | Viewed 2955 times ]

_________________
Please use pin function for uploading your file contents!


Last edited by Mortimal on 09 Mar 2017, 12:25, edited 2 times in total.
Top
 Profile  
 
 Post subject: Re: A=? B=? C=?
PostPosted: 09 Mar 2017, 12:17 
Offline
Human
Human

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

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


Top
 Profile  
 
 Post subject: Re: A=? B=? C=?
PostPosted: 09 Mar 2017, 12:31 
Offline
Developers
Developers

Joined: 01 Nov 2008, 15:31
Posts: 361
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

_________________
Please use pin function for uploading your file contents!


Top
 Profile  
 
 Post subject: Re: A=? B=? C=?
PostPosted: 09 Mar 2017, 12:45 
Offline
Human
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
billltt.png [ 4.51 KiB | Viewed 2939 times ]
Top
 Profile  
 
 Post subject: Re: A=? B=? C=?
PostPosted: 09 Mar 2017, 13:23 
Offline
Developers
Developers

Joined: 01 Nov 2008, 15:31
Posts: 361
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?

_________________
Please use pin function for uploading your file contents!


Top
 Profile  
 
 Post subject: Re: A=? B=? C=?
PostPosted: 09 Mar 2017, 14:00 
Offline
Human
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
 Profile  
 
 Post subject: Re: A=? B=? C=?
PostPosted: 09 Mar 2017, 14:05 
Offline
Developers
Developers

Joined: 01 Nov 2008, 15:31
Posts: 361
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
}

_________________
Please use pin function for uploading your file contents!


Top
 Profile  
 
 Post subject: Re: A=? B=? C=?
PostPosted: 09 Mar 2017, 14:08 
Offline
Developers
Developers

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

_________________
Please use pin function for uploading your file contents!


Top
 Profile  
 
 Post subject: Re: A=? B=? C=?
PostPosted: 09 Mar 2017, 14:12 
Offline
Human
Human

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


Attachments:
abcdefghaaaa.png
abcdefghaaaa.png [ 8.03 KiB | Viewed 2915 times ]
Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 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 forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group