 |
WiiLi.org a new revolution
|
| View previous topic :: View next topic |
| Author |
Message |
Cpkppp
Joined: 19 Oct 2007 Posts: 4
Digg It |
Posted: Sat Oct 20, 2007 10:47 am Post subject: |
|
|
I wrote one for "Racer" and it will work for other racing games. This script makes wiimote vibrate and make a noise as you open the throttle. It's kinda funny but works well.
Racer.PIE
| Code: | //=============================================================================
//Racer.PIE - for Racer53b7 by Cpkppp
//version 1.2
//Oct 21, 2007
//=============================================================================
//Original script "Generic Joystick Driver.PIE" by vkapadia
//vkapadia@vkapadia. com
//Features:
// - Vibration support (according to throttle)
// - Throttle noise (according to throttle)
// - Battery level
//About PPJoy Virtual Joystick's mapping
//
//In PPJoy, set a Virtual Joystick to have 2 axes and 12 buttons, though
//wiimote have only 11 buttons available without power key, because Racer counts
//the buttons strangely; PPJoy1.Digital0 will not be checked and it counts from
//PPJoy1.Digital0 to n. So the key assign of this script doesn't include
//the mapping of PPJoy1.Digital0.
//-----------------------------------------------------------------------------
// Key assign code
// Hold wiimote to see the top of the keys.
//-----------------------------------------------------------------------------
PPJoy1.Analog0 = (wiimote.RawForceZ) / 20 // steering
PPJoy1.Analog1 = -(wiimote.RawForceY) / 30 // throttle and brake
PPJoy1.Digital1 = wiimote.Up
PPJoy1.Digital2 = wiimote.Down
PPJoy1.Digital3 = wiimote.Left
PPJoy1.Digital4 = wiimote.Right
PPJoy1.Digital5 = Wiimote.A
PPJoy1.Digital6 = Wiimote.B
PPJoy1.Digital7 = Wiimote.Minus
PPJoy1.Digital8 = Wiimote.Home
PPJoy1.Digital9 = Wiimote.Plus
PPJoy1.Digital10 = wiimote.One
PPJoy1.Digital11 = wiimote.Two
//-----------------------------------------------------------------------------
// Rumble code
// Wiimote vibrates according to throttle level.
// If you dislike vibration, hit Wiimote.Home and Wiimote.Minus together to
// turn off or just add "var.RumbleMode = true" below to turn it off at default.
//-----------------------------------------------------------------------------
if var.RumbleMode = false and Wiimote.Home and Wiimote.Minus then
var.RumbleMode = true
else if var.RumbleMode = true and Wiimote.Home and Wiimote.Minus then
var.RumbleMode = false
endif
if var.RumbleMode = false then
if wiimote.RawForceY <= 0 then
var.RumbleLevel = 0
else if (wiimote.RawForceY > 0) and (wiimote.RawForceY <= 5) then
var.RumbleLevel = 1
wiimote.Rumble = true
wait 20ms
wiimote.Rumble = false
wait 100ms
else if (wiimote.RawForceY > 5) and (wiimote.RawForceY <= 10) then
var.RumbleLevel = 2
wiimote.Rumble = true
wait 30ms
wiimote.Rumble = false
wait 80ms
else if (wiimote.RawForceY > 10) and (wiimote.RawForceY <= 15) then
var.RumbleLevel = 3
wiimote.Rumble = true
wait 40ms
wiimote.Rumble = false
wait 60ms
else if (wiimote.RawForceY > 15) and (wiimote.RawForceY <= 20) then
var.RumbleLevel = 4
wiimote.Rumble = true
wait 50ms
wiimote.Rumble = false
wait 40ms
else if (wiimote.RawForceY > 20) and (wiimote.RawForceY <= 25) then
var.RumbleLevel = 5
wiimote.Rumble = true
wait 60ms
wiimote.Rumble = false
wait 20ms
else if (wiimote.RawForceY > 25)
var.RumbleLevel = 6
wiimote.Rumble = true
endif
endif
//-----------------------------------------------------------------------------
// Speaker code
// If you dislike noise, erase the line of Wiimote.Frequency.
//-----------------------------------------------------------------------------
Wiimote.Frequency = EnsureMapRange(wiimote.RawForceY, 0,30,0,700)
//-----------------------------------------------------------------------------
// Battery display code
//-----------------------------------------------------------------------------
//Wiimote Battery Display
//by J.Coulston
// Modified by Carl Kenner for GlovePIE 0.25
// use up battery power :-)
// comment out this line if you don't need it
//Wiimote.Rumble = shift
//A full battery gives 0xC0 (192)
var.Batt = wiimote.Battery / 48
if true then
wait 5 seconds
//it sends an instruction that tells the Wiimote to actually
//send the report.
Wiimote.Report15 = 0x80 | Int(wiimote.Rumble)
end if
//Display the battery level of your wiimote using the four LEDs on the bottom.
//Battery level is displayed in four levels increasing to the right, like a cell
//phone battery gauge. As the battery gets close to the next level down, the LED
//for the current level will blink.
//Blink rate
var.Blink = 500ms
//debug = "Battery level: " + 100*48*var.Batt/192 + "%"
if 0<=var.Batt<=0.25 then
Wiimote.Leds = 1
wait var.Blink
Wiimote.Leds = 0
wait var.Blink
elseif 0.25 < var.Batt<=1 then
Wiimote.Leds = 1
elseif 1 < var.Batt<=1.25 then
Wiimote.Leds = 3
wait var.Blink
Wiimote.Leds = 1
wait var.Blink
elseif 1.25 < var.Batt<=2 then
Wiimote.Leds = 3
elseif 2 < var.Batt<=2.25 then
Wiimote.Leds = 7
wait var.Blink
Wiimote.Leds = 3
wait var.Blink
elseif 2.25 < var.Batt<=3 then
Wiimote.Leds = 7
elseif 3 < var.Batt<=3.25 then
Wiimote.Leds = 15
wait var.Blink
Wiimote.Leds = 7
wait var.Blink
elseif 3.25 < var.Batt<=4 then
Wiimote.Leds = 15
else
Wiimote.Leds = 0
endif
//-----------------------------------------------------------------------------
// Debug code
//-----------------------------------------------------------------------------
debug = "Battery: " + 100*48*var.Batt/192 + "%" + " | Rumble: " + var.RumbleLevel + " | RawForceX: " + Wiimote1.RawForceX + " | RawForceY: " + Wiimote1.RawForceY + " | RawForceZ: " + Wiimote1.RawForceZ |
|
|
| Back to top |
|
 |
