Skip to content

Instantly share code, notes, and snippets.

@WhiteMagic
Created June 20, 2016 09:09
Show Gist options
  • Save WhiteMagic/b966f3e5a09e5605a06581249f2801b6 to your computer and use it in GitHub Desktop.
Save WhiteMagic/b966f3e5a09e5605a06581249f2801b6 to your computer and use it in GitHub Desktop.
import time
import threading
import gremlin
from vjoy.vjoy import AxisName
# Implement using recurring timer
def slider_update_timer():
vjoy = gremlin.input_devices.VJoyProxy()
joy = gremlin.input_devices.JoystickProxy()
vjoy[1].axis[AxisName.SL0].value = joy[3].axis(4)
threading.Timer(1, slider_update_timer).start()
#slider_update_timer()
# Implement via sleeping thread
def slider_update_thread():
vjoy = gremlin.input_devices.VJoyProxy()
joy = gremlin.input_devices.JoystickProxy()
while True:
vjoy[1].axis[AxisName.SL0].value = joy[3].axis(4)
time.sleep(0.5)
t = threading.Thread(target=slider_update_thread).start()
@danricho
Copy link

That's exactly why i want it! Quantum travel...

My issue is now that the setting of the slider appears to always set the value to one end (-1000 according to SC Joystick Mapper).

I've tried both of the methods implemented above... Sorry to be a pest!

@danricho
Copy link

I've narrowed it down to the code not correctly accessing the current value of the physical slider.
I can access my second joysticks slider.
I can set a macro to occur between value on the slider in question.
The code just always reads it as -1 (confirmed by display_error function).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment