Skip to content

Instantly share code, notes, and snippets.

@kizernis
Last active September 2, 2018 12:22
Show Gist options
  • Save kizernis/86914f79a72b6a05c1bebbabd47b26c0 to your computer and use it in GitHub Desktop.
Save kizernis/86914f79a72b6a05c1bebbabd47b26c0 to your computer and use it in GitHub Desktop.
#NoEnv
SendMode Input
#Persistent
CoordMode Pixel
SetControlDelay -1
global nDeadBodies := 0
#IfWinActive, ahk_exe Nox.exe
1::
; еда
MouseClick, , 538, 712, , 0
Return
2::
; лидиацид
MouseClick, , 648, 712, , 0
; ControlClick, x648 y712, NoxPlayer, , , , NA
Return
3::
; бинт
MouseClick, , 758, 712, , 0
SoundPlay, %A_WinDir%\Media\chord.wav, WAIT
Return
4::
; волк
MouseClick, , 868, 712, , 0
Return
5::
; атака
MouseClick, , 1225, 767, , 0
Return
6::
; крестик в правом верхнем углу
MouseClick, , 1331, 66, , 0
Return
7::
nDeadBodies = 0
; закрываем погодные сообщения
SetTimer, close_weather_popups, 5000
Loop
{
; лечимся если рана или болезнь
ImageSearch, , , 61, 207, 61 + 50, 207 + 50, *100 images\hunt\red cross (61,207 50x50).png
if ErrorLevel = 0
{
SoundPlay, *48
; красный крест
;MouseClick, , 84, 232, , 0
ControlClick, x84 y232, NoxPlayer, , , , NA
Sleep, 1000
Loop
{
ImageSearch, FoundX, FoundY, 65, 156, 65 + 13, 156 + 576, *100 images\hunt\wound (65,156 13x68).png
if ErrorLevel != 0
Break
FoundX := FoundX + 222
FoundY := FoundY + 34
ControlClick, x%FoundX% y%FoundY%, NoxPlayer, , , , NA
Sleep, 500
ImageSearch, FoundX, FoundY, 1105, 155, 1105 + 83, 155 + 579, *100 images\hunt\heal (1105,469 83x47).png
if ErrorLevel != 0
{
SoundPlay, %A_WinDir%\Media\chord.wav, WAIT
Break 2
}
FoundX := FoundX + 99
FoundY := FoundY + 23
ControlClick, x%FoundX% y%FoundY%, NoxPlayer, , , , NA
Sleep, 2000
; если есть ещё одна кнопка "лечить", то останавливаемся
ImageSearch, FoundX, FoundY, 1105, 155, 1105 + 83, 155 + 579, *100 images\hunt\heal (1105,469 83x47).png
if ErrorLevel = 0
{
SoundPlay, %A_WinDir%\Media\chord.wav, WAIT
Break 2
}
}
; крестик, закрывающий "здоровье"
ControlClick, x1327 y110, NoxPlayer, , , , NA
Sleep, 1000
}
; бинтуемся если кровотечение 3, 4 или 5
ImageSearch, , , 1331, 38, 1331 + 28, 38 + 28, *100 images\hunt\bleeding 3 (1331,38 28x28).png
if ErrorLevel != 0
ImageSearch, , , 1331, 38, 1331 + 28, 38 + 28, *100 images\hunt\bleeding 4 (1331,38 28x28).png
if ErrorLevel != 0
ImageSearch, , , 1331, 38, 1331 + 28, 38 + 28, *100 images\hunt\bleeding 5 (1331,38 28x28).png
if ErrorLevel = 0
{
; бинт
;MouseClick, , 758, 712, , 0
ControlClick, x758 y712, NoxPlayer, , , , NA
Sleep, 200
Loop
{
ImageSearch, , , 1331, 38, 1331 + 28, 38 + 28, *100 images\hunt\bleeding 0 (1331,38 28x28).png
if ErrorLevel = 0
Break
Sleep, 100
}
}
; едим (и пьём?) если истощение 5 или 6
ImageSearch, , , 182, 38, 182 + 28, 38 + 28, *100 images\hunt\exhaustion 5 (182,38 28x28).png
if ErrorLevel != 0
ImageSearch, , , 182, 38, 182 + 28, 38 + 28, *100 images\hunt\exhaustion 6 (182,38 28x28).png
if ErrorLevel = 0
{
; еда
;MouseClick, , 538, 712, , 0
ControlClick, x538 y712, NoxPlayer, , , , NA
Sleep, 100
Loop
{
ImageSearch, , , 340, 38, 340 + 61, 38 + 28, *100 images\hunt\hunger 0 (340,38 61x28).png
if ErrorLevel = 0
Break
Sleep, 100
}
}
; принимаем лидиацид если усталость 50 или 51
ImageSearch, , , 739, 38, 739 + 39, 38 + 28, *100 images\hunt\fatigue 50 (739,38 39x28).png
if ErrorLevel != 0
ImageSearch, , , 739, 38, 739 + 39, 38 + 28, *100 images\hunt\fatigue 51 (739,38 39x28).png
if ErrorLevel = 0
{
; лидиацид
;MouseClick, , 648, 712, , 0
ControlClick, x648 y712, NoxPlayer, , , , NA
Sleep, 2000
}
Loop
{
; волк
;MouseClick, , 868, 712, , 0
ControlClick, x868 y712, NoxPlayer, , , , NA
Sleep, 100
ImageSearch, , , 1090, 711, 1090 + 75, 711 + 75, *200 images\hunt\attack (1090,711 75x75).png
if ErrorLevel = 0
Break
}
Loop
{
; атака
;MouseClick, , 1225, 767, , 0
ControlClick, x1225 y767, NoxPlayer, , , , NA
Sleep, 100
ImageSearch, , , 1305, 40, 1305 + 53, 40 + 53, *100 images\hunt\close button (1305,40 53x53).png
if ErrorLevel = 0
Break
}
; подсчитываем количество туш
ImageSearch, , , 604, 46, 604 + 193, 46 + 40, *200 *TransBlack images\hunt\victory (604,46 193x40).png
if ErrorLevel = 0
{
nDeadBodies++
if nDeadBodies = 8
{
SoundPlay, %A_WinDir%\Media\notify.wav, WAIT
Break
}
}
Sleep, 100 ; для очень редких случаев несрабатывания
; крестик в правом верхнем углу
;MouseClick, , 1331, 66, , 0
ControlClick, x1331 y66, NoxPlayer, , , , NA
Sleep, 100
Loop
{
ImageSearch, , , 625, 34, 625 + 47, 34 + 38, *100 images\hunt\eye (625,34 47x38).png
if ErrorLevel = 0
Break
}
}
Return
#IfWinActive
F10::
; ImageSearch, , , 1090, 711, 1090 + 75, 711 + 75, *220 images\hunt\attack (1090,711 75x75).png
; ImageSearch, , , 65, 156, 65 + 13, 156 + 576, *100 images\hunt\wound (65,156 13x68).png
; ImageSearch, , , 1105, 155, 1105 + 83, 155 + 579, *100 images\hunt\heal (1105,469 83x47).png
; ImageSearch, , , 61, 207, 61 + 50, 207 + 50, *100 images\hunt\red cross (61,207 50x50).png
/*
ImageSearch, FoundX, FoundY, 519, 533, 519 + 366, 628 + 64, *100 images\hunt\ok button (519,533 366x64).png
if ErrorLevel != 0
MsgBox %ErrorLevel%
else
MsgBox %FoundX%, %FoundY%
*/
/*
ImageSearch, , , 739, 38, 739 + 39, 38 + 28, *100 images\hunt\fatigue 50 (739,38 39x28).png
if ErrorLevel != 0
ImageSearch, , , 739, 38, 739 + 39, 38 + 28, *100 images\hunt\fatigue 51 (739,38 39x28).png
MsgBox %ErrorLevel%
*/
ImageSearch, , , 604, 46, 604 + 193, 46 + 40, *200 *TransBlack images\hunt\victory (604,46 193x40).png
MsgBox %ErrorLevel%
Return
F12::
; SetTimer, stop_when_tired, 200
; ControlClick, x221 y248, ahk_class MSPaintApp ;,, Left, 1, NA
; ControlClick, x1331 y66, NoxPlayer, , , 1, NA
SetTimer, close_weather_popups, 5000
Return
/*
stop_when_tired:
ImageSearch, , , 739, 38, 739 + 39, 38 + 28, *200 images\hunt\fatigue 11 (739,38 39x28).png
if ErrorLevel = 0
{
MouseClick, , 484, 562, , 0
SoundPlay, %A_WinDir%\Media\chord.wav, WAIT
SetTimer, , Delete
}
Return
*/
close_weather_popups:
ImageSearch, FoundX, FoundY, 519, 533, 519 + 366, 628 + 64, *100 images\hunt\ok button (519,533 366x64).png
if ErrorLevel = 0
{
FoundX := FoundX + 183
FoundY := FoundY + 32
; MouseClick, , %FoundX% + 23, %FoundY% + 23, , 0
ControlClick, x%FoundX% y%FoundY%, NoxPlayer, , , , NA
;SetTimer, , Delete
SoundPlay, *48
}
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment