1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. #GiveAwayFriday. Win a copy of F1 2017 - The Game. Click here to join.

Mouse steering for SCE Windows 8?

Discussion in 'Stock Car Extreme' started by thekhan360, Aug 29, 2016.

  1. thekhan360

    thekhan360

    Messages:
    4
    Ratings:
    +0
    Hello Guys,

    So I just bought this game and having a tough time maneuvering with the keyboard controls. I dont have a gamepad or the steering wheel and I dont need one. I just need to know how to setup mouse steering for this game. I tried some online tutorials but they cater to the pre-windows 8 OS. And I am using Windows 8.1.

    Thank you.
     
    Last edited: Aug 30, 2016
  2. thekhan360

    thekhan360

    Messages:
    4
    Ratings:
    +0
    UPDATE: I am able to properly enable Vjoy as I can see it in the monitor and I am using one of the scripts for FreePie as per
    .

    But in game the controller doesnt move in settings when I hover mouse. :(
     
  3. thekhan360

    thekhan360

    Messages:
    4
    Ratings:
    +0
    I tried this code :(

    Code:
        # =============================================================================================
        # /////////////////////////////// F1 2014 Mouse Steering Script ///////////////////////////////
        # =============================================================================================
        # This is a modified script, the original script was written by Skagen
        # url: https://www.lfs.net/forum/post/1862759#post1862759
        # =============================================================================================
        # This script will use 2 axes
        # 1. Steering (X-Axis)
        # 2. Throttle and Brake (Y-Axis)
        # =============================================================================================
        # Use vJoy Feeder to set the axes in game
        # This script allows full car control with just the mouse
        # Move the mouse up to control the throttle and down for brakes
        # =============================================================================================
    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, v.y, v.z, v.rx, v.ry, v.rz, v.slider, v.dial = (int32_min,) * 8
        # =============================================================================================
        # //////////////////////////////////////// SETTINGS ///////////////////////////////////////////
        # =============================================================================================
        # Mouse settings - Change the sensitivity here
        # =============================================================================================
        global mouse_sensitivity, mouse_throttle_sensitivity
        mouse_throttle_sensitivity = 50
        mouse_sensitivity = 38
        # Additional controls: Wheel Up = Reset Steering to Center @ Line 89
        # =============================================================================================
        # Throttle settings
        # Init values, do not change
        global throttle, throttle_max, throttle_min
        throttle_max = int32_max
        throttle_min = int32_min
        throttle = throttle_min
        # =============================================================================================
        # 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
    # =================================================================================================
    # LOOP START
    # =================================================================================================
    # Steering logic
    # =================================================================================================
    if mouse.wheelUp:
        steering = 0.0
        throttle = 0
    if keyboard.getKeyDown(Key.Return):
        steering = 0.0
        throttle = 0
    steering = steering + (float(mouse.deltaX) * mouse_sensitivity)
    if steering > steering_max:
        steering = steering_max
    elif steering < steering_min:
        steering = steering_min
    v.x = int(round(steering))
    # =================================================================================================
    # Throttle logic and Braking logic
    # =================================================================================================
    throttle = throttle + (float(-mouse.deltaY) * mouse_throttle_sensitivity)
    if throttle > throttle_max:
        throttle = throttle_max
    elif throttle < steering_min:
        throttle = throttle_min
    v.y = int(round(throttle))
    # =================================================================================================
    # vJoy BUTTONS
    # F1 2014 allows keyboard controls mixed with other input devices, so we don't need to set any more
    # =================================================================================================
    v.setButton(0,int(mouse.leftButton))
    v.setButton(1,int(mouse.rightButton))
    v.setButton(2,int(mouse.middleButton))
    # =================================================================================================
    # PIE diagnostics logic
    # =================================================================================================
    diagnostics.watch(v.x)
    diagnostics.watch(v.y)
     
  4. Ian Fleming

    Ian Fleming

    Messages:
    42
    Ratings:
    +5
    Hi o/

    Did you get it sorted?

    I did a quick google and found a script from Dec2014 for Automobilista (apparently) http://www.mtbs3d.com/phpBB/viewtopic.php?f=139&t=21856 Code below.

    If you get nowhere I can dig a little deeper - but see how you go first. It may not work but it may give you some ideas. You might want to look into freepie a little more https://github.com/AndersMalmgren/FreePIE/wiki

    If you still keen and get nowhere let me know.

    Code:
    import winsound
    
    def update():
       global yaw
       global pitch
       global roll
       global x
       global y
       global z
    
    # initialization
    if starting:
       # mouse
       enabled         = False
       mousex         = 0
       mousey         = 0
       mousez         = 0
       throttle_inc   = 250
       throttle_dec   = 400
       brake_inc      = 1200
       brake_dec      = 1600
       mod            = 0
    
       # trackIR
       x         = 0
       y         = 0
       z         = 0
    
       xMax = vJoy[0].axisMax
       yMax = vJoy[0].axisMax
       zMax = vJoy[0].axisMax
    
    # mouse sensitivity
    global mouse_sensitivity
    mouse_sensitivity = 4
    
    # mouse sensitivity modifier
    mod = mousex / 800
    mouse_sensitivity += (mod ** 2) / 2
    
    # mouse steering control
    if enabled:
       mousex += mouse.deltaX * mouse_sensitivity
       # throttle (left mouse button)
       if mouse.leftButton:
          mousey += throttle_inc
       else:
          mousey -= throttle_dec
       # brake (right mouse button)
       if mouse.rightButton:
          mousez += brake_inc
       else:
          mousez -= brake_dec
    else:
       mousex   = 0
       mousey   = 0
       mousez   = 0
    
    # trackIR control for head movement
    trackIR.yaw      = mousex / 300
    trackIR.roll   = mousex / 500
    trackIR.pitch   = 0
    trackIR.x      = 0
    trackIR.y      = 0
    trackIR.z      = 0
    
    # limit movement range
    if (mousex > xMax):
       mousex   = xMax
    elif (mousex < -xMax):
       mousex   = -xMax
    if (mousey > yMax):
       mousey = yMax
    elif (mousey < 0):
       mousey = 0
    if (mousez > zMax):
       mousez = zMax
    elif (mousez <  0):
       mousez = 0
    
    # toggle mouse steering
    if keyboard.getPressed(Key.NumberPad0):
        enabled = not enabled
        winsound.Beep(2500,1000)
    
    # mouse to vJoy
    vJoy[0].x = mousex
    vJoy[0].y = mousey
    vJoy[0].z = mousez
    
    # vJoy buttons
    vJoy[0].setButton(1, keyboard.getKeyDown(Key.LeftShift))   # shift up
    vJoy[0].setButton(2, keyboard.getKeyDown(Key.LeftControl))   # shift down
    vJoy[0].setButton(3, mouse.middleButton)               # speed limiter
    
    # watch
    diagnostics.watch(enabled)
    #diagnostics.watch(vJoy[0].x)
    #diagnostics.watch(vJoy[0].y)
    #diagnostics.watch(vJoy[0].z)
    #diagnostics.watch(mod)
    #diagnostics.watch(mouse_sensitivity)
     
    Last edited: Sep 2, 2016
    • Love Love x 1