Envelo wrote:
Harmor wrote:
I don't know about you guys, but I've been using AHK, uncompiled, since day 1. Perhaps if you have custom DLL calls to functions that you're not supposed to be using (like reading memory, changing memory locations, etc...), THEN you'll get kicked/banned.
No for sure. Whats your AHK version? I first thought about special functions too, but even the simplest scripts you can imagine cause the kick.
1, 0, 44, 07
and here's the uncompiled script that I'm running:
Code:
;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
;
; NOTE: This script uses a modified version of Dave Derrick's Hat POV control
;
; Only run this script when bf2.exe is running in the foreground
;
#SingleInstance force
#InstallKeybdHook
#InstallMouseHook
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Global Variabless ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Joystick to use (1st Joystick is 1, 2nd Joystick is 2, etc...)
;
JoystickNumber = 1
;
; The delay in milliseconds to check state of HAT control
;
HatDelay = 100
;
; Amount to move mouse by
HatMoveBy = 10
;
; Speed to move mouse at, 0 - 100
;
HatMoveSpeed = 10
;
; MouseLook key
;
HatMouseLookOn = {LCTRL Down}
HatMouseLookOff = {LCTRL Up}
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Auto Execution Section - OnLoad ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
SetTimer, KeepRunning ; Only run this script while bf2 is running
;
; Only start the timer for using the Joystick's POV as a Mouse in BF2
; if %JoystickNumber% has a POV Control
;
GetKeyState, JoyInfo, %JoystickNumber%JoyInfo
IfInString, JoyInfo, P ; Joystick has POV control
{
SetTimer, HatMouse, %HatDelay%
}
return
;
; KeepRunning Timer execution Section: Suspend this script if BF2.exe is not actively running
;
KeepRunning:
WinGet, szProcessName, ProcessName, A
if szProcessName = bf2.exe
{
Suspend, off
}
else
{
Suspend, on
}
return
;
; HatMouse Timer execution Section: Use the Joystick's POV to mouselook
;
HatMouse:
GetKeyState, JoyPOV, %JoystickNumber%JoyPOV
if JoyPOV = -1 ; No angle.
{
Send %HatMouseLookOff%
return
}
else
{
Send %HatMouseLookOn%
}
if JoyPOV = 0 ; Up
{
MouseMove,0,-%HatMoveBy%,%HatMoveSpeed%,R
}
else if JoyPOV = 4500 ; up/right
{
MouseMove,%HatMoveBy%,-%HatMoveBy%,%HatMoveSpeed%,R
}
else if JoyPOV = 9000 ; right
{
MouseMove,%HatMoveBy%,0,%HatMoveSpeed%,R
}
else if JoyPOV = 13500 ; right/down
{
MouseMove,%HatMoveBy%,%HatMoveBy%,%HatMoveSpeed%,R
}
else if JoyPOV = 18000 ; down
{
MouseMove,0,%HatMoveBy%,%HatMoveSpeed%,R
}
else if JoyPOV = 22500 ; down/left
{
MouseMove,-%HatMoveBy%,%HatMoveBy%,%HatMoveSpeed%,R
}
else if JoyPOV = 27000 ; left
{
MouseMove,-%HatMoveBy%,0,%HatMoveSpeed%,R
}
else if JoyPOV = 31500 ; left/up
{
MouseMove,-%HatMoveBy%,-%HatMoveBy%,%HatMoveSpeed%,R
}
return
;
; Disable the Window's keys so they don't switch to desktop while in-game
;
$LWin:: ; Left Windows Button
$RWin:: ; Right Windows Button
; Do nothing
return
$^CapsLock::
ExitApp
return
;
; Pressing Ctrl+V while BF2 is active
;
$^v::
Sleep 200
SetKeyDelay, 40
Send, {Space}%clipboard%
SetKeyDelay, 0
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Utility Functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Returns 1 if the process %a_szProcessName% is running, otherwise 0
;
IsProcessActive(a_szProcessName)
{
; Get the process name of the active window (i.e. notepad.exe)
WinGet, szProcessName, ProcessName, A
if szProcessName = a_szProcessName
{
return 1
}
return 0
}
;
; Returns 1 if the process %a_szProcessName% is NOT running, otherwise 0
;
IsProcessNotActive(a_szProcessName)
{
if IsProcessActive(a_szProcessName)
{
return 0
}
return 1
}
SayToAll(a_szMessage)
{
SetKeyDelay, 35,35
Send, {j Down}
Sleep 100
Send, {j Up}
Send, %a_szMessage%{Enter}
SetKeyDelay, 0
}
SayToSquad(a_szMessage)
{
SetKeyDelay, 35,35
Send, {l Down}
Sleep 100
Send, {l Up}
Send, %a_szMessage%{Enter}
SetKeyDelay, 0
}
SayToTeam(a_szMessage)
{
SetKeyDelay, 35,35
Send, {k Down}
Sleep 100
Send, {k Up}
Send, %a_szMessage%{Enter}
SetKeyDelay, 0
}
SpotHere()
{
MouseGetPos, , ypos
offsetY := 30
; TODO: Figure out coord system, coordinate system migrates
;if(ypos > 382)
;{
; offsetY := offsetY - ypos + 382
;}
sleep 20
MouseClick, Right, , , , , D
sleep 40
MouseClick, Right, , , , , U
DllCall("mouse_event", uint,1, int,20, int,offsetY, uint,0, int,0 )
; SayToTeam("ypos ". ypos . " offsetY " . offsetY)
sleep 40
MouseClick, Left, , , , , D
sleep 40
MouseClick, Left, , , , , U
DllCall("mouse_event", uint,1, int,-20, int,-offsetY, uint,0, int,0 )
Sleep 500
}
;
; Returns 1 if %a_szKeyName% has be released, 0 otherwise
;
IsKeyReleased(a_szKeyName)
{
; Check to see if the a_szKeyName key has been released
GetKeyState, state, %a_szKeyName%, P
if state = U ; The key has been released
{
return 1
}
return 0
}
;
; Returns 1 if %a_szKeyName% is currently being pressed, 0 otherwise
;
IsKeyPressed(a_szKeyName)
{
; Check to see if the %a_szKeyName% key has been pressed
GetKeyState, state, %a_szKeyName%, P
if state = D ; The key has been pressed
{
return 1
}
return 0
}
;
; Move the mouse relative to its current position
; 0,0 is upper left
MouseEvent(a_xDelta,a_yDelta)
{
DllCall("mouse_event", uint, 1, int, a_xDelta, int, a_yDelta, uint,0, int,0 )
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Key Mappings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$Numpad1::
$NumpadEnd::
SayToTeam("SPOT THE TANKS")
return
$Numpad2::
$NumpadDown::
SayToTeam("Enemy near the Hotel")
return
$Numpad3::
$NumpadPgDn::
SayToAll("2142 DEMO has SPYWARE")
return
$Numpad4::
$NumpadLeft::
Loop
{
if IsKeyPressed("LCtrl")
break
MouseEvent(-20,0)
Sleep 10
}
return
$Numpad5::
$NumpadClear::
Loop
{
if IsKeyPressed("LCtrl")
break
Loop 55
{
MouseEvent(-20,0)
Sleep 10
if IsKeyPressed("LCtrl")
break
}
if IsKeyPressed("LCtrl")
break
Loop 55
{
MouseEvent(20,0)
Sleep 10
if IsKeyPressed("LCtrl")
break
}
}
return
$Numpad6::
$NumpadRight::
return
;
; Double click on first server in list (favorites) and
; then press the OK button 2 seconds later
;
$Numpad7::
$NumpadHome::
MouseClick, Left, 413, 145
MouseClick, Left, 413, 145
Sleep 2000
MouseClick, Left, 614, 404
return
;
; Double click on second server in list (favorites) and
; then press the OK button 2 seconds later
;
$Numpad8::
$NumpadUp::
MouseClick, Left, 413, 165
MouseClick, Left, 413, 165
Sleep 2000
MouseClick, Left, 614, 404
return
;
; Double click on third server in list (favorites) and
; then press the OK button 2 seconds later
;
$Numpad9::
MouseClick, Left, 413, 185
MouseClick, Left, 413, 185
Sleep 2000
MouseClick, Left, 614, 404
$NumpadPgUp:
return
;
; Spot in 20x20 square area in Commander screen
; Only works when you are not near bottom of the screen
;
;$+LButton::
; MouseEvent(-10,-10)
; SpotHere()
; MouseEvent(20, 0)
; SpotHere()
; MouseEvent(0, 20)
; SpotHere()
; MouseEvent(-20, 0)
; SpotHere()
;return
;
; My Sniper Script - switch to pistol immediately
;
$^LButton::
MouseClick, Left, , , , , D
Sleep 50
MouseClick, Left, , , , , U
; Switch to Pistol
Sleep 250 ; Need to wait til we switch guns
Send, {2 down}
Sleep 50
Send, {2 up}
Sleep 700 ; Wail til we have the gun equipped
; Zoom in
MouseClick, Right, , , , , D
Sleep 500
MouseClick, Right, , , , , U
; While the LButton is pressed down, click the Left Mouse Button
Loop
{
Sleep 90
if IsKeyReleased("LButton")
break
MouseClick, left,,, 1, 0, D
Sleep, 20
MouseClick, left,,, 1, 0, U
; Correct for bullet deviation by moving down X pixels
MouseEvent(0,9)
}
return
;
; Continually click Left Mouse Button while holding Middle Mouse button
;
$MButton::
; Pistol 9
; G36E (burst fire) 6
; G36E (single shot) 4
; G36E (zoomed) 2
; DAO 16
iDeviationOffset = 6
Loop
{
Sleep 90
GetKeyState, MButtonState, MButton, P
if MButtonState = U
break
MouseClick, left,,, 1, 0, D
Sleep, 20
MouseClick, left,,, 1, 0, U
; Correct for bullet deviation by moving down X pixels
MouseEvent(0,6)
}
return
$Up::
MouseClick, WheelUp, , , 2 ; Turn it by two notches.
Sleep 100
MouseClick, left,,, 1, 0, D
Sleep, 40
MouseClick, left,,, 1, 0, U
return
$Down::
MouseClick, WheelDown, , , 2
Sleep 100
MouseClick, left,,, 1, 0, D
Sleep, 40
MouseClick, left,,, 1, 0, U
return
$Right::
MouseClick, WheelUp, , , 4 ; Turn it by two notches.
Sleep 100
MouseClick, left,,, 1, 0, D
Sleep, 40
MouseClick, left,,, 1, 0, U
return
$Left::
MouseClick, WheelDown, , , 4
Sleep 100
MouseClick, left,,, 1, 0, D
Sleep, 40
MouseClick, left,,, 1, 0, U
return
$WheelUp::
$WheelDown::
; Disable
return
;
; Press Joy5 to say "I'm sorry" using the Cammo Rose while flying
;
$Joy5::
Send, {q Down}
Sleep 200
DllCall("mouse_event", uint,1, int,300, int,10, uint,0, int,0 )
Sleep 40
MouseClick, Left, , , , , D
sleep 40
MouseClick, Left, , , , , U
Send, {q Up}
return
;
; Press Joy6 to spot a target directly in front of you using the Cammo Rose while flying
;
$Joy6::
Send, {q Down}
Sleep 100
MouseClick, Left, , , , , D
sleep 40
MouseClick, Left, , , , , U
Send, {q Up}
return
;
; Bunny hop while you have the space bar pressed
;
$Space::
Loop
{
Send, {Space Down}
Sleep 60
Send, {Space Up}
Sleep 60
if IsKeyReleased("Space")
Break
; Fires a burst or shot between jumps
MouseClick, Left, , , , , D
sleep 40
MouseClick, Left, , , , , U
}
Return