fredbamburger
Joined: 22 Oct 2007 Posts: 2
Digg It |
Posted: Mon Oct 22, 2007 3:05 pm Post subject: |
|
|
This is my script for running mariokart 64 using ppjoy and project64. It works really well and i was even able to beat the times i set with traditional joystick.
| Code: | //Mario Kart 64 with the Wiimote
//Note, requires use of PPJoy virtual joystick
// Show wiimote forces
debug = "X="+Wiimote1.RawForceX+' Y='+Wiimote.RawForceY+' Z='+Wiimote.RawForceZ
//Precision settings, steer by holding wiimote sideways and steer
var.z = Wiimote.RawForceZ
var.sense0 = 10/var.z
var.thresh0y = 0
if var.z > var.thresh0y
ppjoy.Analog0 = ppjoy.Analog0 + 1/var.sense0
wait 1ms
ppjoy.Analog0 = false
endif
if var.z < -var.thresh0y
ppjoy.Analog0 = ppjoy.Analog0 + 1/var.sense0
wait 1ms
ppjoy.Analog0 = false
endif
if var.z > 7
ppjoy.Analog0 = ppjoy.Analog0 + 1.5/var.sense0
wait 1ms
ppjoy.Analog0 = false
endif
if var.z < -7
ppjoy.Analog0 = ppjoy.Analog0 + 1.5/ var.sense0
wait 1ms
ppjoy.Analog0 = false
endif
if -3 < var.z < 3
ppjoy.Analog0 = false
endif
// All buttons assigned a value of a ppjoy button. use the controll
// configuration in emulator to assign butons to n64 controls as you wish
ppjoy.Digital4 = wiimote.Plus
ppjoy.Digital5 = wiimote.Minus
ppjoy.Digital6 = wiimote.Up
ppjoy.Digital7 = wiimote.Down
ppjoy.Digital10 = wiimote.Home
ppjoy.Digital0 = wiimote.A
ppjoy.Digital1 = wiimote.B
ppjoy.Digital13 = wiimote.two
ppjoy.Digital14 = wiimote.one
ppjoy.Digital8 = wiimote.Left
ppjoy.Digital9 = wiimote.Right
|
|
|
| Back to top |
|
 |
