넷게임

오토핫키 초심자가 전문가의 도움이 필요합니다 본문

카테고리 없음

오토핫키 초심자가 전문가의 도움이 필요합니다

시스이 2020. 4. 2. 14:33

#NoEnv

#Persistent

#SingleInstance, Force

#KeyHistory, 0

#InstallKeybdHook

#UseHook

#HotKeyInterval 1 

#MaxHotkeysPerInterval 127


CoordMode, pixel, screen

CoordMode, mouse, screen



F6::

Loop

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\10.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 250

Send {x down}

Sleep, 750

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\11.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 250

Send {x down}

Sleep, 658

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\12.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 250

Send {x down}

Sleep, 582

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\13.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 250

Send {x down}

Sleep, 518

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\14.bmp

if(ErrorLevel = 0)

{

    while GetKeyState("space", "P")

{

Send, z

Sleep, 250

Send {x down}

Sleep, 463

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\15.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 200

Send {x down}

Sleep, 465

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\16.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 200

Send {x down}

Sleep, 423

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\17.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 200

Send {x down}

Sleep, 387

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\18.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 200

Send {x down}

Sleep, 354

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\19.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 200

Send {x down}

Sleep, 325

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\20.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 200

Send {x down}

Sleep, 300

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\21.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 150

Send {x down}

Sleep, 324

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\22.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 150

Send {x down}

Sleep, 303

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\23.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 150

Send {x down}

Sleep, 283

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\24.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 150

Send {x down}

Sleep, 265

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\25.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 150

Send {x down}

Sleep, 0

Send {x up}

}

}

else

{

return

}

}}}}}}}}}}}}}}}}


return


F10::

{

ExitApp

}


보시다시피 위의 매크로는 특정 이미지가 하나 확인되면 스페이스 바를 누를시 그 이미지에 맞춰 반복되는 명령을 실행합니다. 그런데 스페이스바를 누르는 와중에 다른 이미지가 확인되면 그 이미지에 해당되는 명령을 실행시키고 싶습니다만 그럴려면 스페이스바를 잠시 떼었다가 다시 눌러야 되더군요.


while GetKeyState("space", "P")

{

Send, z

Sleep, 250

Send {x down}

Sleep, 750

Send {x up}

break

}


이렇게 While문 끝에 break를 넣으면 스페이스바를 계속 누르고있어도 변하는 이미지에 맞춰 다른 명령이 실행되긴 합니다만 처음부터 다시 이미지를 검색하고 명령을 실행해서 그런지 반복되는 명령 사이에 공백시간이 생겨 명령이 매끄럽게 반복되지 않습니다.


이런 문제를 해결하고싶은데 제 머리론 아무리 굴려봤자 좋은 해답이 나오질 않네요. 처음부터 잘못된 명령어를 사용한건가 싶기도 하고... 전문가의 도움이 필요합니다 :(


답글

Comments