美神恶魔 发表于 2020-3-28 20:32

全境封锁2 自动连发/自动射击/后坐力补偿 AHK脚本

原作者外网,debug了一下,修复了自动射击开关并且把自动射击的判定按键改为鼠标右键Rbutton
原帖搜auto-fire/auto-recoil关键词

将J添加为游戏左键射击按键
侧键mouse-4是自动连发,O/ctrl+O调整连发速度
小键盘+-调整后坐力补偿
F3脚本开关/F4自动射击开关

脚本里调整自动射击的识别范围与颜色
默认1080P下,鼠标中心左右50像素,上下10像素
分辨率越高请增加像素增大识别范围
0x3636F4是颜色R244 G54 B54
如果增大区域依旧不能自动射击,请截图提取准星RGB数值替换

使用方法,下载autohotkey,右键脚本Run Script开启后可测试,点击鼠标左键,会自动往下移动,按住侧键会自动按频率输入JJJJJJJJ

**** Hidden Message *****
全代码如下,可自行复制保存为.ahk文件
;#####################
;#=====Commands====#
;#####################
SetWorkingDir %A_ScriptDir%
#NoEnv
#InstallKeybdHook
#InstallMouseHook
#KeyHistory 0
#UseHook
#MaxThreadsPerHotkey 1
#MaxThreads 30
#MaxThreadsBuffer on
SendMode Input
ListLines, Off
PID := DllCall("GetCurrentProcessId")
Process, Priority, %PID%, High
SendMode Input
CoordMode, Pixel, Screen
CoordMode, Mouse, Screen

;#####################
;#====Initialization====#
;#####################
global _enabled := 0
global _autofire := 0
global _downVal = 2
global _rightVal = 0
global _rampdown = 1
global _shotdelay=0
global _readytofire = 1
global _timerRunning = 0
global crosshairX =
global crosshairY =

;####################
;#=====Hotkeys=====#
;####################
~F3:: ; Turn script on/off
_enabled := ! _enabled
_autofire = 0
ShowToolTip("Script Enabled= "_enabled)
return

~F4:: ;Change triggerbot to singleshot OR enable autofire if you also turn up duration with o / ctrl-o
_autofire := ! _autofire
ShowToolTip("Autofire= "_autofire)
return

~NumpadAdd:: ; Adds compensation.
_downVal := _downVal + 1
ShowToolTip("Downward compensation= " . _downVal)
return

~NumpadSub:: ; Substracts compensation.
if _downVal > 0
{
      _downVal := _downVal - 1
      ShowToolTip("Downward compensation= " . _downVal)
}
return

~^NumpadAdd:: ; Adds right adjust
_rightVal := _rightVal + 1
ShowToolTip("Right(+)/Left(-)= " . _rightVal)
return

~^NumpadSub:: ; Adds left adjust
_rightVal := _rightVal - 1
ShowToolTip("Right(+)/Left(-)= " . _rightVal)
return

~o:: ; Single shot timer up (zero is always fire)
_shotdelay := _shotdelay + 25
ShowToolTip("Single Shot Delay up= " _shotdelay)
Return

~^o:: ; Single shot timer down (zero is always fire)
if _shotdelay > 0
{
      _shotdelay := _shotdelay - 25
      ShowToolTip("Single Shot Delay down= " _shotdelay)
}
return

~LButton::lessrecoil()
~RButton::lessrecoil_triggerbot();"RButton" is mouse 2.If you change this, make sure you replace every RButton in the script.
~Joy10::lessrecoil_triggerbot_xbox()

