Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

BF2 MACROS (SUMMARY) - post all working macros here please


  • Please log in to reply
1915 replies to this topic
BF2fan
  • Guests
  • Last active:
  • Joined: --
With all of the posts for BF2 macros, I am going to consolidate all scripts here to keep the questions down to a minimum.

I will post the links to scripts or the script itself for the most popular requests:

*Dolphin Diving
*C4 toss
*Repeat left clicks aka TV missle script
*Prone & shoot
*others

BF2fan
  • Guests
  • Last active:
  • Joined: --
Bind your windows key to trigger 10 left clicks

Code:
Lwin::
Loop, 10
{
Mouseclick, left
}
Return

;to change the key, just replace Lwin:: with another button such as Xbutton2:: for your mouse button 4


*forum thread: http://www.autohotke... ... hlight=bf2

Here's a version of the code above that uses the middle mouse buttin instead to press the Left Mouse button repeatedly:
Code:

$MButton::
Loop
{
Sleep 90
GetKeyState, MButtonState, LButton, P
if MButtonState = U
break
MouseClick, left,,, 1, 0, D
Sleep, 20
MouseClick, left,,, 1, 0, U
}


*Here's a variant that will correct for bullet deviation:
Code:

$MButton::
; Pistol - 9
; G36E (burst fire) - 6
; G36E (single shot) - 4

Loop
{
Sleep 90
GetKeyState, MButtonState, LButton, P
if MButtonState = U
break
MouseClick, left,,, 1, 0, D
Sleep, 20
MouseClick, left,,, 1, 0, U
DllCall("mouse_event", uint, 1, int, 0, int, 6, uint,0, int,0 )
}

BF2fan
  • Guests
  • Last active:
  • Joined: --
blackrock wrote: combine 2 keys to a single key.
where n is key you are pressing to activate the two other keys.

n::
Sleep, 500
SetKeyDelay, 50, 50
Send, A
Send, w
Return


you can use this to prone and fire by assigning n to a particular mouse button and using Z and fire as the 2 keys to combine.

BF2fan
  • Guests
  • Last active:
  • Joined: --
crouch-prone repeatedly:

Code:
;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
;
; Setup:
; 1. Map Crouch to 'x'
; 2. Map Prone to 'z'
;
; Description:
; 1. Press 'x' to go prone to standing repeatedly
;
#SingleInstance force
#InstallKeybdHook
;
; Only run this script when BF2.exe is running in the foreground
;
SetTimer, KeepRunning
return

KeepRunning:

; Get the process name of the active window (i.e. Notepad.exe)
WinGet, szProcessName, ProcessName, A
if szProcessName = bf2.exe
{
Suspend, off
}
else
{
Suspend, on
}
return

$^CapsLock::
ExitApp
return

$x::
Send, {x Down}
Sleep 100
Send, {z Down}
Send, {x Up}
Sleep 100
Send, {z Up}
Sleep 100
Send, {x Down}
Sleep 100
Send, {x Up}

return


*forum discussion here:
http://www.autohotke... ... hlight=bf2

BF2fan
  • Guests
  • Last active:
  • Joined: --
macro to drop cars on artillery pieces on Karkand


http://www.autohotke... ... hlight=bf2

BF2fan
  • Guests
  • Last active:
  • Joined: --
http://www.autohotke... ... lphin dive

Dolphin Dive:
Code:
#Persistent
#InstallKeybdHook
SetKeyDelay, 75, 75
; increase responsiveness
;#MaxThreadsPerHotkey 20
;#MaxThreadsBuffer on

z::
{
Sleep, 5
Send, {Space}
Sleep, 200
Send, {LShift}
Sleep, 500
Send, {LCtrl}
}
Return



Prone Spam
Code:
#Persistent
#InstallKeybdHook
SetKeyDelay, 75, 75
; increase responsiveness
;#MaxThreadsPerHotkey 20
;#MaxThreadsBuffer on

c::
{
Sleep, 5
Send, {LShift}
Sleep, 5
Send, {LCtrl}
Sleep, 5
Send, {LShift}
Sleep, 5
Send, {LCtrl}
}
Return

WilleyE
  • Guests
  • Last active:
  • Joined: --
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force
#InstallKeybdHook
#InstallMouseHook

*XButton1::

Click down left
Send, {space down}
Sleep 5
Click up left
Send, {space up}
Sleep 10

