Post by yamada on Jun 6, 2017 10:27:20 GMT
[Auto Script] Fire Emblem - Training tower automatic laps (Pattern 4) Download! >> DoWnload Fire Emblem << - Free Source code - Works with Android with Auto resolution - use DAEMON - AnkuluaPro2 v7.0.0 or above Screenshot data is included in the download file. This script is created with AutoMainPNG. >>> Manual of AutoMainPNG <<< >>> AutoMainPNG main page <<< The translation function is on the left |
AnkuLua folder <= Fire_Emblem2.lua only. A png file is unnecessary for this script. |
--説明 ページ
--http://capsulecontents.client.jp/
Settings:setScriptDimension(true, 1080)
Settings:setCompareDimension(true, 1080)
IfSet=20 -- 画像認識のしきい値 大きいほどあいまいになる
--フルスクリーン用
setImmersiveMode(true)
--split 指定文字に分解する
function split(str, del)
p, nrep = str:gsub("%s*"..del.."%s*", "")
return { str:match((("%s*(.-)%s*"..del.."%s*"):rep(nrep).."(.*)")) }
end
-- 他の画面サイズに対して修正する ww,hh
function XYren(xx,yy)
ww=1
hh=1
return {math.floor(xx*ww+0.5),math.floor(yy*hh+0.5)}
end
-- ankulua用 getColors
function getColors(list)
local colors = {}
local r, g, b = getColor(Location(list[1][1], list[1][2]))
colors[1] = r * 256 * 256 + g * 256 + b
usePreviousSnap(true)
for i = 2, #list do
r, g, b = getColor(Location(list[i][1], list[i][2]))
colors[i] = r * 256 * 256 + g * 256 + b
end
usePreviousSnap(false)
return colors
end
-- 取得した画像をチェック R G Bに分解し判定
function RGBchek(a,b)
local r1,g1,b1 = intToRgb(a)
local ra1,ga1,ba1 = intToRgb(b)
if math.abs(ra1-r1) <= IfSet then
if math.abs(ga1-g1) <= IfSet then
if math.abs(ba1-b1) <= IfSet then
return 1
end
end
end
return 0
end
-- RGBを分解
function intToRgb(val)
local GetRed = val % 256
val= ( val - GetRed ) / 256
local GetGreen = val % 256
val= ( val - GetGreen ) / 256
local GetBlue = val % 256
return GetBlue,GetGreen,GetRed
end
gColor = {}
gColor.new = function()
local obj ={}
local obj_name = {"Select" , "color_a" , "color_b"
, "tap" , "name" , "GC", "value"
, "color_c" , "color_d"}
for i,v in pairs(obj_name) do
obj[v] = {}
end
obj.index = 0
obj.GCset = function(self)
local a = split(self,"^")
for i,v in pairs(a) do
local a = split(v,",")
obj.index = obj.index + 1
obj["Select"][obj.index] = a[1]
obj["color_a"][obj.index] = a[2]
obj.GC[obj.index*2-1] = XYren(a[3],a[4])
obj["color_b"][obj.index] = a[5]
obj.GC[obj.index*2] = XYren(a[6],a[7])
obj["tap"][obj.index] = a[8]
obj["name"][obj.index] = a[9]
end
end
obj.GCfaind = function()
local rgb = getColors(obj.GC)
obj.value={}
for i=1 , obj.index do
obj.value[i] = {RGBchek(rgb[i*2-1],obj.color_a[i]) ,
RGBchek(rgb[i*2],obj.color_b[i])}
end
end
obj.GCGet = function()
local rgb = getColors(obj.GC)
obj.color_c = {}
obj.color_d = {}
for i=1 , obj.index do
obj["color_c"][i] = rgb[i*2-1]
obj["color_d"][i] = rgb[i*2]
end
end
obj.GCtap = function(self)
local txy = split(obj.tap[self],"_")
txy = XYren(txy[1],txy[2])
click(Location(txy[1],txy[2]))
end
return obj
end
gColor_Dat = {}
gColor_Dat = gColor.new() -- 初期化、インスタンス作成
--画面情報とタップデータ
dat =
"174711,0xD9D3B8,115,1431,0xA39377,444,1473,267_1371,dumy^"..
"174616,0x214C5B,519,1730,0x366B7D,526,1709,546_1626,dumy^"..
"073052,0x4B686B,994,1755,0x9ADBB0,259,1131,534_1087,dumy^"..
"073104,0x452227,1022,59,0x678D95,1068,1821,899_73,dumy^"..
"073112,0xCE1D3B,983,1793,0x8BF1F2,119,1906,121_1823,dumy^"..
"073117,0x680E1E,984,1792,0xB3F3F4,199,1047,521_986,dumy^"..
"073123,0x668C95,977,1225,0x670E1D,984,1793,537_941,dumy^"..
"075320,0x678D95,978,1309,0x9ADBB0,261,1062,527_1028,dumy^"..
"070839,0x518EA2,987,757,0xFEFAF0,540,1799,539_1362,dumy^"..
"071037,0x678D95,978,1311,0x9ADBB0,808,1204,546_1158,dumy^"..
"070821,0x678D95,978,1438,0x9ADBB0,818,1330,535_1294,dumy^"..
"071046,0x96D8AD,261,1069,0x678D95,978,1178,534_1028,dumy^"..
"071100,0x678D95,978,1451,0x8DD2A6,259,1340,538_1304,dumy^"..
"071446,0xFFFFE4,174,976,0x400912,985,1791,521_974,dumy^"..
"114313,0x678D95,978,1289,0x53A677,213,1027,542_1003,dumy^"..
"122509,0x678D95,978,1388,0x79C395,816,1136,536_1110,dumy^"..
"132920,0x88CEA1,817,1344,0x678D95,978,1455,516_1309,dumy^"..
"143538,0x90D4A7,262,1085,0x668C95,977,1332,555_1041,dumy^"..
"154554,0x668C95,977,1155,0x8DD2A6,818,1045,513_1010,dumy"
gColor_Dat.GCset(dat) --検索データーセット
-- タップ前に実施する
function Tap_Mae(con)
--###DATATAPMAE###
return
end
-- タップ後に実施する
function Tap_Ato(con)
--###DATATAPATO###
return
end
--###DATATHANSU###
finGS = 0
doloopB = true
while doloopB do
gColor_Dat.GCfaind() --座標の色情報検索
IF_Exit = 0 -- タップ前に実施した内容により登録タップを飛ばす。
for con = 1 , gColor_Dat.index do
if (gColor_Dat.value[con][1] + gColor_Dat.value[con][2]) == 2 then
Tap_Mae(con) -- タップ前に実施する
if IF_Exit ~= 1 then
gColor_Dat.GCtap(con)
Tap_Ato(con) -- タップ後に実施する
break
end
end
end
wait(1)
end