coolbho3000
Joined: 10 Dec 2006 Posts: 30
Digg It |
Posted: Wed Jan 10, 2007 12:26 am Post subject: Flight Stick Control Script (Updated) |
|
|
Flight Stick Control Script with PPJoy.
I know, I know, I've posted this at least four times on this forum already. Perhaps it's because I'm so excited. I promise, I'm not going to post it anymore. But I cleaned this script up, improved the comments, fixed an error here or there, and made the controls much more precise. Consider this to be the official release.
Read the comments for the instructions. Have fun!
| Code: |
/*
Coolbho3000's Flightstick Script 1.01
GlovePIE 0.29
PPJoy 0.83
Set PPJoy Virtual Joystick 1 to 2 analog axes and 11 digital buttons.
This script is a heavy modification of Pvt.John Doe's steering wheel script,
changed to flightstick configuration, upgraded the RawForce values, and made
some other changes such as smoothing out motion.
It should not need calibration, but if you're getting strange results, calibrate
using the instructions.
All the values you might need to change are surrounded by bars.
To use it, place the Wiimote vertical with the buttons facing you and use as a
normal flight stick.
This script assumes that the game is set to inverted controls. If you can't
change it to inverted controls, simply go down to the calibration section and
switch the "var.ymin"and "var.ymax" values.
*/
//Deadzones. Lower means more sensitive. 1 = full range. Above 1 is unrealistic!
//----------------------------------------------------------------------------\\
var.sense = 1 //1 = 180 degree range, 0.5 = 90 degree range, etc. \\
//----------------------------------------------------------------------------\\
//CALIBRATION. Press Run and use the debug window to enter the numbers while
//following the instructions in the comments.
//----------------------------------------------------------------------------\\
var.xmin = 1 // Place remote on left side. Enter number from GX \\
var.xmax = -1 // Place remote on right side. Enter number from GX \\
var.ymin = 1 // Place remote lying flat, buttons down. Enter number from GY \\
var.ymax = -1 // Place remote lying flat, buttons up. Enter number from GY \\
//----------------------------------------------------------------------------\\
//In the joystick CP settings, the crosshair might not be in the middle.
//This adjusts it using X and Y values. For the most part, leave this alone.
//----------------------------------------------------------------------------\\
var.xoffset = 0 //X Axis \\
var.yoffset = 0 //Y Axis \\
//----------------------------------------------------------------------------\\
var.xoffset = var.xoffset/30
var.yoffset = var.yoffset/30
//Assigns the sensitivity
var.xmin = var.xmin*var.sense
var.xmax = var.xmax*var.sense
var.ymin = var.ymin*var.sense
var.ymax = var.ymax*var.sense
//Smoothes out the GX and GY values
var.x = smooth(Wiimote.gx)
var.y = smooth(Wiimote.gy)
//Assigns Offset
var.x = var.x + var.xoffset
var.y = var.y + var.yoffset
//PPJoy axis assignments
ppjoy.analog0 = MapRange(var.x, var.xmin, var.xmax, -1, 1)
ppjoy.analog1 = MapRange(var.y, var.ymin, var.ymax, -1, 1)
//PPJoy digital button assignments
ppjoy.digital0 = Wiimote.A
ppjoy.digital1 = Wiimote.B
ppjoy.digital2 = Wiimote.Home
ppjoy.digital3 = Wiimote.Plus
ppjoy.digital4 = Wiimote.Minus
ppjoy.digital5 = Wiimote.Up
ppjoy.digital6 = Wiimote.Down
ppjoy.digital7 = Wiimote.Left
ppjoy.digital8 = Wiimote.Right
ppjoy.digital9 = Wiimote.One
ppjoy.digital10 = Wiimote.Two
//LEDs
Wiimote.Leds = 6
//Debug Line
debug = 'GX: ' + Wiimote.gx + ' GY: ' + Wiimote.gy
|
|
|