2017-04-08 7 views
0

こんにちは私はこのスクリプトではちょっと新しく、マクロアプリケーションからオートメーションスクリプトを作成しようとしています/オートロタッチと呼ばれる言語を使用しているloy言語https://autotouch.net/server/doc/en.html#autotouch-document ゼロから始めたいところはどこですか?画面全体での色を探して は、 スクリプトはループがあまりにも具体的ではありません。このルア基本的なループ方法は?

loop 
color = PixelSearch(x coord, y coord, #somergbColor codes) 
If (color) is found in screen then 
    tap it 

else 
    tap teleport skill/walk to search for target button 

endif 
endloop 

end 

答えて

0

に似て、それをタップします。 AutoTouchによって提供されたfindColor(color, count, region)またはgetColor(x, y)を使用する2つの2つの方法で内部アクションを実行できます(私の意見では返品の価値のため、オクテットサイズがより速いのが理想です)。しかし、問題は開発者がもちろん、より小さい整数と符号なし整数を処理するためのバイト配列API)。

findColor()はあなたの色を見つけたい場合は手動でgetColor()を使用することができ、..だからのみ、最大で1つのピクセルを見つけるに

local target = 0x447111; 
local location = findColor(target, 1); 
local first = location[1]; 

if location and first then 
    touchDown(1, first[1], first[2]); 
else 
    -- I don't understand this action? 
end 

を制限されています。

local target = 0x447111; 
local w, h = getScreenResolution(); 

local broken = false; 

for y = 1, h do 
    for x = 1, w do 
     local cur = getColor(x, y); 
     if cur == target then 
      broken = true; 
      break; 
     end 
    end 
    if broken then 
     break; 
    end 
end 

if broken then 
    touchDown(1, 1, 1); 
end