dschu012 / XOutputPlugin

FreePIE plugin for https://github.com/Stents-/XOutput
17 stars 4 forks source link

Incremental Values #7

Open spadino opened 7 years ago

spadino commented 7 years ago

Hi! Finally I found your plugin, which seems what I was searching for... I want to simulate an analog axis (or two) from my keyboard, to use as headlook in Elite:Dangerous an, doing go, program some macros to look at certain direction or do funny things with.

So far, I managed to install your plugin and prepare a basic script:

# Mapping keyboard to the axis 
# Left
if keyboard.getKeyDown(Key.RightControl) and keyboard.getKeyDown(Key.LeftArrow):
    xoutput[0].lx = xoutput[0].AxisMin
# Down
if keyboard.getKeyDown(Key.RightControl) and keyboard.getKeyDown(Key.DownArrow):
    xoutput[0].ly = xoutput[0].AxisMin
# Right
if keyboard.getKeyDown(Key.RightControl) and keyboard.getKeyDown(Key.RightArrow):
    xoutput[0].lx = xoutput[0].AxisMax
# Up
if keyboard.getKeyDown(Key.RightControl) and keyboard.getKeyDown(Key.UpArrow):
    xoutput[0].ly = xoutput[0].AxisMax

# Keyboard Output
vJoy[2].x = xoutput[0].lx
vJoy[2].y = xoutput[0].ly

This way, Elite: Dangerous recognize my axis an map correctly to the headlook.

Next thing I'm trying to achieve is, beside POV Toggles (which basically are those previous hotkeys), to have directional buttons with sequential increments.

If I do,

if keyboard.getKeyDown(Key.RightControl) and keyboard.getKeyDown(Key.NumberPad4):
    vJoy[2].x = vJoy[2].x - 2000 

for example, the X Axis is correctly diminished by 2000 units however, when I release the key, the value return to zero.

There's a way to have the axis value to be modified in an incremental way? So, if I press the assigned key, the value goes to -2000, than if I press again the value pass to -4000, and so on, without returning to zero, unless explicitly asked for?

Many thanks for your great plugin!