|
Post by zenkrye on Dec 13, 2017 18:04:08 GMT
Is there a way to turn on :highlight for all regions called in a program? I would like to add a flag for debugging to see if my regions are off without having to add another line of code at each region used.
|
|
|
Post by Mercobots on Dec 14, 2017 1:18:07 GMT
Is there a way to turn on :highlight for all regions called in a program? I would like to add a flag for debugging to see if my regions are off without having to add another line of code at each region used. Hello some time ago i created a small tool, to help me deal with it Debugger.zipdonwload and include it at very top of your script like this dofile(scriptPath() .. "Debugger.luac") To use it is very simple without region Image:exists("btn_ok.png") result - if found -> highlight match , center and target using region Image:R(my_region):exists("btn_ok.png") result - if found -> highlight region,match , center and target All highlights on/off
Image:setDebug(bool) Avaible methods - exists - existsClick Returns data table contains all image data or false if not found Data table { match = Match Obj, location = Location Obj, region = Used Region Obg, target = Target Location Obj, center = Center Location Obj, values = { x , y, w, h, score, center = {x,y} target = {x,y} } }
Real usedofile(scriptPath() .. "Debugger.luac")
Image:setDebug(true)
-- Simple found if Image:R(myRegion):exists("myImage.png",10) then print("Found") end
-- using data values
local data = Image:R(myRegion):exists("myImage.png",10)
if data then print("Found") print("Image x = " .. data.values.x) print("Image y = " .. data.values.y) print("Image width = " .. data.values.w) print("Image height = " .. data.values.h) end
hope that help's you
|
|
|
Post by zenkrye on Dec 14, 2017 15:15:06 GMT
This looks to be exactly what I am looking for. The existsClick work if I pass a string, does it work with Pattern?
Also, the Image:setDebug does not see to turn on highlights. Is there a way to set the length of time the highlight will show? Below is an example that I am trying to get working.
PSR = { Menu ={ P = Pattern("Menu.png"), S = "Menu.png", R = Region(839, -44, 150, 150), }, Dungeon ={ P = Pattern("Dungeon.png"), S = "Dungeon.png", R = Region(163, 579, 150, 150), }, }
dialogInit() addCheckBox("cbDebug", "Debug", false) Image:setDebug(cbDebug) dialogShow("Debug")
Image:R(PSR.Menu.R):existsClick(PSR.Menu.S, 3) Image:R(PSR.Dungeon.R):existsClick(PSR.Dungeon.P, 3)
|
|
|
Post by Mercobots on Dec 14, 2017 15:46:08 GMT
yes both exists and existsClick works like before and accept the same parameters
Let me check the Image:setDebug(bool) to see what is wrong
EDIT place Image:setDebug(cbDebug) after dialogShow("Debug")
dialogInit() addCheckBox("cbDebug", "Debug", false) dialogShow("Debug") Image:setDebug(cbDebug)
|
|
|
Post by zenkrye on Dec 14, 2017 15:58:44 GMT
That was it. Thank you. This is just what I was looking for.
|
|
|
Post by Mercobots on Dec 14, 2017 16:08:36 GMT
i just uploaded a new one Debugger.zipnow you can set the highlight time Image:setTime(seconds) just for the record when a match is found , the debugger show you the match and target, if you set time to 5 the match highlight will show for 5 seconds and the target Highlight for 2.5 , the target is always the half time
|
|
|
Post by Mercobots on Dec 14, 2017 17:50:52 GMT
don't use it too much until the launch of last version
Will be ready in a few hours
|
|
|
Post by zenkrye on Dec 14, 2017 20:46:28 GMT
I grabbed it right away and started using it. I will let you know if I find an issue and keep checking for updates.
|
|
|
Post by Mercobots on Dec 15, 2017 3:04:45 GMT
|
|