Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*=
- Turn script to test for sensitivity and accel by TheNoobPolice.
- This script leverages the AHI library for AutoHotKey to work with games that reject synthetic input (such as with Kovaak's Sensitivity matcher)
- Download links from here https://github.com/evilC/AutoHotInterception). RTFM before downloading.
- After installing Interception, copy the AHI lib folder into %USERFOLDER%/Documents/AutoHotKey (make the folder if it doesn't exist)
- Select all in this tab, paste into Notepad and save as somefilename.ahk, then run.
- Keybinds:
- - Scrolllock to Enable/Disable hotkeys.
- - Press/hold ] to send a turn / hold for many turns
- - Press [ to halt mid-turn.
- - < > to nudge 1 count left and right (w/ shift for up and down)
- - Left/Right arrow keys, increase or decrease the number of packets sent every turn.
- - Up/Down arrow keys, alters the number of counts sent per packet.
- - Shift & Left/Right arrow keys, adjusts overall speed of turn:
- (Setting to 1ms can result in dropped packets in some games (negative accel) Min/max is 1-15.)
- - Shift & Up/Down arrow keys, makes fine (decimal) adjustment of counts. Hold Ctrl also for larger adjustments
- - p to manually enter a number of packets
- - Ctrl & Alt & Insert, copies the counts distance value to clipboard
- - Backspace, can be used to measure FOV (alternates back and forth while held)
- - Ctrl & Alt & Home, resets the script to default values
- - Ctrl & S, reloads the script
- - Ctrl & Esc, closes the script and saves values
- It is usually easier to get an accurate yaw value with the in-game sens at a low value.
- Run the turn many times to ensure it is accurate (i.e no drift).
- Once you have a perfect 360 turn, you can enter the total counts value in the spreadsheet linked here for more information and / or calculation of game sensitivity:
- https://docs.google.com/spreadsheets/d/e/2PACX-1vTOMMEEIGpBaiUqclmNQ-rTH-KE92iGJaecR8EZ22Rzbw-ByJgwBgOlgT7Zjz34jUsom1cuJ7U9PvpS/pubhtml#
- */
- ; ------------------------------------------------------------------------------------------------------------------------------------------------------------------
- ListLines Off
- #KeyHistory 0
- #SingleInstance force
- #include <AutoHotInterception>
- #NoEnv
- #MaxHotKeysPerInterval 200
- SetBatchlines, -1
- CoordMode, ToolTip, Screen
- SetScrollLockState, On
- OnExit("WriteValues")
- AHI := new AutoHotInterception()
- /*
- [SavedVariables]
- */
- packets=500
- counts=10
- fractional=500000
- ms=1
- Math := {newX :0, roundedX :0, carryX :0}
- BacknForth := 0
- directionTog := 0
- FOVMove := 0
- lastpackets := packets
- MenuView()
- Return
- #if GetKeyState("Scrolllock", "T")
- left::
- right::
- +left::
- +right::
- up::
- down::
- *+up::
- *+down::Fn(A_ThisHotkey)
- +down Up::
- +up Up::adjust(0, 0)
- [::halt := 1
- ]::Startloop(0)
- BS::Startloop(1)
- .::nudger(1, 0)
- +.::nudger(0, 1)
- ,::nudger(-1, 0)
- +,::nudger(0, -1)
- p Up::GoSub packetentry
- #if
- ^!insert::
- Clipboard := RTrim(k, "0")
- Msgbox,,, % "Counts distance value copied to Clipboard", 1.5
- return
- ^!home::
- Msgbox, 4,, Are you sure you want set values to defaults?
- IfMsgBox Yes
- {
- packets=500
- counts=10
- fractional=500000
- ms=2
- MenuView()
- MsgBox, Values set to defaults
- }
- else
- MsgBox, Overwrite cancelled. No changes made
- return
- ~^s up::Reload
- ^Esc::ExitApp
- packetentry:
- lastpackets := packets
- Inputbox, packets, Enter manual packets value below
- if Errorlevel {
- Msgbox, No value entered, previous value unaltered
- packets := lastpackets
- }
- if packets is not integer
- {
- Msgbox, The value must be a whole number
- packets := lastpackets
- Goto packetentry
- }
- MenuView()
- return
- SleepFunc(value){
- DllCall("Sleep", "UInt", value)
- }
- Fn(key){
- global
- if InStr(key,"+") {
- (InStr(key,"left")&&(ms > 1))?(ms--):(InStr(key,"right")&&(ms < 15))?ms++:
- (InStr(key,"up")&&(fractional < 999999))?adjust(1):
- (InStr(key,"down")&&(fractional > 1))?adjust(0):("")
- }
- else {
- (InStr(key,"left")&&(packets > 10))?packets--:InStr(key,"right")?packets++:
- InStr(key,"up")?counts++:InStr(key,"down")?(counts > 1)?counts--:counts:= 1
- }
- MenuView()
- }
- adjust(increase, state := 1){
- global fractional
- static counter
- if !state {
- (fractional>999999)?fractional:=999999:(fractional<1)?fractional:=0:fractional:=fractional
- counter := 0
- MenuView()
- return
- }
- counter++
- if GetKeyState("RCtrl", "P")
- increase ? fractional+=9897 : fractional-=9897
- else if (counter < 10)
- increase ? fractional++ : fractional--
- else if (counter > 10)
- increase ? fractional+=29 : fractional-=29
- else if (counter > 100)
- increase ? fractional+=159 : fractional-=159
- }
- nudger(hor, vert){
- global
- AHI.Instance.SendMouseMoveRelative(11, hor, vert)
- }
- Startloop(opt){
- global
- Math.carryX := 0
- BacknForth := opt ? 1 : 0
- if halt
- halt := 0
- loop
- {
- loop % packets
- MouseMover()
- Until halt
- if BacknForth
- directionTog := !directionTog
- }
- Until !GetKeyState((BacknForth ? "Backspace" : "]" ),"P")
- }
- MouseMover(){
- global
- Math.newX := (counts + (fractional * 0.000001)) + Math.carryX, Math.roundedX := round(Math.newX)
- if BacknForth
- FOVMove := directionTog ? (Math.roundedX * -1) : Math.roundedX
- AHI.Instance.SendMouseMoveRelative(11, (BacknForth ? FOVMove : Math.roundedX), 0)
- Math.carryX := (Math.newX - Math.roundedX)
- SleepFunc(ms)
- }
- MenuView(){
- global
- f := (fractional * 0.000001)
- k := packets * (counts + f)
- tooltip, % "Left/Right to adjust number of packets`n`nUp/Down to adjust"
- . " counts`n`nShift+Left/Right to change rate`n`nShift+Up/Down to fine"
- . " tune`n`npackets = " packets "`ncounts = " counts "`nrate = " ms "ms`nfractional = " f "`nTotal"
- . " Counts Per Turn = " RTrim(k, "0"), 1900, 30
- }
- WriteValues(){
- global
- IniWrite, %packets%, %A_ScriptFullPath%, SavedVariables, packets
- IniWrite, %counts%, %A_ScriptFullPath%, SavedVariables, counts
- IniWrite, %fractional%, %A_ScriptFullPath%, SavedVariables, fractional
- IniWrite, %ms%, %A_ScriptFullPath%, SavedVariables, ms
- }
Add Comment
Please, Sign In to add comment