AutoHotKey did the trick. Took me a while to catch some fine prints about the use of %, but now
I have a working script that does what I wanted, in the way I wanted. Couldn't ask for better.
Kudos to
messyhead for the tip
Btw, here's my 1st script (if anybody's interested):
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance
Loop
{
;------------------------------
; Process the 8-Way Hat Switch:
;------------------------------
;----------------------------
; 8-Way Hat Switch positions:
;----------------------------
; 0 = Up
; 4500 = Up + Right
; 9000 = Right
; 13500 = Down + Right
; 18000 = Down
; 22500 = Down + Left
; 27000 = Left
; 31500 = Up + Left
;-----------------------
hat = 0
last_hat = -2
GetKeyState, hat, JoyPOV
if hat = 0
{
; Trigger the "minFOV" game function.
Send 7
last_hat = %hat%
}
else if hat = 18000
{
; Trigger the "normalFOV" game function.
Send 8
last_hat = %hat%
}
; We do not want to repeat the inputs.
; Wait for the Hat Switch to be released.
; Among the Hat Switch valid states figure 0 and -1.
; Therefore we resort to -2 to signal ourselves a variable-not-set.
if last_hat <> -2
{
Loop
{
Sleep, 50
GetKeyState, hat, JoyPOV
if hat <> %last_hat%
{
Break
}
}
}
;------------------------------------------------------------
; Process the Joystick Buttons (Joy1 through Joy8 available):
;------------------------------------------------------------
GetKeyState, but5, Joy5
GetKeyState, but6, Joy6
if but5 = D
{
; Trigger the "Trim" game function.
Send t
; Wait for the button to be released.
KeyWait, Joy5
}
else if but6 = D
{
; Trigger the "Reset Trim" game function.
Send +t
; Wait for the button to be released.
KeyWait, Joy6
}
Sleep, 100
}
This maps (game's function) "minFOV" to (joystick control) "Hat Switch Up", normalFOV to Hat Switch Down,
Trim to Joy Button #5 and Reset Trim to Joy Button #6. Most of the script code is just to prevent the
sending of unnecessary input repetitions. Right now that's all I need.
Until next time!