- Install vJoy
- Install freePIE
- In freePIE: new file -> copy script below -> save as'BLAH'
- Run script (F5)
- Launch DCS (on my machine has to be after a joystick is added, but you'll probably be fine running dcs first)
- Settings -> Controls -> Select Su-25T (or any module) -> Select 'Axis Commands' in category dropdown
- Bind pitch and Roll (can double click on field in vJoy Device column) to JOY_X, JOY_Y respectively
- Click OK (I cannot state how many times I quit accidentally and lost ~15mins worth of keybinds)
- Play russian national anthem
- ???
- Profit
- Run FreePIE
- Load script (from file or raw text, but might as well save it somewhere)
- F5 to run
If you get an error stating joy[0] doesn't exist, make sure vJoy is running, and using the
Configure vJoy
tool, have the virtual joystick device stored in the number 1 slot. After a restart mine went to slot 2, and the script stopped working
- Mouse x & y will change vJoy[0].x & vJoy[0].y (vJoy can have multiple joysticks configured, e.g. vJoy[0], vJoy[1])
Emulates a joystick by returning to center, not ideal since you have to keep scrolling the mouse for constant pitch up, not sure how to handle this)
- Hold CAPSLOCK to toggle to "freelook" (mouse now changes vJoy[0].rx & vJoy[0].ry)
This doesn't automatically centre, use middle mouse button to recenter
Alt code for toggle freelook is included, switch commented sections lines 41-47 to use
Keybinds will probably look something like this:
# init
if starting:
centreX = 0.015
centreY = 0.03
sensX = 50
sensY = 50
viewSensX = 10
viewSensY = 10
system.setThreadTiming(TimingTypes.HighresSystemTimer)
system.threadExecutionInterval = 20
x = 0
y = 0
rx = 0
ry = 0
freelook = False
viewLatch = False
moveLatch = False
# mouse axis
if mouse.deltaX:
if freelook:
rx += mouse.deltaX * viewSensX
else:
moveLatch = True
x += mouse.deltaX * sensX
if abs(x) > vJoy[0].axisMax:
x = vJoy[0].axisMax * x / abs(x)
else:
x /= (1.0 + centreX)
if mouse.deltaY:
if freelook:
ry += mouse.deltaY * viewSensY
else:
moveLatch = True
y += mouse.deltaY * sensY
if abs(y) > vJoy[0].axisMax:
y = vJoy[0].axisMax * y / abs(y)
else:
y /= (1.0 + centreY)
# recenter
if (not freelook and viewLatch):
rx = 0
ry = 0
viewLatch = False
#keyboard override mouse
if (moveLatch and keyboard.getPressed(Key.Space) or keyboard.getPressed(Key.Z)):
x = 0
y = 0
moveLatch = False
#code for hold freelock
freelook = mouse.getButton(3) or mouse.middleButton
if (mouse.getPressed(3)):
viewLatch = True
#code for toggle freelook
#toggle = keyboard.getPressed(Key.CapsLock)
#if (toggle):
# freelook = not freelook
# vJoy axis mapping
vJoy[0].rx = rx
vJoy[0].ry = ry
vJoy[0].x = x
vJoy[0].y = y
diagnostics.watch(vJoy[0].x)
diagnostics.watch(vJoy[0].y)
diagnostics.watch(vJoy[0].rx)
diagnostics.watch(vJoy[0].ry)
diagnostics.watch(freelook)
diagnostics.watch(moveLatch)
diagnostics.watch(mouse.getButton(3))
thx for helping mate