Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- F8::
- Dropping: ; Скинуть 12 вещей из рюкзака наемника на землю
- If not Wincheck() {
- Return
- }
- Gosub, ScrollPanes ;прокрутить инвентарь в поисках свободного места
- FreeCells := FindFreeCells() ;получить массив свободных ячееек
- ; бросаем
- MouseGetPos, OutputVarX, OutputVarY
- Xbox := (OutputVarX - 274)//72
- Ybox := (OutputVarY - 36)//32
- ;MsgBox, %Xbox%, %Ybox%
- Xpoz := 32-38
- Ypoz := 262-24
- ArrayCount = 0
- ; FreeCells := Object()
- Loop, 3
- {
- Xpoz += 38
- Loop, 4
- {
- Ypoz += 24
- ; если ячейка не пустая
- If ColorCheck(Xpoz-15,Ypoz+10)
- {
- ArrayCount += 1
- ; MsgBox % "ArrayCount = " . ArrayCount . ", FreeCells.Count = " . FreeCells.Count . ", сумма = " . ArrayCount + FreeCells.Count
- ; exit
- If ArrayCount+0 > FreeCells.Count+0
- {
- ; MsgBox % "ArrayCount = " . ArrayCount . ", FreeCells.Count = " . FreeCells.Count
- ; exit
- SendPlay {Click 562, 343} ; клик на кнопке прокрутки - к следующей панели
- FreeCells := FindFreeCells() ;получить массив свободных ячееек
- ArrayCount = 1
- }
- ; хватаем
- SendPlay {ShiftDown}
- SendPlay {Click %Xpoz%, %Ypoz%}
- SendPlay {ShiftUp}
- Sleep 50
- ; бросаем
- ; x1 := 274+Xbox*72+36
- ; y1 := 36+Ybox*32+16
- x1 := 276 + (FreeCells[ArrayCount].X - 1) * 72 + 36
- y1 := 58 + (FreeCells[ArrayCount].Y - 1) * 32 - 16
- ; MsgBox %y1%
- ; exit
- SendPlay {Click %X1%, %Y1%}
- ; MsgBox, x1 = %X1%, y1 = %Y1%
- Sleep 50
- ; Ybox++
- ; If Ybox>8 {
- ; Ybox := 0
- ; Xbox++
- ; }
- ; If Xbox>4 {
- ; Return
- ; }
- }
- }
- Ypoz := 262-24
- }
- Return
- ; проверка названия активного окна
- Wincheck() {
- WinGetTitle, Title, A
- ;MsgBox, Сейчас активно окно "%Title%"
- If Title = Jagged Alliance 2
- {
- ;MsgBox, Название совпало
- Return True
- }
- }
- ; проверка цвета нижнего пикселя лайфбара ячейки - есть ли в ней предмет.
- ColorCheck(X,Y) {
- PixelGetColor, color, X, Y, Slow ;BGR
- Blue:="0x" SubStr(color,3,2) ;substr is to get the piece
- Blue:=Blue+0 ;add 0 is to convert it to the current number format
- If Blue > 80
- {
- Return True
- }
- }
- ;прокрутить инвентарь в поисках свободного места
- ScrollPanes:
- PixelGetColor, color, 564, 314, Slow ;проверка крайней ячейки
- Blue:="0x" SubStr(color,3,2) ;substr is to get the piece
- Blue:=Blue+0 ;add 0 is to convert it to the current number format
- If Blue > 80
- {
- SendPlay {Click 562, 343} ; клик на кнопке прокрутки - к следующей панели
- Gosub, ScrollPanes ;выполнить следующую проверку
- }
- Return
- ;поиск свободных ячеек
- FindFreeCells() {
- FreeCells := Object()
- FreeCellsCount := 0
- X0 := 276
- Y0 := 58
- Loop, 5 {
- X1 := A_Index
- Xpos := X0 + (A_Index - 1) * 72
- Loop, 9 {
- Y1 := A_Index
- Ypos := Y0 + (A_Index - 1) * 32
- If Not ColorCheck(Xpos,Ypos) {
- FreeCellsCount += 1
- FreeCells[FreeCellsCount] := {X: X1, Y: Y1} ; ассоциативный массив
- }
- }
- }
- FreeCells.Count := FreeCellsCount
- ; MsgBox % "X = " . FreeCells[1].X . ", Y = " . FreeCells[1].Y . ", FreeCellsCount = " . FreeCellsCount . ", FreeCells.Count = " . FreeCells.Count
- ; Exit
- Return FreeCells
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement