사용자 도구


AutoHotKey

매크로 프로그램 중 가장 강력한 기능을 자랑하는 프로그램. 다른 매크로 프로그램과는 달리 스크립트 언어를 이용하여 매크로를 만든다. 온라인 게임 자동 사냥에도 많이 쓰이는 프로그램이라 게임 제작 업체에게는 골치 아픈 존재.

예제

다음은 디아블로3의 자동 사냥 예제1)이다.

;실행 단축키는 Home 입니다
;종료는 X 입니다
$win = "디아블로 III"

WinActivate($win, "")

Global $Paused
Global $i = 0, $j = 0
Global $hgame = 8 ;여기 설정된 숫자만큼 눅눅이 잡은 후 상인에게 수리받음
Global $sellmagic = False ;True 로 수정하면 매직템 줍고, 상점에 팔고
Global $gamelog = False ;True 로 수정하면 구글드라이브 로그 남김 기능 작동

HotKeySet("{Home}", "Leave") ;시작키
HotKeySet("{End}", "Pause") ;일시정지
HotKeySet("x", "Stop") ;중지

$go = True
$Leave = False

ToolTip("방을 만든 후" & @CRLF & "HOME 키를 누르면 시작합니다", 0, 0)

While $go
        If ($Leave) Then

                ingame()

        EndIf
WEnd

Func error_check() ; <--- 방만들기 실패 체크
        $game1 = Hex(PixelGetColor(286, 273), 6) ;오류메세지 확인
        If $game1 = "000000" Then
                write_log(10)
                ToolTip("Failed to create Game", 0, 0)
                Sleep(1000)
                Send("{Enter}")
                Sleep(10000)
                MouseClick("left", 189, 254) ;게임 계속하기
                Sleep(3000)
        EndIf
EndFunc   ;==>error_check

Func ingame()
        $game = Hex(PixelGetColor(239, 614), 6)
        If $game = "000000" Then
                write_log(1)
                ToolTip("", 0, 0)
                gogogo()
        Else
                ToolTip("Not in game", 0, 0)
                Sleep(1000)
                error_check()
        EndIf
EndFunc   ;==>ingame

Func repair()
        If $j < $hgame Then
                $j = $j + 1
        Else
                MouseClick("left", 688, 48) ;상인한테 가기
                Sleep(2300)
                MouseClick("left", 510, 150) ;상인한테
                Sleep(2400)

                If $sellmagic = True Then
                        clearbag() ; 비우기
                EndIf


                MouseClick("left", 296, 299) ;수리탭
                Sleep(500)
                MouseClick("left", 200, 356) ;수리하기
                Sleep(500)
                MouseClick("left", 286, 31) ;창닫기
                Sleep(500)
                $j = 0

                If $sellmagic = True Then
                        gotochest() ; 창고로 이동
                EndIf
        EndIf

EndFunc   ;==>repair

Func gotochest()
        MouseClick("left", 170, 514) ; 보관함 이동
        Sleep(3000)
        MouseClick("left", 93, 493) ; 보관함 클릭
        Sleep(3000)
        MouseClick("left", 292, 227) ; 두번째 가방 클릭
        Sleep(1200)

        clearbag() ; 보관하기
        Sleep(1500)
        MouseClick("left", 286, 31) ;창닫기
EndFunc   ;==>gotochest

Func clearbag() ;  인벤 위에서부터 4줄(40칸) 다 비움
        Local $row = 0, $line = 0, $x = 531, $y = 361
        While $line < 4
                While $row < 10
                        MouseClick("right", $x, $y)
                        $x = $x + 28
                        $row = $row + 1
                WEnd
                $row = 0
                $line = $line + 1
                $y = $y + 27
                $x = 531
        WEnd
EndFunc   ;==>clearbag