Jsonic
Joined: 28 Oct 2007 Posts: 1
Digg It |
Posted: Sun Oct 28, 2007 7:12 am Post subject: |
|
|
Here is a wiimote game script I made, its really simple plus I'm new to scripting.
| Code: | //Buzzer Script
//By Jsonic
// A fun little script wiimote game you can use to add a twist to a questionare game
//Connects rumble to D-pad, one direction per player
wiimote1.Rumble = wiimote2.Left or wiimote3.Left or wiimote4.Left
wiimote2.Rumble = wiimote1.Up or wiimote3.Up or wiimote4.Up
wiimote3.Rumble = wiimote1.Right or wiimote2.Right or wiimote4.Right
wiimote4.Rumble = wiimote1.Down or wiimote2.Down or wiimote3.Down
//A bit copied from the wiimote identifier script
var.count = Wiimote.Count
if var.count = 1
Wiimote1.Led1 = True
endif
if var.count = 2
Wiimote1.Led1 = True
Wiimote2.Led2 = True
endif
if var.count = 3
Wiimote1.Led1 = True
Wiimote2.Led2 = True
Wiimote3.Led3 = True
endif
if var.count = 4
Wiimote1.Led1 = True
Wiimote2.Led2 = True
Wiimote3.Led3 = True
Wiimote4.Led4 = True
endif
//This tells you witch player is buzzing you
Wiimote1.Led2 = wiimote2.left
Wiimote1.Led3 = wiimote3.left
Wiimote1.Led4 = wiimote4.left
Wiimote2.Led1 = wiimote1.up
Wiimote2.Led3 = wiimote3.up
Wiimote2.Led4 = wiimote4.up
Wiimote3.Led1 = wiimote1.right
Wiimote3.Led2 = wiimote2.right
Wiimote3.Led4 = wiimote4.right
Wiimote4.Led1 = wiimote1.down
Wiimote4.Led2 = wiimote2.down
Wiimote4.Led3 = wiimote3.down |
This mite be something like what someone was looking for in an earlyer post. |
|
| Back to top |
|
 |