return


This binds it to a side mouse button, change *XButton1:: to whatever you want you action key to be.

It simply throws C4, it doesn't switch to det, or try to move back, it leaves you in control, and ONLY throws it. You can not throw while running, because the game is coded to not be able to shoot while running.

WilleyE
  • Guests
  • Last active:
  • Joined: --
BF2Fan, you should mention in the prone spam ones, and dolphin dives that the key would need to be remapped to match, as by default Lshift is sprint in BF2.

BF2fan
  • Guests
  • Last active:
  • Joined: --
;Here is the script my friend and I use for dolphin diving.
;
;
XButton1::
If GetKeyState("Xbutton1", "P") = 1
{
Sendinput {Space down}
Sleep 5
Sendinput {Space up}
}
Loop
{
GetKeyState, state, Xbutton1, P
if state=U
break
Sleep 10
Sendinput {Z down}
Sleep 1
Sendinput {Z up}
Sleep 10
Sendinput {Z down}
Sleep 1
Sendinput {Z up}
Sleep 10
Sendinput {LCtrl down}
Sleep 1
Sendinput {LCtrl up}
Sleep 10
Sendinput {Space down}
Sleep 1
Sendinput {Space up}
}



********************
I believe if you want to repeat this dive 3 times you would need to change the line:
Loop
to say
Loop, 3

BF2fan
  • Guests
  • Last active:
  • Joined: --
;for rapid fire set to mouse button 5 on the side i am going to use this script...using Harmon's previous example.

$XButton2::
Loop
{
Sleep 90
GetKeyState, MButtonState, LButton, P
if MButtonState = U
break
MouseClick, left,,, 1, 0, D
Sleep, 20
MouseClick, left,,, 1, 0, U
}

BF2fan
  • Guests
  • Last active:
  • Joined: --

;for rapid fire set to mouse button 5 on the side i am going to use this script...using Harmon's previous example.


Doesn't seem to work. Any ideas???

Bf2Highlander
  • Guests
  • Last active:
  • Joined: --
Are there any PKM or MG36 macro scripts.

And is there anyway to enhance these to left button, with also sound to tell you there on.

BF2fan
  • Guests
  • Last active:
  • Joined: --

Are there any PKM or MG36 macro scripts.

And is there anyway to enhance these to left button, with also sound to tell you there on.



what kind of script are u looking for? most guys are using one that dives down>aim>and fires
i believe it would use 3 buttons: z>mouseclick right>mouseclick left

Harmor
  • Members
  • 182 posts
  • Last active: Sep 20 2007 05:09 AM
  • Joined: 06 Nov 2005
I'll post what I use when I get home later today...
//TODO: Create kewl sig...

Harmor
  • Members
  • 182 posts
  • Last active: Sep 20 2007 05:09 AM
  • Joined: 06 Nov 2005
Weird...can't edit my post above...something is wierd:

;
; AutoHotkey      Version: 1.x
; Language:       English
; Platform:       Win9x/NT
;
;
; Only run this script when bf2.exe is running in the foreground
;
#SingleInstance force
#InstallKeybdHook 
#InstallMouseHook


SetTimer, KeepRunning
return

KeepRunning:

  ; Get the process name of the active window (i.e. Notepad.exe)
  WinGet, szProcessName, ProcessName, A
  if szProcessName = bf2.exe
  {
    Suspend, off
  }
  else
  {
    Suspend, on
  }
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
;
; Prone spam
;
$x::
	Send, {x Down}
	Sleep 100
	Send, {z Down}
	Send, {x Up}
	Sleep 100
	Send, {z Up}
	Sleep 100
	Send, {x Down}
	Sleep 100
	Send, {x Up}
	Sleep 100

return

SayToAll(a_szMessage)
{
   SetKeyDelay, 40
   Send, {j Down}
   Sleep 100
   Send, {j Up}
   Send, %a_szMessage%{Enter}
   SetKeyDelay, 0
   
}

SayToSquad(a_szMessage)
{
   SetKeyDelay, 40
   Send, {l Down}
   Sleep 100
   Send, {l Up}
   Send, %a_szMessage%{Enter}
   SetKeyDelay, 0
   
}

SayToTeam(a_szMessage)
{
   SetKeyDelay, 40
   Send, {k Down}
   Sleep 100
   Send, {k Up}
   Send, %a_szMessage%{Enter}
   SetKeyDelay, 0
   
}