Func gogogo()

        If checkdie() = 1 Then
                Send("4")
                Sleep(500)
                MouseMove(222, 69, 1)
                Send("m")

                Sleep(2000)
                MouseMove(32, 303, 1)
                Send("2")
                Send("m")
                Sleep(1600)
                MouseMove(32, 303, 1)
                Send("m")
                Sleep(300)
                Send("1")
                Sleep(1400)
                Send("1")
                MouseMove(32, 303, 1)
                Send("m")
                Sleep(1700)
                Send("3")
                Send("1")

                Sleep(300)
                Local $Pixel02 = PixelSearch(655, 100, 700, 140, 0xEBC02C, 14);눅눅 열렸는지 확인
                If Not @error Then
                        MouseClick("left", 160, 97, 1) ;눅눅 들어가기
                        Sleep(500)
                        Send("2")
                        Sleep(2500)
                        Local $Pixel02 = PixelSearch(655, 100, 720, 150, 0xD4813E, 14);눅눅 열렸는지 확인
                        If @error Then
                                If checkdie() = 1 Then
                                        MouseClick("left", 139, 493, 1)
                                        Sleep(2500)
                                        MouseClick("left", 205, 278, 1)
                                        Sleep(2000)
                                        MouseMove(287, 195, 1) ; sara
                                        Send("4")
                                        Sleep(200)
                                        Send("{shiftdown}")

                                        MouseDown("right")
                                        Sleep(6000)
                                        MouseUp("right")

                                        MouseDown("left")
                                        Sleep(8000)


                                        MouseUp("left")

                                        Send("{shiftup}")

                                        MouseMove(262, 189)
                                        Send("m") ;담비가 골드 줍는 동안 대기
                                        Sleep(1000)
                                        Send("4")
                                        Sleep(3000)
                                        loot()
                                        Send("4")
                                        Sleep(3000)
                                        Send("t")
                                        Sleep(8000)
                                        repair()
                                        quitgame()
                                Else
                                        write_log(12)
                                        quitgame()
                                EndIf
                        Else
                                write_log(12)
                                quitgame()
                        EndIf
                Else
                        If checkdie() = 1 Then
                                write_log(2)
                                MouseClick("left", 560, 40) ;위로 이동 후 귀환
                                Sleep(200)
                                Send("2")
                                Sleep(1600)
                                Send("1")
                                Sleep(600)
                                Send("t")
                                Sleep(9500)
                                quitgame()
                        EndIf
                EndIf
        EndIf
EndFunc   ;==>gogogo


Func loot()
        checkrare()
        checkseti()
        checkmagic()
        checklegend()
        checkgems()
EndFunc   ;==>loot

Func checkmagic()
        If $sellmagic = True Then
                Send("{Alt}") ; 매직아이템 찾기
                Sleep(500)
                Local $count = 0

                Local $magic = PixelSearch(166, 125, 620, 436, 0x6969FF, 5)
                While IsArray($magic) = True And $count < 5
                        $magic = PixelSearch(166, 125, 620, 436, 0x6969FF, 5)
                        If IsArray($magic) = True Then
                                MouseMove($magic[0], $magic[1], 1)
                                Sleep(500)
                                MouseClick("left", $magic[0], $magic[1])
                                Sleep(1000)
                        EndIf
                        $count = $count + 1
                        ;;;;;write_log(7)
                WEnd
        EndIf

EndFunc   ;==>checkmagic

Func checkseti()
        Send("{Alt}") ; 세트 아이템 찾기
        Sleep(500)
        Local $count = 0
        Local $setitem = PixelSearch(166, 125, 620, 436, 0x00FF00, 2)
        While IsArray($setitem) = True And $count < 5
                $setitem = PixelSearch(166, 125, 620, 436, 0x00FF00, 2)
                If IsArray($setitem) = True Then
                        MouseMove($setitem[0], $setitem[1], 1)
                        Sleep(500)
                        MouseClick("left", $setitem[0], $setitem[1])
                        Sleep(1400)
                        ;;write_log(7)
                EndIf
                $count = $count + 1
        WEnd
EndFunc   ;==>checkseti


Func checkrare()
        Send("{Alt}") ; 노란템 찾기
        Sleep(500)
        Local $count = 0
        Local $rare = PixelSearch(166, 125, 620, 436, 0xFFFF00, 2)
        While IsArray($rare) = True And $count < 5
                $rare = PixelSearch(166, 125, 620, 436, 0xFFFF00, 2)
                If IsArray($rare) = True Then
                        MouseMove($rare[0], $rare[1], 1)
                        Sleep(500)
                        MouseClick("left", $rare[0], $rare[1])
                        Sleep(1400)
                        write_log(7)
                EndIf
                $count = $count + 1
        WEnd
EndFunc   ;==>checkrare

Func checklegend();전설템 찾기
        Local $count = 0
        Local $Pixel2 = PixelSearch(166, 125, 620, 436, 0x2F64BF, 2)
        While IsArray($Pixel2) = True And $count < 5
                $Pixel2 = PixelSearch(166, 125, 620, 436, 0x2F64BF, 2)
                If IsArray($Pixel2) = True Then
                        MouseMove($Pixel2[0], $Pixel2[1], 1)
                        Sleep(500)
                        MouseClick("left", $Pixel2[0], $Pixel2[1])
                        Sleep(1400)
                        ;write_log(8)
                EndIf
                $count = $count + 1
        WEnd
EndFunc   ;==>checklegend

