|
Post by Mercobots on May 21, 2017 12:19:03 GMT
|
|
Zori
New Member
Posts: 30
|
Post by Zori on May 21, 2017 19:21:08 GMT
Thank you so much for the help man, i really appreciate it. How did you crop the gems using the link you sent me? When I try they are resulting in black and white images
|
|
|
Post by Mercobots on May 21, 2017 20:41:23 GMT
|
|
Zori
New Member
Posts: 30
|
Post by Zori on May 25, 2017 10:27:41 GMT
Tried to crop and add the black and white golden images and still it cant find them within screenshots. Can you help me with the cropping? I think i fail with this, tried dozens of time to do it well T_T If I send you the screenshots of the 10 gems can you crop them for me? I know I'm asking for too much, thank you for your time and patience mate, really appreciate it.
|
|
|
Post by Mercobots on May 25, 2017 10:40:24 GMT
hi there, it seems impossible to crop the gems for you because i'm at low level at this game, on this way i only have the basic goldens
btw what is your resolution ?
|
|
Zori
New Member
Posts: 30
|
Post by Zori on May 25, 2017 10:45:02 GMT
hi there, it seems impossible to crop the gems for you because i'm at low level at this game, on this way i only have the basic goldens btw what is your resolution ? I can send you some screenshots of the gems which you can crop from, I'm a high level and it still is very hard to find them And its 1080 x 1920, I have oneplus3
|
|
|
Post by Mercobots on May 25, 2017 11:05:51 GMT
this is hard to me to explain but i will try If you are using the example i sent to you will have a big problem because i constructed this one on a resolution of 1280 and the images are cropped on that resolution, so when you crop your owns images on a resolution of 1920 the script will try compare yours images with the resolution i set up , even if you change the setScriptDimension to 1920 it can fail too, i recomend you to to
change setScriptDimension to 1920 and crop again all images (buttons, chest, goldens)
|
|
Zori
New Member
Posts: 30
|
Post by Zori on May 25, 2017 11:18:34 GMT
this is hard to me to explain but i will try If you are using the example i sent to you will have a big problem because i constructed this one on a resolution of 1280 and the images are cropped on that resolution, so when you crop your owns images on a resolution of 1920 the script will try compare yours images with the resolution i set up , even if you change the setScriptDimension to 1920 it can fail too, i recomend you to to change setScriptDimension to 1920 and crop again all images (buttons, chest, goldens) Will do and update, thanks <3 And is there a way to crop the images without the black and white?
|
|
|
Post by Mercobots on May 25, 2017 11:21:08 GMT
using a pc is very easy, on mobile i really don't know since i use the pc to do the hard work
|
|
Zori
New Member
Posts: 30
|
Post by Zori on May 25, 2017 12:16:19 GMT
using a pc is very easy, on mobile i really don't know since i use the pc to do the hard work How do I crop it with PC? And I need to change the scriptDimension to 1920?
|
|
|
Post by Mercobots on May 25, 2017 12:31:42 GMT
now depends to your emulator, if emulator resolution is set to 1280 you can crop all images from there and set the setCompareDimension to 1280. The important of all of this is set scriptDimension , CompareDimension and crop all images from a unique resolution, in you case i croped some images from a resolution to 1280 and you from a 1920, so when the script compare the image will have 2 different image dimension and it may fail. To be 100% sure the bug don't come from image recognition work on 1 resolution only, has i say before is hard to me to explain this , i really hope i have be clear enough I use this one to crop images www.mirekw.com/winfreeware/mwsnap.html
|
|
Zori
New Member
Posts: 30
|
Post by Zori on May 26, 2017 0:50:14 GMT
now depends to your emulator, if emulator resolution is set to 1280 you can crop all images from there and set the setCompareDimension to 1280. The important of all of this is set scriptDimension , CompareDimension and crop all images from a unique resolution, in you case i croped some images from a resolution to 1280 and you from a 1920, so when the script compare the image will have 2 different image dimension and it may fail. To be 100% sure the bug don't come from image recognition work on 1 resolution only, has i say before is hard to me to explain this , i really hope i have be clear enough I use this one to crop images www.mirekw.com/winfreeware/mwsnap.htmlI cropped all of the images correctly and it does manage to find them good and great (see in the end of the video) But there are 2 problems: -The getChestRegion function is checking the previous chest instead of the current one (see in the start of the video) -It's pretty slow So in order to fix the first problem I need to delay the calling of the getChestRegion so the skipping dungeon click will be done and it won't pick the same chest consecutively, how do I do that? And do you have any idea how to make it faster? And just from curiousity, is there a way to make a sound notification? Thanks for the help man, you're seriously a pro. Can I donate you somehow?
|
|
|
Post by Mercobots on May 26, 2017 8:38:07 GMT
Glad to hear that The new changes are indicated with a -- @@ local findGolden = function() wait(1) -- @@ toast("findGolden") local goldens = { "clones_1.png", "disable_trap.png", "doube_gold_1.png", "doube_gold_3.png", "ghost_1.png", "slow_time_1.png", }
local chestRegion = getChestRegion() -- @@
if chestRegion then usePreviousSnap(true) end -- @@ to speed up the bot
local result -- @@ local i, match = existsMultiMax(goldens, chestRegion)
if match then playMusic("chest.mp3", false) -- @@ play music wait(1) -- @@ delay match:highlight(2) toast("found -> " .. goldens[i]) -- loc = Location(100, 100) click(loc) -- print("Found a golden!") --Letting you know we found a golden
-- get the golden name local golden_name = string.gsub(goldens[i], "(%.%w+)$", "")
result = { true, golden_name } -- @@
elseif existsClick("skip.png") then
result = { false, "_no_golden" } -- @@ else result = { false, "_error" } -- @@ end
usePreviousSnap(false) -- @@ return result[1],result[2] -- @@ end To more speed remove the highlights or use img_r() from luaLib
Be aware playMusic() is only available for ankulua pro thank you , for donations www.paypal.me/Mercobots
|
|
|
Post by Mercobots on May 26, 2017 9:46:18 GMT
btw using img_r()
your code should be like this on test mode
-- Constants vars --
-- Path ROOT = scriptPath() DIR_LIB = ROOT .. "lib/"
-- Engine (Main Vars)
TIME_OUT = 3 SIMILARITY = 0.85 SCRIPT_DIMENSION = 1280 COMPARE_DIMENSION = 1280
-- BASIC SETTINGS Settings:setScriptDimension(true, SCRIPT_DIMENSION) Settings:setCompareDimension(true, COMPARE_DIMENSION) -- Settings:set("MinSimilarity", SIMILARITY) Settings:set("AutoWaitTimeout", TIME_OUT) --
-- load libs dofile(DIR_LIB .. "commonLib.lua") dofile(DIR_LIB .. "luaLib.lua")
-- IntelliJ IDE DEBUG -- this var is just to trick the ide local _true = true
-- DEBUG MODE DEBUG_R = true
-- function to create a small region to find the goldens local getChestRegion = function() if exists(img_r("chest.png")) then
local m = getLastMatch()
-- get sizes and axis local r = { x = m:getCenter():getX(), y = m:getCenter():getY(), w = m:getW(), h = m:getH(), } -- Region Calculation r.x = r.x - (r.w * 0.8) r.w = r.w * 1.8 r.h = r.h * 4 r.y = r.y - r.h
local reg = Region(r.x, r.y, r.w, r.h)
debug_r("Chest", reg) -- @@ highlight
return Region(r.x, r.y, r.w, r.h) else return nil end end
-- find golden and return current condition local findGolden = function() wait(1) -- @@ delay toast("findGolden") local goldens = { "clones_1.png", "disable_trap.png", "doube_gold_1.png", "doube_gold_3.png", "ghost_1.png", "slow_time_1.png", }
local chestRegion = getChestRegion() -- @@
if chestRegion then usePreviousSnap(true) end -- @@ to speed up the bot
local result -- @@ local i, match = existsMultiMax(goldens, chestRegion)
if match then playMusic("chest.mp3", false) -- @@ play music wait(1) -- @@ delay
debug_r("Golden -> " .. goldens[i], match) -- @@ highlight -- loc = Location(100, 100) click(loc) -- print("Found a golden!") --Letting you know we found a golden
-- get the golden name local golden_name = string.gsub(goldens[i], "(%.%w+)$", "")
result = { true, golden_name } -- @@
elseif existsClick(img_r("skip.png")) then
result = { false, "_no_golden" } -- @@ else result = { false, "_error" } -- @@ end
usePreviousSnap(false) -- @@ return result[1], result[2] -- @@ end
-- Main While -- with this small loop you can keep track of your script and manipulate the actions
while _true do print("main loop") print("-----------------------") local golden_found, msg = findGolden()
if golden_found then print("golden found -> " .. msg) -- msg = name of the golden found -- do stuff elseif msg == "_no_golden" then print("golden Not found -> " .. msg) -- goto next dungeon -- continue the while elseif msg == "_error_" then print("golden Not found -> " .. msg)
-- out of dungeon view -- do stuff to openanother dungeon end print("-----------------------") end
to see the final result(without highlight, more speed) change this line to false
DEBUG_R = false
|
|
Zori
New Member
Posts: 30
|
Post by Zori on May 26, 2017 10:44:20 GMT
Glad to hear that The new changes are indicated with a -- @@ CODE To more speed remove the highlights or use img_r() from luaLib
Be aware playMusic() is only available for ankulua pro thank you , for donations www.paypal.me/Mercobotsbtw using img_r()your code should be like this on test mode CDE to see the final result(without highlight, more speed) change this line to falseDEBUG_R = false Will try and keep you posted, thank you so much for the help!
|
|