Post by Mercobots on Dec 15, 2017 2:59:51 GMT
[Mercobots] Says Goodbye: Products Discontinued
Hello
A new tool is available to help while scripting, the DebugMyScript.zip
This tool highlight all images match and regions you use at your script
Version 1.1
Getting Started
Incude DebugMyScript.luac
dofile(scriptPath().."DebugMyScript.luac")
now just tape Image:findFunction
Result - if image found highlight image match and image target.
Image:exists("img.png")
You can use region as well
Result - if image found highlight region ,image match and image target.
Image:R(myRegion):exists("img.png")
Image information
All find operation returns the same results and accepts the same parameters defined by ankulua!
To get image data use Image:getData() after a successfully find operation
Data table structure
Image table contain the image width ,height and starting x/y (upper left corner)
humanoid_region contain the region of possible click
Region appears if region has been provided
data = {
match = match Obj,
score = value,
region = {
obj = Region,
x = value,
y = value,
w = value,
h = value,
},
target = {
obj = Location,
x = value,
y = value,
},
center = {
obj = Location,
x = value,
y = value,
},
image = {
x = values,
y = values,
w = values,
h = values,
},
humanoid = {
x = values,
y = values,
w = values,
h = values,
},
}
Highlights colors
Region - translucent purple
Humanoid Region - translucent white
Match - Yellow Square
Click(target) - Red Square
Methods/Operations
i only implemented 3 ankulua find operation for now , exists(), existsClick() and findAll()
Note findAll() uses findAllNoFindException() , highlight all matchs
Image:findAll("myImage")
but if you use a region, findAll() uses regionFindAllNoFindException(), the result will be the same
Image:R(myRegion):findAll("myImage")
Humanoid
Perform a random click in a given region, this is good to avoid bot detection!
This can work with a given region or image region and mixed with Pattern('img'):targetOffset()
Image size is used by default if no region is given
using a region H(w,h)
Image:H(100,100):R(myRegion):findAll("myImage")
Disable individual humanoid H(string)
Image:H('none'):R(myRegion):findAll("myImage")
Using a pattern , be careful because the region will move according the target
Image:H('none'):findAll(Pattern("myImage"):targetOffset(10,10))
General functions
Image:highlightActive(boolean)
Turn on/off highlights, if off also turn off showImgName()
Image:highlightTime(int)
Highlight the region, match and target by defined time.
Image:showImgName(boolean)
Show image name
Image:humanoidActive(boolean)
Turn on/off humanoid clicks
Image:getData()
returns data table
Image:getLastMatch()
returns last match within region or not , a match table is returned when using findall()
Image:menu()
show DebugMyScript settings at startup
To create your own menu, try something like this
function myMenu()
dialogInit()
newRow()
addCheckBox("UI_highlight_active", "highlight show", true)
--
newRow()
addTextView("highlight show Time") addEditNumber("UI_highlight_time", 2)
--
newRow()
addCheckBox("UI_show_img_name", "Show Name", true)
--
newRow()
addCheckBox("UI_active_humanoid", "Active Humanoid", true)
--
dialogShow()
Image:highlightActive(UI_highlight_active)
Image:highlightTime(UI_highlight_time)
Image:showImgName(UI_show_img_name)
Image:humanoidActive(UI_active_humanoid)
end
myMenu()
Quick Example
dofile(scriptPath() .. "DebugMyScript.luac")
local myRegion = Region(0, 0, 0, 0)
local myImage = "myImage.png"
-- EX 1
-- ========================================
Image:menu()
if Image:R(myRegion):existsClick(myImage) then
local d = Image:getData()
print(d, 'Image Data')
end
-- EX 2
-- ========================================
-- set config without menu
Image:highlightActive(true)
Image:highlightTime(4)
Image:showImgName(false)
Image:humanoidActive(true)
--
if Image:R(myRegion):existsClick(myImage) then
img = Image:getData()
print("Image score" .. img.score)
myNewRegion = Region(img.region.x - 10, img.region.y - 10, img.region.w - 20, img.region.h + 20)
end
if Image:R(myNewRegion):existsClick(myImage) then
print(Image:getData(), "myNewRegion Data")
end
-- EX 2 - using humanoid
-- ========================================
if Image:H(100,100):R(myRegion):existsClick(myImage) then
img = Image:getData()
print("Humanoid Region" .. img.humanoid_region[1])
end
[Mercobots] Says Goodbye: Products Discontinued