iworb
New Member
Posts: 7
|
Post by iworb on Oct 18, 2019 7:06:21 GMT
Hi guys, I'm trying to make script for game, but unfortunately I can't check what's going on the screen. I've turned on Settings:snapSet("OutputCaptureImg", true) to see what happens and why button wasn't found and got a completely blank black screen. I'm using NOX app player with Android 7.
|
|
|
Post by AnkuLua on Oct 18, 2019 12:15:27 GMT
Which snapshot method did you use? Root or daemon? Please don't use media projection. Try either root or daemon.
|
|
iworb
New Member
Posts: 7
|
Post by iworb on Oct 18, 2019 13:05:26 GMT
Is service and daemon different things? Without root active on NOX there's just a "Media projection" option. With root turned on there's "root" option and it works, but those system toasts about root access hide some buttons I should click to, so I'm looking for method which doesn't require root access. Also, I've headed up with some strange behavior - some popup window appears after I use waitClick method. It takes about 3 second to appear and then next waitClick method run, but it doesn't wait at all, even if say it to wait 100 seconds. You could check code here, line 63 always crashing. Maybe, this is because of "snapshot" at line 52, but I had to add it, because script didn't update picture at all. When some of checks (53-54 lines) should be passed (check in different single-run script) in this endless cycle it didn't without "snapshot" call.
|
|
|
Post by AnkuLua on Oct 18, 2019 13:22:58 GMT
|
|
iworb
New Member
Posts: 7
|
Post by iworb on Oct 18, 2019 18:08:35 GMT
I've installed daemon and now using it. But my 2nd problem still happens. Should I create new thread?
|
|
|
Post by AnkuLua on Oct 18, 2019 22:17:48 GMT
Please share the crash screenshot.
|
|
iworb
New Member
Posts: 7
|
Post by iworb on Oct 19, 2019 7:39:22 GMT
Here is the screen and error: I'm looking for in correct area, but script doesn't wait after first waitClick
|
|
|
Post by AnkuLua on Oct 19, 2019 9:26:08 GMT
Make sure the compareDimension is set correctly. Or you have to make sure the expected image appearing, by inserting wait()? It's better to use existsClick(). existsClick() doesn't generate exception if the image not found.
|
|
iworb
New Member
Posts: 7
|
Post by iworb on Oct 20, 2019 15:13:36 GMT
I have to wait this image. I've cut some code just to test region and image inside it:
-- ========== Settings ================
Settings:setCompareDimension(true, 960)
Settings:setScriptDimension(true, 960)
Settings:set("MinSimilarity", 0.75)
Settings:snapSet("OutputCaptureImg", true)
regions = {
defeatedReady = Region(241, 172, 223, 77),
drop = Region(574, 43, 153, 153),
dropAd = Region(485, 358, 224, 78),
energy = Region(137, 143, 141, 137),
energyBuy = Region(390, 392, 178, 68),
energyClose = Region(820, 44, 100, 92),
energyConfirm = Region(402, 352, 158, 68),
label = Region(340, 173, 292, 93),
replay = Region(245, 269, 231, 84),
resurrect = Region(484, 262, 232, 95),
start = Region(772, 412, 188, 128)
}
-- ========== main program ===========
setHighlightStyle(0xff8fff00, false)
regions["drop"]:highlight()
setHighlightStyle(0xff8fff00, true)
local victoryRes = regions["drop"]:exists("close.png", 2)
local m = regions["drop"]:wait("close.png", 7)
if (victoryRes and m) then
m:highlight()
toast('exist')
else
toast('not exist')
end
wait(3)
This code is works correctly and highlight both region and found image, but it doesn't work in code I've pasted before after 2 waitClick's in a row
Also, I've got the same error when replaced "region:waitClick" with "region:wait + region:click". And "region:existsClick" is not an option, because I know 100% that this popup appears.
|
|
iworb
New Member
Posts: 7
|
Post by iworb on Oct 20, 2019 16:48:43 GMT
I've modified my waitAndClick function little bit to highlight region in case I didn't find some image: function waitAndClick(region, image, delay)
local res = false
while (not res) do
res = region:existsClick(image, delay)
toast(image .. " exists click result is " .. tostring(res))
if (not res) then
region:highlight(35)
toast("didn't find " .. image .. " wait and try again")
wait(40)
end
end
end And I've got this one: It didn't find image in the correct area, but if I run script with only this button behavior - it will correctly find it:
|
|
iworb
New Member
Posts: 7
|
Post by iworb on Oct 21, 2019 6:14:30 GMT
Okay, looks like this error appears after some time of running in 8+ version of Ankulua. I've found a suggestion to use 7.2 version and it works there. This issue was on latest 8.5 (8.5.5 trial) version, so I think is still actual bug, imma going to use prev version for now.
|
|