Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Binds
- var.throttle = keyboard.A
- var.brake = keyboard.Z
- var.clutch = keyboard.X
- var.handbrake = keyboard.R
- var.steering = mouse.x
- var.shiftup = mouse.LeftButton
- var.shiftdown = mouse.RightButton
- // Sensitivities
- var.throttleincreaserate = 0.1
- var.throttledecreaserate = 0.1
- var.brakeincreaserate = 0.05
- var.brakedecreaserate = 0.05
- var.clutchincreaserate = 0.4
- var.clutchdecreaserate = 0.2
- var.handbrakeincreaserate = 0.4
- var.handbrakedecreaserate = 0.4
- var.throttleblip = 0.4
- var.brakeratemax = 1
- var.braketrail = 0.2
- var.braketraillow = 0.4
- var.braketrailrate = -0.002
- var.throttletrailmax = -1
- var.throttlecut = -0.8
- // Script
- // Throttle
- if var.throttle > 0 && ppjoy.Analog0 < 1 && var.brake == 0 then
- ppjoy.Analog0 += var.throttleincreaserate
- var.throttletrail = 0
- endif
- if var.throttle == 0 && ppjoy.Analog0 > -1 && var.throttletrail == 0 then ppjoy.Analog0 -= var.throttledecreaserate
- // Brake
- // *** This section is a special case that is only applicable to Assetto Corsa *** //
- // The on/off status of C5 (can be any MIDI signal) is read to produce a simple form
- // of ABS. When C5 is on, wheels are locking so we reduce braking force, and vice versa.
- // The on/off state of C5 is set by a Python script running as an AC client app, and
- // uses the Python API's tyre slip values to detect wheel locking. Modification necessary
- // if using real MIDI devices or multiple virtual ones. I use loopMIDI.
- // Comment this section out if not using, and there are problems related to it
- // (i.e., I don't know whether it *needs* to be commented out.
- midi.DeviceOut = 2 // device number to use
- midi.DeviceIn = 0
- midi.DefaultChannel = 1
- if var.brake && midi.c5 then
- var.cadence = ppjoy.Analog1
- ppjoy.Analog1 -= var.brakedecreaserate/4
- if var.tempBrake > var.braketraillow then var.tempBrake -= 0.005
- endif
- if var.brake && var.cadence > -1 && not midi.c5 then ppjoy.Analog1 += var.brakeincreaserate/10
- // *** END MIDI SECTION *** //
- if var.brake && var.cadence == -1 then ppjoy.Analog1 += var.brakeincreaserate
- if ppjoy.Analog1 > var.tempBrake then ppjoy.Analog1 = var.tempBrake
- if var.brake == 0 then
- var.tempBrake = var.brakeratemax
- if var.cadence != -1 then var.cadence = -1
- if ppjoy.Analog1 > -1 then ppjoy.Analog1 -= var.brakedecreaserate
- if ppjoy.Analog0 == -1 then var.throttletrail = 0
- endif
- if var.brake && var.throttletrail == 0 then
- ppjoy.Analog0 = var.throttletrailmax
- var.throttletrail = 1
- endif
- if var.throttletrail then ppjoy.Analog0 -= var.throttledecreaserate/10
- if var.brake && ppjoy.Analog1 < var.braketraillow then ppjoy.Analog1 = var.braketraillow
- // Clutch
- if var.clutch > 0 && ppjoy.Analog2 < 1 then ppjoy.Analog2 += var.clutchincreaserate
- if var.clutch == 0 && ppjoy.Analog2 > -1 then ppjoy.Analog2 -= var.clutchdecreaserate
- // Handbrake
- if var.handbrake > 0 && ppjoy.Analog3 < 1 then ppjoy.Analog3 += var.handbrakeincreaserate
- if var.handbrake == 0 && ppjoy.Analog3 > -1 then ppjoy.Analog3 -= var.handbrakedecreaserate
- // Shift up & throttle cut
- ppjoy.Digital0 = var.shiftup
- if var.throttlecut != 0 && var.shiftup > 0 then ppjoy.analog0 = var.throttlecut
- // Shift down
- ppjoy.Digital1 = var.shiftdown
- // Blip
- if var.throttleblip != -1 && var.shiftdown then
- ppjoy.Analog0 = var.blipthreshold
- var.throttletrail = 0
- endif
- // Steering
- var.foo = (mouse.x - 0.5) * 4
- var.foo = (var.foo * var.foo) / 20
- if mouse.x < 0.5 then var.foo = -var.foo
- // Additional steering lock adjustment. 1 to 1 means that maximum lock is achieved
- // at the edge of the screen, 0 is middle.
- //var.foo = MapRange(var.foo, -0.20, 0.20, -0.7, 0.7)
- var.foo = MapRange(var.foo, -0.20, 0.20, -0.8, 0.8)
- //var.foo = MapRange(var.foo, -0.20, 0.20, -0.9, 0.9)
- //var.foo = MapRange(var.foo, -0.20, 0.20, -1, 1)
- ppjoy.analog4 = var.foo
- debug = ppjoy.Analog4
Advertisement
Add Comment
Please, Sign In to add comment