mdvalenz
Joined: 21 Nov 2006 Posts: 42
Digg It |
Posted: Sun Oct 28, 2007 5:54 pm Post subject: Frets on Fire using the WiiGuitar |
|
|
Threw this together, won't be able to test it until I get the guitar so if anyone out there can test please post what works. Also, this is my first script so be kind if it is completely broken. I tried to label everything so you can make changes easily and know what was doing what.
Edit: Added the right shift for up strumming. Also added 2-Player support, however I don't know how it will work. Never tried using glovepie with two players. A separate glovepie instance with the second player mappings might work better.
Edit2: Removed the mouse movement for the analog stick and added report of whammy bar using analog shoulder buttons.
Edit3: Now shows % depressed from analog shoulder buttons in debug window.
Last Edit: Amazon said they wouldn't get around to shipping my pre-order for a couple weeks so I went to Target instead. Tested everything for the first player and it all worked.
FoF - WiiGuitar.PIE
| Code: | // 2-Player WiiGuitar script for FoF
// Created by Mario Valenzuela
// Adapted from Marc-Andre Larouche's ZNES script
// Thanks to jlaudio7 for the key mapping
// Feel free to modify this script to use the WiiGuitar for another purpose
// Player 1 settings
// WiiGuitar button mapping
// Strumming
Enter = Wiimote1.Classic.Down
RightShift = Wiimote1.Classic.Up
// Frets
F1 = Wiimote1.Classic.a
F2 = Wiimote1.Classic.b
F3 = Wiimote1.Classic.x
F4 = Wiimote1.Classic.y
F5 = Wiimote1.Classic.ZL
// Face buttons
// Switch if you want the other button to be cancel
Escape = Wiimote1.Classic.Plus
//Escape = Wiimote1.Classic.Minus
// Whammy bar
// Only shows % depressed in the debug window
var.rAnalog1 = Wiimote1.Classic.R * 100
// These don't map to anything on the WiiGuitar
// = Wiimote1.Classic.Left
// = Wiimote1.Classic.Right
// = Wiimote1.Classic.Home
// = Wiimote1.Classic.ZR
// = Wiimote1.Classic.L
// Right analog stick
// Analog stick for movement in FoF
Left = Wiimote1.Classic.Joy1X <= -25%
Right = Wiimote1.Classic.Joy1X >= 25%
Up = Wiimote1.Classic.Joy1Y <= -25%
Down = Wiimote1.Classic.Joy1Y >= 25%
// Wiimote button mapping
// Glovepie uses
Shift+P+I+E = Wiimote1.Home
// Unused Wiimote buttons, if you want to map anything to them
// = Wiimote1.Down
// = Wiimote1.Left
// = Wiimote1.Right
// = Wiimote1.Up
// = Wiimote1.A
// = Wiimote1.B
// = Wiimote1.Plus
// = Wiimote1.Minus
// = Wiimote1.One
// = Wiimote1.Two
// LEDs
Wiimote1.LED1 = true;
Wiimote1.LED2 = false;
Wiimote1.LED3 = false;
Wiimote1.LED4 = false;
// Player 2 settings
// WiiGuitar button mapping
// Strumming
PageDown = Wiimote2.Classic.Down
PageUp = Wiimote2.Classic.Up
// Frets
F8 = Wiimote2.Classic.a
F9 = Wiimote2.Classic.b
F10 = Wiimote2.Classic.x
F11 = Wiimote2.Classic.y
F12 = Wiimote2.Classic.ZL
// Face buttons
// Switch if you want the other button to be cancel
F7 = Wiimote2.Classic.Plus
//F7 = Wiimote2.Classic.Minus
// Whammy bar
// Only shows % depressed in the debug window
var.rAnalog2 = Wiimote2.Classic.R * 100
// These don't map to anything on the WiiGuitar
// = Wiimote2.Classic.Left
// = Wiimote2.Classic.Right
// = Wiimote2.Classic.Home
// = Wiimote2.Classic.ZR
// = Wiimote2.Classic.L
// Right analog stick
// Analog stick for movement
Left = Wiimote2.Classic.Joy1X <= -25%
Right = Wiimote2.Classic.Joy1X >= 25%
Up = Wiimote2.Classic.Joy1Y <= -25%
Down = Wiimote2.Classic.Joy1Y >= 25%
// Wiimote button mapping
// Glovepie uses
Shift+P+I+E = Wiimote2.Home
// Unused Wiimote buttons, if you want to map anything to them
// = Wiimote2.Down
// = Wiimote2.Left
// = Wiimote2.Right
// = Wiimote2.Up
// = Wiimote2.A
// = Wiimote2.B
// = Wiimote2.Plus
// = Wiimote2.Minus
// = Wiimote2.One
// = Wiimote2.Two
// LEDs
Wiimote2.LED1 = false;
Wiimote2.LED2 = true;
Wiimote2.LED3 = false;
Wiimote2.LED4 = false;
Debug = var.rAnalog1 + " " + var.rAnalog2
// Possible additions
// Accelerometer for activating star power if FoF adds the feature
// Rumble for star power if FoF adds the feature
// Rumble and sound for missed note
// Whammy bar information going to outside program |
|
|
| Back to top |
|
 |
