datalore44 wrote:
Ok, the script works fine in windows, but does not work in bf2. Any ideas?
Most script problems in bf2 are down to delay timings, but it should not be the case with this script.
You MUST
send the
down and the up for the
F keys, especially for Battlefield2 and Battlefield2142.
I touched up the code* a little so I can use in bf2142.
*note: substr is available as of 1.0.46 (get most current version)
Code:
;;;;;;
;; position.ahk (bf2142.ahk)
;;;;;;;
;; Press and hold the Caps lock key, then press '1' to cycle through the
;; vehicle seat positions 123456
;;
;; to change the order, simply change the sequence, i.e. if you want
;; to switch to left gunner or right gunner in the blackhawk, change
;; sequence to 23 and _start_position to 2
;;;;;;
;; begin AUTO-EXECUTE
#NoEnv
SendMode Input
SetCapsLockState, AlwaysOff
_start_position = 1
_sequence = 123456 ;; CHANGE this sequence for vehicles with
;; fewer/more seats.
;;;;;;
;; timers
;;;;;;
SetTimer,if_not_battlefield_suspend,1000
;;;;;;
;; end AUTO-EXECUTE
;;;;;;
;; hotkeys and remappings
;;;;;;
CapsLock & 1::cycleSeat()
;;;;;;
;; timer target labels
;;;;;;
if_not_battlefield_suspend:
Suspend permit
WinGet, this_name, ProcessName, A
if (this_name = "bf2.exe") or (this_name = "BF2.exe") or (this_name = "BF2142pace.exe") or (this_name = "BF2142.exe")
Suspend off
else
Suspend on
return
;;;;;;
;; function definitions
;;;;;;
cycleSeat()
{
global _sequence
global _current_seat
seat := SubStr(_sequence,_current_seat, 1)
Send {f%seat% down}
Sleep 100
Send {f%seat% up}
_pos++
if (_current_seat > StrLen(_sequence))
_current_seat = 1
}
;;;;;;
;; end script
;;;;;
This code was tested in both bf2 and bf2142 and works.