Поиск по пикселю

Помощь в написании скриптов
gatsuga
Posts: 3
Joined: 28 Aug 2018, 13:26

Поиск по пикселю

10 Oct 2018, 09:50

Есть код, простой аимлок. Однако как его дополнить так, чтобы при движении мыши она не лочилась на пиксель, а допустим лочилась со смещением на x - 5, z + 10 от пикселя и т.п?

Code: Select all

;/ ----------------------------------------------------------------------------
; Script Version Version: 1.0
; Author: 4573216
; Script Function: QuakeLive Aim Automatronamaton
;/ ----------------------------------------------------------------------------
#Persistent
#KeyHistory, 0
#NoEnv
#HotKeyInterval 1
#MaxHotkeysPerInterval 127
#InstallKeybdHook
#UseHook
#SingleInstance, Force
SetKeyDelay,-1, 8
SetControlDelay, -1
SetMouseDelay, -1
SetWinDelay,-1
SendMode, InputThenPlay
SetBatchLines,-1
ListLines, Off
CoordMode, Pixel, Screen, RGB
CoordMode, Mouse, Screen
PID := DllCall("GetCurrentProcessId")
Process, Priority, %PID%, Normal
 
EMCol := 0x00FF00
ColVn := 96
ZeroX := 840
ZeroY := 525
CFovX := 128
CFovY := 128
ScanL := ZeroX - CFovX
ScanR := ZeroX + CFovX
ScanT := ZeroY - CFovY
ScanB := ZeroY + CFovY
 
Loop, {
GetKeyState, Mouse2, RButton, P
PixelSearch, AimPixelX, AimPixelY, ScanL, ScanT, ScanR, ScanB, EMCol, ColVn, Fast RGB
GoSub GetAimOffset
GoSub GetAimMoves
GoSub MouseMoves
;GoSub DebugTool
GoSub SleepF
}
 
GetAimOffset:
 AimX := AimPixelX - ZeroX
 AimY := AimPixelY - ZeroY
  If ( AimX > 0 ) {
   DirX := 1
  }
  If ( AimX < 0 ) {
   DirX := -1
  }
  If ( AimY > 0 ) {
   DirY := 1
  }
  If ( AimY < 0 ) {
   DirY := -1
  }
 AimOffsetX := AimX * DirX
 AimOffsetY := AimY * DirY
Return
 
GetAimMoves:
 RootX := Ceil(( AimOffsetX ** ( 1 / 2 )))
 RootY := Ceil(( AimOffsetY ** ( 1 / 2 )))
 MoveX := RootX * DirX
 MoveY := RootY * DirY
Return
 
MouseMoves:
If ( Mouse2 == "D" ) {
 DllCall("mouse_event", uint, 1, int, MoveX, int, MoveY, uint, 0, int, 0)
 }
Return
 
SleepF:
SleepDuration = 6
TimePeriod = 1
DllCall("Winmm\timeBeginPeriod", uint, TimePeriod)
Iterations = 4
StartTime := A_TickCount
Loop, %Iterations% {
    DllCall("Sleep", UInt, TimePeriod)
}
DllCall("Winmm\timeEndPeriod", UInt, TimePeriod)
Return
 
DebugTool:
;MouseGetPos, MX, MY
;ToolTip, %AimOffsetX% | %AimOffsetY%
;ToolTip, %AimX% | %AimY%
;ToolTip, %IntAimX% | %IntAimY%
;ToolTip, %RootX% | %RootY%
;ToolTip, %MoveX% | %MoveY% || %MX% %MY%
Return
 
!x::
Reload
Return
gatsuga
Posts: 3
Joined: 28 Aug 2018, 13:26

Re: Поиск по пикселю

11 Oct 2018, 16:43

Неужели никто не сможет помочь?

Return to “Помощь”

Who is online

Users browsing this forum: No registered users and 16 guests