; HatMouse script ; by Dave Derrick. ; Enables Joystick HAT switch to operate MouseLook POV mode ; in various games, e.g. BattleField 2 ; Joystick to use JoystickNumber = 1 ; The delay in milliseconds to check state of HAT control HatDelay = 100 ; Amount to move mouse by MoveBy = 10 ; Speed to move mouse at, 0 - 100 MoveSpeed = 10 ;MouseLook key MouseLookOn = {LCTRL Down} MouseLookOff = {LCTRL Up} ButtonLeft = 1 #SingleInstance ; define a hotkey that does nothing, to stop script exitting Hotkey, %JoystickNumber%Joy%ButtonLeft%, ButtonLeft GetKeyState, JoyInfo, %JoystickNumber%JoyInfo IfInString, JoyInfo, P ; Joystick has POV control SetTimer, HatMouse, %HatDelay% return ; End of auto-execute section. ButtonLeft: return HatMouse: GetKeyState, JoyPOV, %JoystickNumber%JoyPOV if JoyPOV = -1 ; No angle. { Send %MouseLookOff% return } else { Send %MouseLookOn% } if JoyPOV = 0 ; Up { MouseMove,0,-%MoveBy%,%MoveSpeed%,R } else if JoyPOV = 4500 ; up/right { MouseMove,%MoveBy%,-%MoveBy%,%MoveSpeed%,R } else if JoyPOV = 9000 ; right { MouseMove,%MoveBy%,0,%MoveSpeed%,R } else if JoyPOV = 13500 ; right/down { MouseMove,%MoveBy%,%MoveBy%,%MoveSpeed%,R } else if JoyPOV = 18000 ; down { MouseMove,0,%MoveBy%,%MoveSpeed%,R } else if JoyPOV = 22500 ; down/left { MouseMove,-%MoveBy%,%MoveBy%,%MoveSpeed%,R } else if JoyPOV = 27000 ; left { MouseMove,-%MoveBy%,0,%MoveSpeed%,R } else if JoyPOV = 31500 ; left/up { MouseMove,-%MoveBy%,-%MoveBy%,%MoveSpeed%,R } return
Its my 1st script for AutoHotkeys, so dont be too harsh