@Ideka: Thanks for your map_range function. It works great even with vJoy.
@CyberVillain: Thanks for the dll. How does the setRange function work? I can't specify an axis with this command so does that mean that all axis are mapped to this range? Maybe I missunderstood this function.
I'm using the function provided by Ideka for my script and the axis is mapped correct.
But it doesn't update because the function is in the starting block of the script but I didn't find a way to update the vjoy like other devices such as freetrack.update, etc.
Code: Select all
def map_range(n, lu, hu, lm, hm):
return lm + (hm - lm) * float(n - lu) / (hu - lu)
if starting:
vJoy[0].z = map_range(joystick[0].z, 1000, -1000, 0, 1000)
diagnostics.watch(vJoy[0].z)
Personally I would use a while loop as long as the script runs but is there a better way to do that in Python / FreePie? I'm new at Python but have experience in Java.
EDIT: This loop works but my vJoy doesn't update:
Code: Select all
def map_range(n, lu, hu, lm, hm):
return lm + (hm - lm) * float(n - lu) / (hu - lu)
def update():
while (1) :
vJoy[0].z = map_range(joystick[0].z, 1000, -1000, 0, 1000)
if starting:
update
diagnostics.watch(vJoy[0].z)
diagnostics.watch(joystick[0].z)