돌키우기 매크로찾는분이 많아서 제가만든거 많이부족하지만 참고하시라고 올려드립니다.

매우 소스가 조잡하오니 참고만하세요..(미완성, 돌합치기는 됩니다.) 문제되면 삭제할게요

비활성 서치 방식은 아니구요 터치드래그 기능만 ADB방식으로 구현되있습니다. 

KOPLAYER 1.4.1055버전에서 테스트 했습니다.




#NoEnv 
#SingleInstance force


#Persistent
OnExit, Clean_up

Gui, Add, GroupBox, x10 y20 w250 h120 , 돌합치기 ON/OFF
Gui,Add,CheckBox,x20 y40 w80 h20 v조약돌 checked, 조약돌
Gui,Add,CheckBox,x100 y40 w100 h20 v주먹돌 checked, 주먹돌
Gui,Add,CheckBox,x20 y60 w80 h20 v바위 checked, 바위
Gui,Add,CheckBox,x100 y60 w100 h20 v수비표창 checked, 수비표창
Gui, Add,Button, x210 y80 w40 h30, 로그
Gui,Add,CheckBox,x20 y80 w80 h20 v일비표창 checked, 일비표창
Gui,Add,CheckBox,x100 y80 w100 h20 v세잎클로버 checked, 세잎클로버
Gui,Add,CheckBox,x20 y100 w80 h20 v네잎클로버 checked, 네잎클로버
Gui,Add,CheckBox,x100 y100 w100 h20 v장풍, 장풍
Gui,Add,Text, x170 y120 w87 h15,Made by 깜장별
Gui, Add, Button, x30 y150 w60 h30 v시작 , 시작
Gui, Add, Button, x100 y150 w60 h30 , 재시작
Gui, Add, Button, x170 y150 w60 h30 , 종료
Gui, Add,Text, x10 y190 w150 h15, F2 : 일시정지
Gui,Add,Text, x150 y190 w160 h15 v매크로상태, 매크로상태 : 대기
Gui, 2:Add, ListView, x10 y10 w250 h160 , 시간 | 로그

; Generated using SmartGUI Creator for SciTE
Gui, Show, w270 h220 ,돌키우기 마카롱



;==============================================================global변수

global adb := "C:\Program Files (x86)\KOPLAYER\Tools\adb.exe"
global adbIP := "127.0.0.1:6555"
global imageCount := 0
global Title:= "KOPLAYER 1.4.1055" 

;==============================================================cmd상주



Attach:
DetectHiddenWindows, on
Run, %comspec% /k ,,Hide UseErrorLevel, cPid
WinWait, ahk_pid %cPid%,, 10
DllCall("AttachConsole","uint",cPid)
hCon:=DllCall("CreateFile","str","CONOUT$","uint",0xC0000000,"uint",7,"uint",0,"uint",3,"uint",0,"uint",0)
global objShell := ComObjCreate("WScript.Shell")
return

Clean_up:
DllCall("CloseHandle", "uint", hCon)
DllCall("FreeConsole")
Process, Close, %cPid%
ExitApp

;==============================================================함수

;로그작성함수
WriteLog(msg){
FormatTime, nowTime, ,MM-dd HH:mm:ss
LV_Add("",nowTime,+msg)
LV_ModifyCol()
}


;ADB 드래그함수
ADB_Drag(x1,y1,x2,y2,duration){
    
    objExec := objShell.Exec(adb " -s " adbIP " shell input swipe " x1 " " y1 " " x2 " " y2 " " duration)
    
}

;발견이미지 개수 카운트
M_ImageCount(image){
result:=MultipleImagesearch(0,0,A_ScreenWidth,A_ScreenHeight,image)
;imageCount :=result

Loop,Parse,result,`n
{
If A_LoopField=  ;잘라진문자열을 참조할수있다.  안에 문자열이없으면 
{
imageCount := A_Index-1
Break
} ;문자열없으면 break
}
return imageCount
}


M_ImageSearch(image,imageCount){ ;이미지 2개서치후 드래그  돌합치기
dir:="image/start.bmp" ;앱플레이어의 상대적위치를 계산하기위해서
Imagesearch,s_x,s_y,0,0,A_ScreenWidth,A_ScreenHeight,%dir%
;MsgBox,%s_x%,%s_y%
result:=MultipleImagesearch(0,0,A_ScreenWidth,A_ScreenHeight,image)

Loop,Parse,result,`n ;문자열을 지정의 단락 문자로 분할하고, 각각 대해 반복 처리
{ ; x a yi 으로 잘렸다.
If (imageCount<2 || A_Index==3){  ; 이미지가  2개까지만  중복서치되도록
Break
} ;문자열없으면 break
StringSplit,Pos,A_LoopField,a ;a 단위로자른다 x y 분리
;ToolTip,%A_Index%,%Pos1%,%Pos2%,%A_Index%
if(mod(A_Index,2)==1){
x1:=pos1-s_x
y1:=pos2-s_y-40
}else if(mod(A_Index,2)==0){
x2:=pos1-s_x
y2:=pos2-s_y-40
}
}
;MsgBox,%x1%,%y1%,%x2%,%y2%
if(x1!="" && x2!=""){
ADB_Drag(x1,y1,x2,y2,"300") ;드래그
return false
}else return true
}