psychiccheese
Joined: 11 Nov 2007 Posts: 2
Digg It |
Posted: Mon Nov 12, 2007 11:32 pm Post subject: Portal |
|
|
Here's some code I wrote to get through portal with. It changes the gameplay, and makes it much more interesting.
If anyone has suggestions to improve, I'll be listening.
| Code: |
/////////////////////////////////////////////
//Made by psychiccheese
//Mouse Movement adapted from vkapadia
//
//Needs Nunchuk controller
//No Sensor Bar Required
//
/////////////////////////////////////////////
//Controls:
// On wiimote:
// A: Right Mouse Button
// B: Left Mouse Button
// Down: E key (pick up)
// On nunchuk:
// C: Duck
// Z: Jump
// Camera Movement:
// Tilt wiimote up and down to look up/down
// Roll wiimote side to side to pan view
// Move Character (Nunchuk):
// Joystick mapped to wasd keys
//
/////////////////////////////////////////////
mouse.swallow = false // Disables mouse when true
/////////////////////////////////////////////
//Nunchuck
//Nunchuck Buttons
Key.Space = Wiimote1.Nunchuk.ZButton;
Key.Ctrl = Wiimote1.Nunchuk.CButton;
Key.W = (-1.2 < wiimote.Nunchuk.JoyY < -0.5);
Key.A = (-1.2 < wiimote.Nunchuk.JoyX < -0.5);
Key.S = (0.5 < wiimote.Nunchuk.JoyY < 1.2);
Key.D = (0.5 < wiimote.Nunchuk.JoyX < 1.2);
/////////////////////////////////////////////
//Wiimote
//Wiimote Buttons
Mouse.LeftButton = Wiimote1.B;
Mouse.RightButton = Wiimote1.A;
Key.E = Wiimote1.Down;
//Wiimote Movement
var.x = Wiimote.RawForceX; // x movement of mouse
var.z = Wiimote.RawForceZ; // y movement of mouse
//Precision and Sensitivity Thresholds
var.sens0 = 500;
var.thr0x = 5;
var.thr0y = 2;
var.sens1 = 300;
var.thr1x = 10;
var.thr1y = 5;
var.sens2 = 100;
var.thr2x = 15;
var.thr2y = 8;
var.sens3 = 50;
var.thr3x = 20;
var.thr3y = 12;
//First Sensitivity Setting
//x-axis
if var.x > var.thr0x{
mouse.x = mouse.x - 1/var.sens0;
}
if var.x < -var.thr0x{
mouse.x = mouse.x + 1/var.sens0;
}
//y-axis
if var.z > var.thr0y{
mouse.y = mouse.y - 1/var.sens0;
}
if var.z < -var.thr0y{
mouse.y = mouse.y + 1/var.sens0;
}
//Second Sensitivity Setting
//x-axis
if var.x > var.thr1x{
mouse.x = mouse.x - 1/var.sens1;
}
if var.x < -var.thr1x{
mouse.x = mouse.x + 1/var.sens1;
}
//y-axis
if var.z > var.thr1y{
mouse.y = mouse.y - 1/var.sens1;
}
if var.z < -var.thr1y{
mouse.y = mouse.y + 1/var.sens1;
}
//Third Sensitivity Setting
//x-axis
if var.x > var.thr2x{
mouse.x = mouse.x - 1/var.sens2;
}
if var.x < -var.thr2x{
mouse.x = mouse.x + 1/var.sens2;
}
//y-axis
if var.z > var.thr2y{
mouse.y = mouse.y - 1/var.sens2;
}
if var.z < -var.thr2y{
mouse.y = mouse.y + 1/var.sens2;
}
//Fourth Sensitivity Setting
//x-axis
if var.x > var.thr3x{
mouse.x = mouse.x - 1/var.sens3;
}
if var.x < -var.thr3x{
mouse.x = mouse.x + 1/var.sens3;
}
//y-axis
if var.z > var.thr3y{
mouse.y = mouse.y - 1/var.sens3;
}
if var.z < -var.thr3y{
mouse.y = mouse.y + 1/var.sens3;
}
//End Script
if(Wiimote1.A && Wiimote1.B && Wiimote1.Nunchuk.CButton){
ExitScript;
}
//Debug
//debug = var.x + " " + var.z;
|
Enjoy. |
|
| Back to top |
|
 |
