get("#356") -- num2hex w, h = img.width, img.height barw = 15 -- scrollbar width mx = math.floor(barw/2) -- in the middle stepx, stepy = mx, 4 function topOK(x, y1, enabled) for y=y1-1, math.max(y1-stepy-16, 0), -1 do for xx = math.max(0, x-mx), math.min(w-1, x+mx) do local p = img.getInt(xx, y) if p == (enabled and 0x000000 or 0x777777) then return true end end end return false end for x = w-mx, mx, -stepx do last, slider, background1, background2, top = nil for y = 0, h-1, stepy do pix = img.getInt(x, y) if last ~= pix then if slider == nil and (last == 0xEAEAEA and y > starty+stepy) then print("possible slider: "..starty.."-"..(y-stepy)) if top ~= nil or topOK(x, starty, false) then print("slider") if top == nil then top = starty end slider = x..", "..starty..", "..(x+1)..", "..(y-stepy) bottom = y end elseif last == 0xD3D3D3 and y > starty+stepy then print("possible background found: "..starty.."-"..(y-stepy)) if top ~= nil or topOK(x, starty, true) then print("background") if top == nil then top = starty end bg = x..", "..starty..", "..(x+1)..", "..(y-stepy) if slider then background2 = bg else background1 = bg end bottom = y end end last, starty = pix, y end --print("y", y, num2hex(pix)) if background2 then goto raus end end ::raus:: if slider then upArrow = x..", "..(top-stepy-2)..", "..(x+1)..", "..(top-stepy-1) downArrow = x..", "..bottom..", "..(x+1)..", "..(bottom+1) parts = {} table.insert(parts, "Up arrow="..upArrow) if background1 then table.insert(parts, "Background1="..background1) end table.insert(parts, "Slider="..slider) if background2 then table.insert(parts, "Background2="..background2) end table.insert(parts, "Down arrow="..downArrow) return "Vertical scrollbar found: "..table.concat(parts, "|") end end