|
Post by AkiBot on Oct 21, 2017 19:08:13 GMT
One the game UI i have multiple Enter buttons each one corresponding to the level of difficulty. How can I control which enter button to press? Thank you. Image: imgur.com/a/QZcaL
|
|
|
Post by AnkuLua on Oct 22, 2017 0:16:00 GMT
Use targetOffset. Say that you want to click the Enter button on the right of #3
existsClick(Pattern("n3.png"):targetOffset(165,25))
Here, n3.png is the snap of #3
|
|
|
Post by Mercobots on Oct 22, 2017 2:09:45 GMT
if i'm not wrong ,findall() will work like a charm because will give all found matches in order...
1º "enter" found = 3# , 2º "enter" found = 4#
and so one
Not tested and not 100% sure
|
|
|
Post by wololo on Oct 22, 2017 7:03:25 GMT
In such a case i use regions for every difficulty and look for the enter button in that area.
for example:
selectDiffVar = 0 Diff1Reg = Region(xx,xx,xx,xx) --lvl 30 Diff2Reg = Region(xx,xx,xx,xx) --lvl 40 . . . --then set the difficulty like you want somewhere in your code selectDiffVar = 30
if(selectDiffVar == 30) then if(Diff1Reg:exists(Pattern("EnterBtn.png"))) then --look for enter button in diffreg1 click(Diff1Reg:getLastMatch():getCenter() end elseif(selectDiffVar == 40)then if(Diff2Reg:exists(Pattern("EnterBtn.png"))) then click(Diff2Reg:getLastMatch():getCenter() end elseif(selectDiffVar == 50)then . . . end
|
|
|
Post by AkiBot on Oct 22, 2017 19:00:51 GMT
if i'm not wrong , findall() will work like a charm because will give all found matches in order... 1º "enter" found = 3# , 2º "enter" found = 4# and so one Not tested and not 100% sure Thank you. After some testing I just used findAll() the coordinates like you mentioned are in order from top to bottom in terms of the Y coordinates. So i used bracket syntax to access the appropriate enter button. For example, to click the 3 enter button from top, i simply do click(enter[3]) and it works like a charm. Thank you for the help.
|
|
|
Post by Mercobots on Oct 22, 2017 23:20:25 GMT
if i'm not wrong , findall() will work like a charm because will give all found matches in order... 1º "enter" found = 3# , 2º "enter" found = 4# and so one Not tested and not 100% sure Thank you. After some testing I just used findAll() the coordinates like you mentioned are in order from top to bottom in terms of the Y coordinates. So i used bracket syntax to access the appropriate enter button. For example, to click the 3 enter button from top, i simply do click(enter[3]) and it works like a charm. Thank you for the help. thast right just to reinforce the idea and speed up the process use regionFindAllNoFindException()- The region should cover only the 4 buttons
|
|