;==============================================================시작


F2::
{
GuiControl,,매크로상태,매크로상태 : 일시정지
    Gui,Submit,nohide
pause
}
return

F3:: ;테스트용
{
SetBatchLines,-1
CoordMode,Pixel,Screen
CoordMode,ToolTip,Screen
ImageCount:= M_ImageCount("image/stone.bmp")
M_ImageSearch("image/stone.bmp",ImageCount)
sleep,200

return
}

Button로그:
{
Gui,2:Show,w270 h220, 로그
return
}


button시작:
{
GuiControl,Disable,시작
GuiControl,Disable,조약돌
GuiControl,Disable,주먹돌
GuiControl,Disable,바위
GuiControl,Disable,수비표창
GuiControl,Disable,일비표창
GuiControl,Disable,세잎클로버
GuiControl,Disable,네잎클로버
GuiControl,Disable,장풍
GuiControl,,매크로상태,매크로상태 : 시작
    Gui,Submit,nohide
;체크박스 미구현
SetBatchLines,-1
CoordMode,Pixel,Screen
CoordMode,ToolTip,Screen

while(1){

ImageCount:= M_ImageCount("image/stone.bmp")
M_ImageSearch("image/stone.bmp",ImageCount)
sleep,400
ImageCount:= M_ImageCount("image/stone2.bmp")
M_ImageSearch("image/stone2.bmp",ImageCount)
sleep,400
ImageCount:= M_ImageCount("image/stone3.bmp")
M_ImageSearch("image/stone3.bmp",ImageCount)
sleep,400
ImageCount:= M_ImageCount("image/stone4.bmp")
M_ImageSearch("image/stone4.bmp",ImageCount)
sleep,400
ImageCount:= M_ImageCount("image/stone5.bmp")
M_ImageSearch("image/stone5.bmp",ImageCount)
sleep,400
ImageCount:= M_ImageCount("image/stone6.bmp")
M_ImageSearch("image/stone6.bmp",ImageCount)
sleep,400
ImageCount:= M_ImageCount("image/stone7.bmp")
M_ImageSearch("image/stone7.bmp",ImageCount)
sleep,400
ImageCount:= M_ImageCount("image/stone8.bmp")
M_ImageSearch("image/stone8.bmp",ImageCount)
sleep,400
ImageCount:= M_ImageCount("image/stone9.bmp")
M_ImageSearch("image/stone9.bmp",ImageCount)
sleep,400
ImageCount:= M_ImageCount("image/stone10.bmp")
M_ImageSearch("image/stone10.bmp",ImageCount)
}


return
}

Button재시작:
{
Reload
return
}
Button종료:
{
ExitApp
}




MultipleImagesearch(xs,ys,xl,yl,image)
{
pos=     ;pos 초기화
xss:=xs
yss:=ys
loop
{
Imagesearch,x,yi,%xss%,%yss%,%xl%,%yl%,%image%
If Errorlevel=1
Break
pos=%pos%%x%a%yi%`n   ; = 는 이어붙이기니까 pos에  기존꺼랑 그 이미지 위치저장됨 x a yi `n 순
;처음은 그냥 이미지서치
loop
{
xss:=x+1 ;x좌표에 1씩더해서  중복서치를 없앤다.
If xss=%xl%
Break
Imagesearch,x,y,%xss%,%yss%,%xl%,%yl%,%image%
If Errorlevel=1
Break
pos=%pos%%x%a%y%`n
}
xss:=xs
yss:=yi+1
If yss=%yl%
Break
}
Sort,pos,u  ;u 차례대로 정렬하고 중복을없앤다.
return pos
}

GuiClose:
ExitApp




G3xT4in.gif



답글