1

Тема: AHK: MySumka: sumka := 185 Разбор кода

Ребят, недавно стал разбираться в ahk, встретился такой код:

; <COMPILER: v1.1.30.01>
#SingleInstance,Force
CoordMode, Mouse, Screen
Menu, tray, NoStandard
Menu, tray, add, Закрыть, Exit
sumka := 65
inv_sum1 := 250
inv_sum2 := 215
gui, font, s9, Arial
Gui, Add, Checkbox, gMySumka, Сумка надета.
Gui, Add, Text, , F5 - перезагрузка`nF9 - выключить паузу`nF8 - включить паузу
Gui, Add, Text, cGreen, F7 - включить бота
Gui, Add, Text, cRed, F2 - выключить бота
Gui, Show, xCenter yCenter w170 h150
return
GuiEscape:
GuiClose:
ExitApp
return
MySumka:
sumka := 185
inv_sum1 := 365
inv_sum2 := 330
return
F5::
Reload
return
F9::
Pause, Off
return
F8::
Pause, On
return
F7::
inv_x1 := round( A_ScreenWidth-300 )
inv_y1 := round( ( A_ScreenHeight/2 )-inv_sum1 )
inv_x2 := round( A_ScreenWidth-250 )
inv_x22 := 20
inv_y2 := round( ( A_ScreenHeight/2 )-inv_sum2 )
udo_x := round( A_ScreenWidth-425 )
udo_y := round( ( A_ScreenHeight/2 )-sumka )
mouse_x := round( ( A_ScreenWidth/2 )+92 )
mouse_y := round( ( A_ScreenHeight/2 )+( A_ScreenHeight/3 )+8 )
ready_x1 := round( ( A_ScreenWidth/2 )-315 )
ready_y1 := round( A_ScreenHeight-63 )
ready_x2 := round( ( A_ScreenWidth/2 )-305 )
ready_y2 := round( A_ScreenHeight-59 )
Loop {
Label1:
sleep, 500
BlockInput, SendAndMouse
SendInput, {sc17}
BlockInput, Default
sleep 1500
ImageSearch,,, inv_x1, inv_y1, inv_x2-inv_x22, inv_y2, *TransBlack *50 10.png
if ( ErrorLevel = "0" ) {
sleep, 500
SoundBeep, 400, 800
SoundBeep, 400, 800
return
}
ImageSearch,,, inv_x1, inv_y1, inv_x2, inv_y2, *TransBlack *50 99.png
if ( ErrorLevel = "0" ) {
sleep, 500
SoundBeep, 400, 800
SoundBeep, 400, 800
return
}
ImageSearch,,, inv_x1, inv_y1, inv_x2, inv_y2, *TransBlack *50 98.png
if ( ErrorLevel = "0" ) {
sleep, 500
SoundBeep, 400, 800
SoundBeep, 400, 800
return
}
ImageSearch,,, inv_x1, inv_y1, inv_x2, inv_y2, *TransBlack *50 97.png
if ( ErrorLevel = "0" ) {
sleep, 500
SoundBeep, 400, 800
SoundBeep, 400, 800
return
}
BlockInput, SendAndMouse
Click right %udo_x%, %udo_y%
BlockInput, Default
sleep, 1000
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, *50 robot.png
if ( ErrorLevel = "0" ) {
SoundBeep, 1200
SoundBeep, 900
SoundBeep, 1200
SoundBeep, 890
SoundBeep, 700
SoundBeep, 890
SoundBeep, 600
}
sleep, 5000
Label2:
PixelGetColor, color, mouse_x, mouse_y, RGB
Var1 = %color%
if ( Var1 = 0xFF0000 or Var1 = 0xFA0000 or Var1 = 0xFB0000 or Var1 = 0xF90000 or Var1 = 0xFE0000 or Var1 = 0xFD0000 ) {
Loop 2 {
Send {Click}
sleep 50
}
Goto, Label2
}
else {
PixelSearch, x, y, ready_x1, ready_y1, ready_x2, ready_y2, 0x97FA04, 3, Fast RGB
if ( ErrorLevel = "0" ) {
Goto, Label1
}
else {
Goto, Label2
}
}
}
return
F2::
Exit:
ExitApp
return

.

Не могу понять как тут работает следующее:

sumka := 65
inv_sum1 := 250
inv_sum2 := 215
MySumka:
sumka := 185
inv_sum1 := 365
inv_sum2 := 330
inv_x1 := round( A_ScreenWidth-300 )
inv_y1 := round( ( A_ScreenHeight/2 )-inv_sum1 )
inv_x2 := round( A_ScreenWidth-250 )
inv_x22 := 20
inv_y2 := round( ( A_ScreenHeight/2 )-inv_sum2 )
udo_x := round( A_ScreenWidth-425 )
udo_y := round( ( A_ScreenHeight/2 )-sumka )
mouse_x := round( ( A_ScreenWidth/2 )+92 )
mouse_y := round( ( A_ScreenHeight/2 )+( A_ScreenHeight/3 )+8 )
ready_x1 := round( ( A_ScreenWidth/2 )-315 )
ready_y1 := round( A_ScreenHeight-63 )
ready_x2 := round( ( A_ScreenWidth/2 )-305 )
ready_y2 := round( A_ScreenHeight-59 )