Furluge
Joined: 17 Nov 2007 Posts: 3
Digg It |
Posted: Sat Nov 17, 2007 7:11 pm Post subject: |
|
|
Using the PPJoy Classic Controller Script, The Frets on Fire 2P script, and the scripting reference above I've put together a (1 player only) guitar script for the wii guitar.
This script also has a working tilt-sensor and whammy bar.
Comes in two different flavors, Guitar Hero 3 keyboard mode and a PPJoy script.
The Guitar Hero 3 keyboard mode exists because Guitar Hero 3 refuses to work with the PPJoy virtual joystick. In this script the whammy bar emulates a keyboard key press when depressed so far. Tilting the guitar also triggers a key press
The PPJoy script has the whammy bar on it's own full axis. The joystick on the guitar is an axis, and everything else triggers a joystick button press. Tilting the guitar triggers a joystick button press.
It'd like the thank the creators of the PPJoy Classic Controller Script and the Frets o Fire script. Working through this taught me a lot of how GlovePIE works.
| Code: | // Guitar Hero 3 Wii Controler for Guitar Hero 3 GlovePIE script
//
// This script is configured to make the Wii Guitar act the same
// as the default guitar hero keyboard settings
// Also, don't forget to turn off lefty flip as Guitar Hero will turn
// That on by default if you're set to keyboard in settings
//
//Note: This was chosen because guitar hero refuses to recognize
// The PPJoy virtual joystick as the guitar hero guitar
// Other games that allow joystick configuration coulde be
// setup using PPJoy, allowing the whammy bar to be analog.
// Debug List Setup
var.dummy = Wiimote.RawForceX
if Wiimote.Classic.a then var.G = "Green" else var.G = ""
if Wiimote.Classic.b then var.R = "Red" else var.R = ""
if Wiimote.Classic.x then var.Y = "Yellow" else var.Y = ""
if Wiimote.Classic.y then var.B = "Blue" else var.B = ""
if Wiimote.Classic.ZL then var.O = "Orange" else var.O= ""
if Wiimote.Classic.Minus then var.Minus = "-" else var.Minus = ""
if Wiimote.Classic.Plus then var.Plus = "+" else var.Plus = ""
if Wiimote.Classic.Up then var.Strum = "StrumUp" elseif Wiimote.Classic.Down then var.Strum = "StrumDown" else var.Strum = ""
debug = "Frets: "+var.G+var.R+var.Y+var.B+var.O+var.Minus+var.Plus+"; Strum: "+var.Strum+"; Whammy:"+Wiimote.Classic.R+var.RF+"; Tilt=" + Wiimote.RawForceZ+"; Joystick: X = "+Wiimote.Classic.Joy1X+", Y = "+Wiimote.Classic.Joy1Y;
/*
---BUTTON MAPPING to Keyboard and Mouse--
Configuration:
Green - V
Red - C
Yellow - X
Blue - Z
Orange - Left Shift
Strum Up - Left Mouse Button
Strum Down - Right Mouse Button
Minus - Middle Mouse Button
Plus - Escape
Tilt - Middle Mouse Button
Whammy - Right Alt
Joystick Up - Up
Joystick Down - Down
Joystick Right - Right
Joystick Left - Left
*/
// Guitar Joystick
Key.Left = (-1.2 < Wiimote.Classic.Joy1X < -0.5) // Joystick moving Left = minus X axis
Key.Right = (0.5 < Wiimote.Classic.Joy1X < 1.2) // Joystick moving Right = positive X axis
Key.Up = (-1.2 < Wiimote.Classic.Joy1Y < -0.5) // Joystick moving Up = negative Y axis
Key.Down = (0.5 < Wiimote.Classic.Joy1Y < 1.2) // Joystick moving Down = positive Y axis
// Fret Buttons
Key.V = Wiimote.Classic.a //Green
Key.C = Wiimote.Classic.b //Red
Key.X = Wiimote.Classic.x //Yellow
Key.Z = Wiimote.Classic.y //Blue
Key.LeftShift = Wiimote.Classic.ZL //Orange
// Plus and Minus Buttons
Mouse.MiddleButton = Wiimote.Classic.Minus //Star Power
Key.Escape = Wiimote.Classic.Plus //Menu / Pause
// Strum Bar
Mouse.LeftButton = Wiimote.Classic.Up //Strum Up
Mouse.RightButton = Wiimote.Classic.Down //Strum Down
// Press the Right Alt button (Whammy) when the whammy bar is depressed
// To tweak the timing of how far down you need to tilt the whammy
// bar to hit the key, alter the value to the left of < Wiimote
// For Referance, my whammy ranges from 0.52 at rest to 0.84 fully pressed
Key.RightAlt = (0.6 < Wiimote.Classic.R < 0.9)
// Press the Middle Mouse Button (Star Power) if the guitar is tilted
// To tweak the tilt timing, alter the value to the left of < Wiimote
// Make it lower to trigger sooner, raise it to trigger later
// For reference, I recorded a 24-25 value when completely vertical
// A roughly 45 degree tilt has a value of 14-15
// And a horizontal guitar read -1-0
Mouse.MiddleButton = (20 < Wiimote.RawForceZ < 100)
// LEDs - Turn on Player 1 LED, turn all others off
Wiimote1.LED1 = true;
Wiimote1.LED2 = false;
Wiimote1.LED3 = false;
Wiimote1.LED4 = false;
//END OF FILE |
| Code: | // PPJoy Wii Guitar Script
// This script will configure a PPJoy enabled guitar that is fully
// functional, including tilt sensor.
// Debug List Setup
var.dummy = Wiimote.RawForceX
if Wiimote.Classic.a then var.G = "Green" else var.G = ""
if Wiimote.Classic.b then var.R = "Red" else var.R = ""
if Wiimote.Classic.x then var.Y = "Yellow" else var.Y = ""
if Wiimote.Classic.y then var.B = "Blue" else var.B = ""
if Wiimote.Classic.ZL then var.O = "Orange" else var.O= ""
if Wiimote.Classic.Minus then var.Minus = "-" else var.Minus = ""
if Wiimote.Classic.Plus then var.Plus = "+" else var.Plus = ""
if Wiimote.Classic.Up then var.Strum = "StrumUp" elseif Wiimote.Classic.Down then var.Strum = "StrumDown" else var.Strum = ""
debug = "Frets: "+var.G+var.R+var.Y+var.B+var.O+var.Minus+var.Plus+"; Strum: "+var.Strum+"; Whammy:"+Wiimote.Classic.R+var.RF+"; Tilt=" + Wiimote.RawForceZ+"; Joystick: X = "+Wiimote.Classic.Joy1X+", Y = "+Wiimote.Classic.Joy1Y;
/*
---BUTTON MAPPING to PPJoy 1--
Configuration:
Green - Button 1
Red - Button 2
Yellow - Button 3
Blue - Button 4
Orange - Button 5
Strum Up - Button 7
Strum Down - Button 8
Minus - Button 6
Plus - Escape Keyboard Key
Tilt - Button 6
Whammy - X Rotation Axis
Joystick Up - Joystick Y+
Joystick Down - Joystick Y-
Joystick Right - Joystick X+
Joystick Left - Joystick X-
*/
// Guitar Joystick
PPJoy1.Analog0 = Wiimote.Classic.Joy1X // Left and Right
PPJoy1.Analog1 = Wiimote.Classic.Joy1Y // Up and Down
// Fret Buttons
PPJoy1.Digital0 = Wiimote.Classic.a //Green
PPJoy1.Digital1 = Wiimote.Classic.b //Red
PPJoy1.Digital2 = Wiimote.Classic.x //Yellow
PPJoy1.Digital3 = Wiimote.Classic.y //Blue
PPJoy1.Digital4 = Wiimote.Classic.ZL //Orange
// Plus and Minus Button
// Assumes Digital 6 (Joystick Button 5) is "Star Power"
// Plus is set to escape as it's the most popular PC pause key
PPJoy1.Digital5 = Wiimote.Classic.Minus // Star Power
Key.Escape = Wiimote.Classic.Plus // Pause / Escape
// Strum Bar
PPJoy1.Digital6 = Wiimote.Classic.Up // Strum Up
PPJoy1.Digital7 = Wiimote.Classic.Down // Strum Down
// Whammy Bar, set to X Rotation Axis
// Xrotation rises as whammy is depressed
// Don't forget to calibrate this
PPJoy1.Analog5 = -Wiimote.Classic.R
// Joystick Button 6 for (Star Power) if the guitar is tilted
// To tweak the tilt timing, alter the value to the left of < Wiimote
// Make it lower to trigger sooner, raise it to trigger later
// For reference, I recorded a 24-25 value when completely vertical
// A roughly 45 degree tilt has a value of 14-15
// And a horizontal guitar read -1-0
PPJoy1.Digital5 = (20 < Wiimote.RawForceZ < 100) // Star Power
// LEDs - Turn on Player 1 LED, turn all others off
Wiimote1.LED1 = true;
Wiimote1.LED2 = false;
Wiimote1.LED3 = false;
Wiimote1.LED4 = false;
//END OF FILE
|
|
|
| Back to top |
|
 |
XypherOrion
Joined: 01 Nov 2007 Posts: 9
Digg It |
Posted: Sat Dec 01, 2007 9:29 pm Post subject: |
|
|
| perhaps an entire forum category would be appropriate for all of these scripts so its easier to read? |
|
| Back to top |
|
 |
|
|
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
|