WiiLi Wiki frontpage Include your post in the News Get links Hoteles Quito
WiiLi.org Forum Index WiiLi.org
a new revolution
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

GlovePIE Steering Wheel Script
Goto page 1, 2  Next
 
Post new topic   Reply to topic    WiiLi.org Forum Index -> Wii Scripts
View previous topic :: View next topic  
Author Message
pvtjohndoe



Joined: 18 Dec 2006
Posts: 10

Digg It
PostPosted: Mon Dec 18, 2006 9:32 pm    Post subject: GlovePIE Steering Wheel Script

Hey guys. I created a fairly simple script that allows the Wii remote to act as a steering wheel for most racing games.

With this script, you can play just about any game or emulator that supports a joystick, even non-racing games. I have confirmed that it works with the following games:

    - Project64 (Nintendo 64 Emulator)
    - Need For Speed: Most Wanted


(Let me know of any other games that you get it working with.)

You can navigate through menus in most supported games simply by tilting the controller.

PPJoy must be installed in order for this script to work. Full instructions are included in the script itself.

Code:

/* ------------< Pvt. John Doe's Steering Wheel Script >------------
  | This is my script for car racing games.  It has smooth steering,|
  | so you can tilt the controller a little bit or a lot to steer   |
  | accordingly.  Hold the Wii remote with the buttons facing up,   |
  | as if you were playing Excite Truck.  Steering is mapped to the |
  | X axis.  The Wii remote's buttons are mapped from button 1 to   |
  | button 11.  Set them up however you like in the game.  The Y    |
  | axis is mapped to the tilt of the controller forward and back.  |
  | This could come in handy for flight sims or shifting.           |
   -----------------------------------------------------------------

  !!!! Follow Steps 1 - 3 to get your remote working properly !!!!
       Be sure you have PPJoy installed before continuing.

   ------------(Step 1 - Set up PPJoy Virtual Joystick)------------
  |   1. In GlovePIE, go to CP-Settings > PPJoy.                   |
  |   2. Click on Add, then select "Constoller 1".                 |
  |   3. Select "PPJoy Virtual Joystick 1" and click Mapping.      |
  |   4. Choose "Set a custom mapping..." and click Next.          |
  |   5. Select 2 Axes and 11 Buttons, then click Next.            |
  |   6. Click Next again.                                         |
  |   7. Set Button1 to "Digital 0", Button2 to "Digital 1", etc., |
  |      then click next.                                          |
  |   8. Click finish.                                             |
   ----------------------------------------------------------------

   ------------(Step 2 - Fill in the following values)-------------
   Run this script and user the info that is displayed in the debug
   area of GlovePIE. */

var.zmin = -45 // 1. Stand remote on IR end. Put the number next to RawZ here.
var.zmax = 13 // 2. Stand remote on expansion port. Put the number next to RawZ here.

var.xmin = -43 // 3. Lay remote on right side. Put the number next to RawX here.
var.xmax = 15 // 4. Lay remote on left side.   Put the number next to RawX here.

/*  ---------------------(Step 3 - Center Axes) -----------------------
   |   1. In GlovePIE, go to CP-Settings > Joystick.                   |
   |   2. Select "PPJoy Virtual Joystick 1" and click Properties.      |
   |   3. Lay your remote on a flat surface with the buttons facing up.|
   |   4. Change the following values to center the axes.           |
    ------------------------------------------------------------------- */

var.zoffset = -3 // This is shown as the X axis.
var.xoffset = -2 // This is shown as the Y axis.

/* Now you're done.  All that is left is to configure your game
   to your liking.  Have fun!

   Note: This script was originally designed for Need For Speed.
         Menus in NFS can be navigated by tilting the controller
         forward & back ( for up & down) and left & right. */


var.z = Wiimote.RawForceZ
var.x = Wiimote.RawForceX

Wiimote.Leds = 1 + 8 /* No fancy LED animations here. :) */

var.z = var.z + var.zoffset
var.x = var.x + var.xoffset

ppjoy.analog0 = MapRange(var.z, var.zmin, var.zmax, -1, 1)
ppjoy.analog1 = MapRange(var.x, var.xmin, var.xmax, -1, 1)

ppjoy.digital1 = Wiimote.A
ppjoy.digital2 = Wiimote.B
ppjoy.digital3 = Wiimote.Home
ppjoy.digital4 = Wiimote.Plus
ppjoy.digital5 = Wiimote.Minus
ppjoy.digital6 = Wiimote.Up
ppjoy.digital7 = Wiimote.Down
ppjoy.digital8 = Wiimote.Left
ppjoy.digital9 = Wiimote.Right
ppjoy.digital10 = Wiimote.One
ppjoy.digital11 = Wiimote.Two

debug = 'RawX: ' + Wiimote.RawForceX + ' RawZ: ' + Wiimote.RawForceZ


Let me know if you find any errors or you need help setting this up!

- Pvt. John Doe


Last edited by pvtjohndoe on Mon Dec 18, 2006 11:15 pm; edited 6 times in total
Back to top
View user's profile Send private message
kunalkunal2



Joined: 13 Dec 2006
Posts: 279

Digg It
PostPosted: Mon Dec 18, 2006 10:00 pm    Post subject:

thx reallly helpful hope it works with f-zero x and mariokart 64
goin to try it now
-kunal

EDIT: how do u do step 2 (confused)


Last edited by kunalkunal2 on Mon Dec 18, 2006 10:28 pm; edited 1 time in total
Back to top
View user's profile Send private message
pvtjohndoe



Joined: 18 Dec 2006
Posts: 10

Digg It
PostPosted: Mon Dec 18, 2006 10:16 pm    Post subject:

I tested it with Project64 and it works great. The remote can be tilted to navigate through the menus on most N64 games and the steering controls seem to work well for them. I had to set the deadzone in Project64 to about 13% due to the jitter of the Wiimote. Still, not a big problem.
Back to top
View user's profile Send private message
pvtjohndoe



Joined: 18 Dec 2006
Posts: 10

Digg It
PostPosted: Mon Dec 18, 2006 11:07 pm    Post subject:

kunalkunal2 wrote:

how do u do step 2 (confused)


Sorry about the poor instructions. I updated them in the script. Hopefully they are more clear now.

You have to run the script, then information will appear in the debug section in GlovePIE. Do what it says to do with the Wiimote on each line, then fill in the values that it says to fill in.
Back to top
View user's profile Send private message
freshgeardude



Joined: 17 Dec 2006
Posts: 15

Digg It
PostPosted: Thu Dec 21, 2006 11:56 pm    Post subject:

cool
Back to top
View user's profile Send private message
Lunarbunny



Joined: 28 Jan 2007
Posts: 2
Location: Seattle, WA

Digg It
PostPosted: Sun Jan 28, 2007 11:41 pm    Post subject:

If you don't mind, I have an adjusted version that helps with the X-Axis dropoff when you get to near vertical.

Code:

/* ------------< Pvt. John Doe's Steering Wheel Script >------------
  | This is my script for car racing games.  It has smooth steering,|
  | so you can tilt the controller a little bit or a lot to steer   |
  | accordingly.  Hold the Wii remote with the buttons facing up,   |
  | as if you were playing Excite Truck.  Steering is mapped to the |
  | X axis.  The Wii remote's buttons are mapped from button 1 to   |
  | button 11.  Set them up however you like in the game.  The Y    |
  | axis is mapped to the tilt of the controller forward and back.  |
  | This could come in handy for flight sims or shifting.           |
   -----------------------------------------------------------------

  !!!! Follow Steps 1 - 3 to get your remote working properly !!!!
       Be sure you have PPJoy installed before continuing.

   ------------(Step 1 - Set up PPJoy Virtual Joystick)------------
  |   1. In GlovePIE, go to CP-Settings > PPJoy.                   |
  |   2. Click on Add, then select "Constoller 1".                 |
  |   3. Select "PPJoy Virtual Joystick 1" and click Mapping.      |
  |   4. Choose "Set a custom mapping..." and click Next.          |
  |   5. Select 2 Axes and 11 Buttons, then click Next.            |
  |   6. Click Next again.                                         |
  |   7. Set Button1 to "Digital 0", Button2 to "Digital 1", etc., |
  |      then click next.                                          |
  |   8. Click finish.                                             |
   ----------------------------------------------------------------

   ------------(Step 2 - Fill in the following values)-------------
   Run this script and user the info that is displayed in the debug
   area of GlovePIE. */

var.zmin = -34 // 1. Stand remote on IR end. Put the number next to RawZ here.
var.zmax = 20 // 2. Stand remote on expansion port. Put the number next to RawZ here.

var.xmin = -31 // 3. Lay remote on right side. Put the number next to RawX here.
var.xmax = 22 // 4. Lay remote on left side.   Put the number next to RawX here.

/*  ---------------------(Step 3 - Center Axes) -----------------------
   |   1. In GlovePIE, go to CP-Settings > Joystick.                   |
   |   2. Select "PPJoy Virtual Joystick 1" and click Properties.      |
   |   3. Lay your remote on a flat surface with the buttons facing up.|
   |   4. Change the following values to center the axes.           |
    ------------------------------------------------------------------- */

var.zoffset = -3 // This is shown as the X axis.
var.xoffset = -2 // This is shown as the Y axis.

/* Now you're done.  All that is left is to configure your game
   to your liking.  Have fun!

   Note: This script was originally designed for Need For Speed.
         Menus in NFS can be navigated by tilting the controller
         forward & back ( for up & down) and left & right. */


var.z = Wiimote.RawForceZ
var.x = Wiimote.RawForceX

Wiimote.Leds = 1 + 8 /* No fancy LED animations here. :) */

var.medianZ = (var.zmin + var.zmax)/2

var.distanceZ = abs(var.z - var.medianZ)

var.z = var.z + var.zoffset
var.x = var.x + var.xoffset

var.x = var.x * (sqr(var.distanceZ/25) + 1)

ppjoy.analog0 = MapRange(var.z, var.zmin, var.zmax, -1, 1)
ppjoy.analog1 = MapRange(var.x, var.xmin, var.xmax, -1, 1)

ppjoy.digital1 = Wiimote.A
ppjoy.digital2 = Wiimote.B
ppjoy.digital3 = Wiimote.Home
ppjoy.digital4 = Wiimote.Plus
ppjoy.digital5 = Wiimote.Minus
ppjoy.digital6 = Wiimote.Up
ppjoy.digital7 = Wiimote.Down
ppjoy.digital8 = Wiimote.Left
ppjoy.digital9 = Wiimote.Right
ppjoy.digital10 = Wiimote.One
ppjoy.digital11 = Wiimote.Two

debug = 'RawX: ' + Wiimote.RawForceX + ' RawZ: ' + Wiimote.RawForceZ



Alright, this is a bit smoother than the last thing I did.
Back to top
View user's profile Send private message
TaiTn



Joined: 28 Jan 2007
Posts: 6

Digg It
PostPosted: Mon Jan 29, 2007 8:57 pm    Post subject:

when i press on PPJoy, nothing happens, so i cant add a controller ...
any help ?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    WiiLi.org Forum Index -> Wii Scripts All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group