Помогите пожалуйста разобраться.

2

Re: AHK: MySumka: sumka := 185 Разбор кода

uran612 А что конкретно не понятно?


; Параметры по умолчанию при условии что сумка не надета
sumka := 65 
inv_sum1 := 250
inv_sum2 := 215

MySumka: ;метка при нажатии на кнопку "Сумка надета" устанавливает новые параметры
sumka := 185
inv_sum1 := 365
inv_sum2 := 330

inv_x1 := round( A_ScreenWidth-300 )
inv_y1 := round( ( A_ScreenHeight/2 )-inv_sum1 )
inv_x2 := round( A_ScreenWidth-250 )
inv_x22 := 20
inv_y2 := round( ( A_ScreenHeight/2 )-inv_sum2 )
udo_x := round( A_ScreenWidth-425 )
udo_y := round( ( A_ScreenHeight/2 )-sumka )
mouse_x := round( ( A_ScreenWidth/2 )+92 )
mouse_y := round( ( A_ScreenHeight/2 )+( A_ScreenHeight/3 )+8 )
ready_x1 := round( ( A_ScreenWidth/2 )-315 )
ready_y1 := round( A_ScreenHeight-63 )
ready_x2 := round( ( A_ScreenWidth/2 )-305 )
ready_y2 := round( A_ScreenHeight-59 )
;Обычный расчет координат для поиска изображений с округлением round

3

Re: AHK: MySumka: sumka := 185 Разбор кода

andrey.a.polyakov.b2c

sumka := 65 
inv_sum1 := 250
inv_sum2 := 215

Что именно значат эти параметры и как их выставлять?

4

Re: AHK: MySumka: sumka := 185 Разбор кода

andrey.a.polyakov.b2c

И что именно значат inv, udo, mouse и ready в коде?

inv_x1 := round( A_ScreenWidth-300 )
inv_y1 := round( ( A_ScreenHeight/2 )-inv_sum1 )
inv_x2 := round( A_ScreenWidth-250 )
inv_x22 := 20
inv_y2 := round( ( A_ScreenHeight/2 )-inv_sum2 )
udo_x := round( A_ScreenWidth-425 )
udo_y := round( ( A_ScreenHeight/2 )-sumka )
mouse_x := round( ( A_ScreenWidth/2 )+92 )
mouse_y := round( ( A_ScreenHeight/2 )+( A_ScreenHeight/3 )+8 )
ready_x1 := round( ( A_ScreenWidth/2 )-315 )
ready_y1 := round( A_ScreenHeight-63 )
ready_x2 := round( ( A_ScreenWidth/2 )-305 )
ready_y2 := round( A_ScreenHeight-59 )

5

Re: AHK: MySumka: sumka := 185 Разбор кода

uran612 пишет:

встретился такой код

uran612, а где он вам встретился? Это чей-то взломанный код для какой-то игры?

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

6

Re: AHK: MySumka: sumka := 185 Разбор кода

teadrinker

Для gta 5 rp чтобы рыбачить, знакомый который разбирается в этом дал код.

7

Re: AHK: MySumka: sumka := 185 Разбор кода

Для игр у нас есть специальная ветка, переношу.
А знакомый откуда взял? И почему бы вам у него и не спросить, если он разбирается?

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

8

Re: AHK: MySumka: sumka := 185 Разбор кода

uran612 udo координаты куда должна кликать мышка судя из кода:


Click right %udo_x%, %udo_y%

mouse координаты по которым определяется цвет пикселя:


PixelGetColor, color, mouse_x, mouse_y, RGB

inv координаты в которых осуществляется поиск картинок:


ImageSearch,,, inv_x1, inv_y1, inv_x2-inv_x22, inv_y2, *TransBlack *50 10.png
ImageSearch,,, inv_x1, inv_y1, inv_x2, inv_y2, *TransBlack *50 99.png
ImageSearch,,, inv_x1, inv_y1, inv_x2, inv_y2, *TransBlack *50 98.png
ImageSearch,,, inv_x1, inv_y1, inv_x2, inv_y2, *TransBlack *50 97.png

Ну и ready координаты в которых сверяется цвет пикселя с цветом 0x97FA04 (Зеленый):


PixelSearch, x, y, ready_x1, ready_y1, ready_x2, ready_y2, 0x97FA04, 3, Fast RGB

9

Re: AHK: MySumka: sumka := 185 Разбор кода

andrey.a.polyakov.b2c, вообще-то взлом кода у нас не поощряется.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

10

Re: AHK: MySumka: sumka := 185 Разбор кода

uran612

Если не понимаете сами - спросите автора бота, либо своего друга. Разбирать чужой код при этом нагло сворованный - нехорошо. Толку от того, что вам объяснят для чего та или иная переменная, вы сами ничего всё равно не сможете изменить толком.

Win10x64, AHK v1.1.37.01 (Unicode 64-bit) | AHK-Wiki | Переменные и выражения | RegEx101

11

Re: AHK: MySumka: sumka := 185 Разбор кода

teadrinker, так я ни чего не взламывал )) Я отвечаю по его коду что он опубликовал.

12

Re: AHK: MySumka: sumka := 185 Разбор кода

teadrinker, __Михаил__ Человек разрешил взять его код. https://imgur.com/a/kMYW4Pb