;####################
;======Functions======
;####################
lessrecoil()
{
      While GetKeyState("LButton")
      {
                sleep 10
                if _enabled
                {
                        ApplyReduction()
                }
                sleep 10
      }
      return
}
;==================
lessrecoil_triggerbot()
{
      While GetKeyState("RButton")
      {
                {
                        if _enabled
                        {
                              if CrosshairCheck()
                              {
                                        TryToFire()
                                        ApplyReduction()
                              }
                        }
                }
      }
      Send, {j up}
      sleep 10
      _timerRunning = 0
      _readytofire = 1
      return
}
;==================
lessrecoil_triggerbot_xbox()
{
      While GetKeyState("Joy10")
      {
                {
                        if _enabled
                        {
                              if CrosshairCheck()
                              {
                                        TryToFire()
                                        ApplyReduction()
                              }
                        }
                }
      }
      Send, {j up}
      sleep 10
      _timerRunning = 0
      _readytofire = 1
      return
}
;==================
ApplyReduction()
{
      DllCall("mouse_event",uint,1,int,_rightVal,int,_downVal,uint,0,int,0)
      Sleep 20
      DllCall("mouse_event",uint,1,int,_rightVal,int,_downVal,uint,0,int,0)
      Sleep 20
      return
}
;==================
CrosshairCheck() ; returns as "true" if either autofire, or crosshair is found.
{
      if _autofire = 0
                return false
      else
      {
                crosshairX =
                MouseGetPos, mX, mY
                x1 :=(mX-50)
                x2 :=(mX+50)
                y1:=(mY-10)
                y2 :=(mY+10)
                PixelSearch, crosshairX, crosshairY, x1, y1, x2, y2, 0x3636F4, 0, Fast
      }
      if crosshairX > 0 ;this will be set to either the x coord of the red found, or "1" if the triggerbot is turned off.
      {
                return true
      }
      else{
                Send, {j up}
                sleep 10
                return false
      }
}
;==================
TryToFire()
{
      if _shotdelay = 0
      {
                Send, {j down}
                return
      }
      else
      {
                if _readytofire = 1
                {
                        Send, {j up}
                        sleep 25
                        Send, {j down}
                        _readytofire = 0
                        ShotTimer()
                        return
                }
                else
                {
                        ShotTimer()
                        return
                        
                }
                ShotTimer()
                if _shotdelay > 0
                {
                        Send, {j up}
                        ShotTimer()
                        Sleep 20
                }
                else
                {
                        _readytofire = 1
                }
      }
}
;==================
ShotTimer()
{
      
      if _timerRunning = 0
      {
                SetTimer, ShotWait, %_shotdelay%
                _timerRunning = 1
                return
      }
      else
                return
      ShotWait:
      SetTimer, ShotWait, Off
      _timerRunning = 0
      _readytofire = 1
      return
}
;==================
ShowToolTip(Text)
{
      ToolTip, %Text%
      SetTimer, RemoveToolTip, 3000
      return
      RemoveToolTip:
      SetTimer, RemoveToolTip, Off
      ToolTip
      return
}
;==================






丨反游猫丨 发表于 2020-3-30 14:33

感谢分享~!!!~!~!~!~!~!

John″提托_ 发表于 2020-3-30 21:16

66666666666666666

pang00736 发表于 2020-3-31 14:39

666666666666666666666666666666

zb1988zty2000 发表于 2020-3-31 14:57

感谢大佬

qyj0335 发表于 2020-3-31 16:32

感谢分享!!

jiaoi2010 发表于 2020-3-31 18:05

fefdsfddgfsfdsefwefw

天上掉肉饼 发表于 2020-3-31 19:10

marvinset 发表于 2020-3-31 20:09

ding。。。。。。。。。。。。

ag588588 发表于 2020-4-1 12:24

11166666666

uuu0k2008 发表于 2020-4-2 00:37

111111111111111111

lostlost2004 发表于 2020-4-2 20:59

如果您要查看本帖隐藏内容请回复

789123520 发表于 2020-4-2 21:51

4545664564566456

kissme822 发表于 2020-4-3 03:37

666666666666666666

lockedleftwing 发表于 2020-4-5 04:11

6666666666

wzk1211 发表于 2020-4-5 05:17

kkkkkkkkkkkkkkkkkkkkkkkkkkkkk

打酱油6_6 发表于 2020-4-5 08:41

感谢分享

淑酥酥 发表于 2020-4-5 12:36

66666666666666

吉尔伽美什ァ 发表于 2020-4-5 20:36

666666666666

kong0009 发表于 2020-4-5 21:46

66666666666

柠檬的幻想 发表于 2020-4-6 01:54

这脚本可以啊,不然单排太难受

nervrock 发表于 2020-4-6 23:01

{:3_91:}{:3_91:}

ccboby 发表于 2020-4-7 14:10

111111111111111111111111111111111

qqzzgdzwt 发表于 2020-4-7 15:40

6666666666666666666666666666666666666

fe54086645 发表于 2020-4-7 17:02

暗中观察

斩魂刃 发表于 2020-4-8 00:14

谢谢分享

a374957662 发表于 2020-4-8 17:49

阿萨德啊实打实大a

a285951322qq 发表于 2020-4-10 00:21

感谢分享

44946541 发表于 2020-4-10 10:15

支持一下

汐灵先生 发表于 2020-4-10 13:09

感谢分享!
页: [1] 2 3 4 5 6 7 8 9 10
查看完整版本: 全境封锁2 自动连发/自动射击/后坐力补偿 AHK脚本