Func checkgems()
        $count = 0
        Local $ameth = PixelSearch(166, 125, 620, 436, 0xAC6DE9, 8)
        While IsArray($ameth) = True And $count < 5
                $ameth = PixelSearch(166, 125, 620, 436, 0xAC6DE9, 8)
                If IsArray($ameth) = True Then
                        MouseMove($ameth[0], $ameth[1], 1)
                        Sleep(500)
                        MouseClick("left", $ameth[0], $ameth[1])
                        Sleep(1400)
                        write_log(3)
                EndIf
                $count = $count + 1
        WEnd
        $count = 0
        Local $Ruby = PixelSearch(166, 125, 620, 436, 0xFE8C81, 5)
        While IsArray($Ruby) = True And $count < 5
                $Ruby = PixelSearch(166, 125, 620, 436, 0xFE8C81, 5)
                If IsArray($Ruby) = True Then
                        MouseMove($Ruby[0], $Ruby[1], 1)
                        Sleep(500)
                        MouseClick("left", $Ruby[0], $Ruby[1])
                        Sleep(1400)
                        write_log(5)
                EndIf
                $count = $count + 1
        WEnd
        $count = 0
        Local $Emer = PixelSearch(166, 125, 620, 436, 0x63D753, 8)
        While IsArray($Emer) = True And $count < 5
                $Emer = PixelSearch(166, 125, 620, 436, 0x63D753, 8)
                If IsArray($Emer) = True Then
                        MouseMove($Emer[0], $Emer[1], 1)
                        Sleep(500)
                        MouseClick("left", $Emer[0], $Emer[1])
                        Sleep(1400)
                        write_log(4)
                EndIf
                $count = $count + 1
        WEnd
        $count = 0
        Local $Topa = PixelSearch(166, 125, 620, 436, 0xFFFF49, 2)
        While IsArray($Topa) = True And $count < 5
                $Topa = PixelSearch(166, 125, 620, 436, 0xFFFF49, 2)
                If IsArray($Topa) Then
                        MouseMove($Topa[0], $Topa[1], 1)
                        Sleep(500)
                        MouseClick("left", $Topa[0], $Topa[1])
                        Sleep(1400)
                        write_log(6)
                EndIf
                $count = $count + 1
        WEnd
EndFunc   ;==>checkgems


Func checkdie()
        Local $Died = PixelSearch(535, 205, 556, 234, 0xFFFFFF, 1)
        If Not @error Then
                write_log(9)
                Call("quitgame")
                Call("ingame")
                Return 2
        EndIf
        Return 1
EndFunc   ;==>checkdie


Func quitgame()
        Send("{esc}")
        Sleep(200)
        MouseClick("left", 425, 310) ;게임 나가기
        Sleep(13000)
        If $i < 40 Then
                $i = $i + 1
                Sleep(Random(1000, 3000)) ;방 만들기 전 2초~5초간 대기
                MouseClick("left", 189, 254) ;게임 계속하기
                Sleep(3000)
        Else
                $i = 0
                ToolTip("쉬는 시간입니다 -0-", 0, 0)
                write_log(0)
                Sleep(Random(200000, 300000)) ;20방 돌고나서 300초에서 400초간 대기
                MouseClick("left", 189, 254) ;게임 계속하기
                Sleep(3000)
        EndIf

EndFunc   ;==>quitgame

Func write_log($val)
        $path = '\Google Drive\log.txt'
        $file = FileOpen(@UserProfileDir & $path, 1)
        $timestamp = @YEAR & "." & @MON & "." & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC
        If $gamelog = True Then
                Select
                        Case $val = 1
                                $text = "방을 만들었습니다"
                        Case $val = 2
                                $text = "눅눅이가 외출중입니다"
                        Case $val = 3
                                $text = "자수정 입니다"
                        Case $val = 4
                                $text = "에메랄드 입니다"
                        Case $val = 5
                                $text = "루비 입니다"
                        Case $val = 6
                                $text = "토파즈 입니다"
                        Case $val = 7
                                $text = "레어 아이템을 획득했습니다"
                        Case $val = 8
                                $text = "전설 아이템을 획득했습니다"
                        Case $val = 9
                                $text = "죽었습니다  형님 ㅠㅠ"
                        Case $val = 0
                                $text = "----- 쫌만 쉬었다가 하겠습니다 -----"
                        Case $val = 10
                                $text = "<<<방 만들기 실패>>>"
                        Case $val = 12
                                $text = "Failed to enter cellar"
                EndSelect

                FileWriteLine($file, $timestamp & "        " & $text)
                FileClose($file)
        EndIf

EndFunc   ;==>write_log

Func Pause()
        $Leave = False
EndFunc   ;==>Pause

Func Stop()
        Exit
EndFunc   ;==>Stop

Func Leave()
        $Leave = True
EndFunc   ;==>Leave

참고