$Numpad1::
$NumpadEnd::
   SayToTeam("I'm using the APC because no one else is...if you want it get in and ask me to Bail out")
return

$Numpad2::
$NumpadDown::
   SayToTeam("Enemy near the Hotel!!!")
return

$Numpad3::
$NumpadPgDn::
   SayToTeam("Armor available at Gas Station")
return

$Numpad4::
$NumpadLeft::
   SayToAll("GLICHERS IN HOTEL!!!!")
return

$Numpad5::
$NumpadClear::
   SayToSquad("Enemy nearby, cover me")
return

$Numpad6::
$NumpadRight::
   SayToSquad("Go ahead, I'll cover your back")
return



;
; Bounce up/down and jump sideways while shooting
;
$c::
   Send, {x Down}
   Sleep 100
   Send, {d Down}
   Send, {x Up}
   Sleep 100
   Send, {Space Down}
   Sleep 500
   Send, {d Up}
   Send, {Space Up}
   Sleep 100
   Send, {x Down}
   Sleep 100
   Send, {z Down}
   Send, {x Up}
   Sleep 100
   Send, {z Up}
   Sleep 100
return
;
;  TV guided Missle - not working
;
;$^6::
;   If GetKeyState("6", "P") = 1
;   {
;      Sendinput {F2 down}
;      Sleep 1
;      Sendinput {F2 up}
;      Sleep 200
;      Sendinput {Click right down}
;      Sleep 25
;      Sendinput {Click right up}
;      Sleep 100
;
;      Loop
;      {
;         If GetKeyState("Mbutton", "P") = 0
;         {
;         Sendinput {F1 down}
;         Sleep 10
;         Sendinput {F1 up}
;         }
;         GetKeyState, state, MButton, P 
;         if state=U
;         break
;         Sendinput {Click down} 
;         Sleep 25 
;         Sendinput {Click up} 
;         Sleep 25
;      }
;   }
;
;return


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 200
}
;
; Spot in 20x20 square area in Commander screen
; 
$^LButton::
   DllCall("mouse_event", uint, 1, int, -10, int, -10, uint,0, int,0 )
   SpotHere()
   DllCall("mouse_event", uint, 1, int, 20, int, 0, uint,0, int,0 )
   SpotHere()
   DllCall("mouse_event", uint, 1, int, 0, int, 20, uint,0, int,0 )
   SpotHere()
   DllCall("mouse_event", uint, 1, int, -20, int, 0, uint,0, int,0 )
   SpotHere()
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

   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
      DllCall("mouse_event", uint, 1, int, 0, int, 6, uint,0, int,0 )
   }

return 
;
; Cartillery: USMC Left artillery - Karkand
;
$Numpad7::
$NumpadHome:
   DllCall("mouse_event", uint,1, int,-2000, int,-2000, uint,0, int,0 )
   sleep 100
   DllCall("mouse_event", uint,1, int,332, int,342, uint,0, int,0 )
   sleep 20
   MouseClick, Right, , , , , D
   sleep 40
   MouseClick, Right, , , , , U
   DllCall("mouse_event", uint,1, int,20, int,42, uint,0, int,0 )
   sleep 40
   MouseClick, Left, , , , , D
   sleep 40
   MouseClick, Left, , , , , U
return
;
; Double click on first server in list (favorites) and 
; then press the OK button 2 seconds later
;
$Numpad8::
$NumpadUp:
 
   MouseClick, Left, 413, 145
   MouseClick, Left, 413, 145
   Sleep 2000
   MouseClick, Left, 614, 404
return
;
; Cartillery: USMC Right artillery - Karkand
;
$Numpad9::
$NumpadPgUp:
   DllCall("mouse_event", uint,1, int,-2000, int,-2000, uint,0, int,0 )
   sleep 100
   DllCall("mouse_event", uint,1, int,378, int,328, uint,0, int,0 )
   sleep 20
   MouseClick, Right, , , , , D
   sleep 40
   MouseClick, Right, , , , , U
   DllCall("mouse_event", uint,1, int,20, int,58, uint,0, int,0 )
   sleep 40
   MouseClick, Left, , , , , D
   sleep 40
   MouseClick, Left, , , , , U
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

//TODO: Create kewl sig...