Mouse Steering with xoutput

Official forum for open source FreePIE discussion and development.
Post Reply
PCGamer88
One Eyed Hopeful
Posts: 17
Joined: Sun Nov 15, 2015 1:56 pm

Mouse Steering with xoutput

Post by PCGamer88 »

Hello,

I want a mouse Steering script that uses the plugin Freepie- xOutput.
I fail off my existing script to vJoy- xOutput rewrite :( Is that at all possible or is there even one?

My script looks like this:

Code: Select all

if starting:    
    system.setThreadTiming(TimingTypes.HighresSystemTimer)
    system.threadExecutionInterval = 5
    def calculate_rate(max, time):
        if time > 0:
            return max / (time / system.threadExecutionInterval)
        else:
            return max

    int32_max = (2 ** 14) - 1
    int32_min = (( 2** 14) * -1) + 1
    
    v = vJoy[0]
    v.x = int32_min
    v.y=0; v.z=0; v.rx=0; v.ry=0; v.rz=0; v.slider=0; v.dial=0
    # =============================================================================================
    # //////////////////////////////////////// SETTINGS ///////////////////////////////////////////
    # =============================================================================================
    # Mouse settings
    # =============================================================================================
    # Higher SCR = Smoother/Slower Response | Lower SCR = Harder/Quicker Response
    # With the game's built in steering settings, there's no need to change the scr value
    # SCR's effects can be felt better with arcade style racing games
    # =============================================================================================
    global mouse_sensitivity, sensitivity_center_reduction
    mouse_sensitivity = 20
    sensitivity_center_reduction = 0.8
    # =============================================================================================
    # Steering settings
    # =============================================================================================
    global steering, steering_max, steering_min, steering_center_reduction    
    # Init values, do not change
    steering = 0.0
    steering_max = float(int32_max)
    steering_min = float(int32_min)
    steering_center_reduction = 1.0
# =================================================================================================
# Steering logic
# =================================================================================================
if mouse.wheelUp:
   steering = 0.0
if steering > 0:
    steering_center_reduction = sensitivity_center_reduction ** (1 - (steering / steering_max))
elif steering < 0:
    steering_center_reduction = sensitivity_center_reduction ** (1 - (steering / steering_min))
steering = steering + ((float(mouse.deltaX) * mouse_sensitivity) / steering_center_reduction)
if steering > steering_max:
    steering = steering_max
elif steering < steering_min:
    steering = steering_min
v.x = int(round(steering))
# =================================================================================================
# PIE diagnostics logic
# =================================================================================================
diagnostics.watch(v.x)
diagnostics.watch(steering_center_reduction)
Looking forward to support :)
Post Reply

Return to “FreePIE”