openBa()
{
CoordMode, Pixel, Screen
WinGetPos, pos_x,pos_y, width, height, BlueStacks App Player
x_right := width + pos_x
y_bottom := height + pos_y
While(true)
{
ImageSearch,FoundX,FoundY,%pos_x%,%pos_y%,%x_right%,%y_bottom%, *50 %A_ScriptDir%\lib\common\battle.bmp
if (ErrorLevel = 0)
{
hideclick(FoundX,FoundY)
RandSleep(1000,1500)
hideclick2(600,90)
RandSleep(1000,1500)
break
}
}
}
Battle()
{
CoordMode, Pixel, Screen
WinGetPos, pos_x,pos_y, width, height, BlueStacks App Player
x_right := width + pos_x
y_bottom := height + pos_y
G1:=0
G2:=0
G3:=0
While(true)
{
ImageSearch,FoundX,FoundY,%pos_x%,%pos_y%,%x_right%,%y_bottom%, *50 %A_ScriptDir%\lib\Battle\ready.bmp
if (ErrorLevel = 0)
{
hideclick(FoundX,FoundY)
break
}
}
While(true)
{
ImageSearch,FoundX,FoundY,%pos_x%,%pos_y%,%x_right%,%y_bottom%, *50 %A_ScriptDir%\lib\Battle\start.bmp
if (ErrorLevel = 0)
{
hideclick(FoundX,FoundY)
RandSleep(5000,5500)
ImageSearch,FoundX,FoundY,%pos_x%,%pos_y%,%x_right%,%y_bottom%, *50 %A_ScriptDir%\lib\Battle\fail.bmp ;상태창 확인
if (ErrorLevel = 0)
{
hideclick(FoundX,FoundY)
superback()
RandSleep(1000,2000)
IniWrite,1,lib/Setting.ini,Mode,Battle
Reload
}
break
}
}
RandSleep(1000,2000)
While(true)
{
ImageSearch,FoundX,FoundY,%pos_x%,%pos_y%,%x_right%,%y_bottom%, *50 %A_ScriptDir%\lib\Battle\re.bmp ;재시작
if (ErrorLevel = 0)
{
hideclick(FoundX,FoundY)
RandSleep(5000,5500)
ImageSearch,FoundX,FoundY,%pos_x%,%pos_y%,%x_right%,%y_bottom%, *50 %A_ScriptDir%\lib\Adventure\quest.bmp ;업적달성
if (ErrorLevel = 0)
hideclick(FoundX,FoundY)
break
}
}
}
골드방부분으로 함수를 통해 불러오는식으로 정리했어요