 |
WiiLi.org a new revolution
|
| View previous topic :: View next topic |
| Author |
Message |
mdvalenz
Joined: 21 Nov 2006 Posts: 42
Digg It |
Posted: Sun Oct 28, 2007 5:49 pm Post subject: |
|
|
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 |
Last edited by mdvalenz on Tue Oct 30, 2007 3:44 am; edited 9 times in total |
|
| Back to top |
|
 |
mf6421
Joined: 21 Oct 2007 Posts: 5
Digg It |
Posted: Mon Oct 29, 2007 4:14 am Post subject: |
|
|
| Pretty awesome that it was so easy to get this working, so it seems. Anyway Frets on fire, at least the version I use, allows an extra strum button. So the upstrum should be mapped as the right shift which is the default button. All i need now is a bluetooth receiver and the guitar. |
|
| Back to top |
|
 |
mdvalenz
Joined: 21 Nov 2006 Posts: 42
Digg It |
Posted: Mon Oct 29, 2007 5:20 am Post subject: |
|
|
Thanks for the info, i forgot FoF had a second strum key. Added it to the script.
I will probably also add in the key mapping for two players, though I never tried two people using glovepie at the same time. I need to designate each controller command and add the key maps from FoF. I will do that tomorrow if I have time, since I won't get the game for a couple days.
Just added 2-player support. Let me know if it works for you.
Alright, I am done for the day. Now I am thinking of adding feedback from FoF to the wiimote like Guitar Hero. If anyone knows what to look for from the game when you miss a note so I can map that to rumble please post or edit the script yourself. Also, for the missed note sound from the wiimote speaker. Right now the speaker sounds aren't too great, but maybe a generic sound rather than trying to have a different bad note for each fret. |
|
| Back to top |
|
 |
swordmasterharuka
Joined: 29 Oct 2007 Posts: 1 Location: North Carolina, US
Digg It |
Posted: Mon Oct 29, 2007 3:57 pm Post subject: |
|
|
| I have the Wii version of Guitar Hero III and noticed last night that it runs off the classic controller. I'm going to test out your script and see if I can also figure out the mapings for the whammy and analog, although I'm fairly sure right now that the analog is the same as the left analog on the classic controller. As for the whammy bar, I have noticed that when you pull the bar UP just slightly (please don't break your guitars, fair readers) it registers as the R button. I'm not sure why this is, but I'll keep working on it. |
|
| Back to top |
|
 |
mdvalenz
Joined: 21 Nov 2006 Posts: 42
Digg It |
Posted: Mon Oct 29, 2007 5:01 pm Post subject: |
|
|
Actually it would make sense that it registers as the R button. The R button is an analog button, think throttle or speed control. Using it they could change the tone of the sound with how far you push the button in, move the whammy bar. It would make more sense, keep in mind I have never touched a Guitar controller, that pushing the whammy bar in would show up as the L button. Then they could change the sound Up or Down with how far you push the whammy bar in either direction. Let me know if this is what they did and I can change the script, though FoF isn't going to add whammy bar as a feature at all, as far as I can tell. But maybe another free guitar program will pop up that can use it.
Also, let me know which analog stick is the stick on the guitar face, and if the script works at all of course. Especially if someone out there can try the two player part of it. |
|
| Back to top |
|
 |
mdvalenz
Joined: 21 Nov 2006 Posts: 42
Digg It |
Posted: Mon Oct 29, 2007 5:38 pm Post subject: |
|
|
Alright, took some searching but I found out, roughly, how to set up keys for the whammy bar, if it does use the R (and L) buttons as analog buttons. However it looks like I can only set it up to press a key at a certain percentage of it pushed down. I could set up a bunch of key maps, one for every 10% or so, but it would be easier to just have glovepie report on the percentage and have the external program use that to alter the sound.
For those who are interested it would be something like this:
A = Wiimote.Classic.L > 10%
S = Wiimote.Classic.L > 20%
Etc
I would probably need to set up the code for a range of percentages instead (0%-10%)but you get the idea.
It would use up a lot of the keyboard but is doable. I would reccomend the other way.
I don't have any great programming experience so I don't know how to write the code that can tell glovepie to read the button value and report, or the code for the separate program to pick up the report and use it to change the tone of a sound. I suppose if no one does write the program I might decide to learn python and write some proof of concept code, though FoF uses python and they said it would be too complicated to have python change the tone of a sound which is why they don't include the feature. So maybe I can try C++ or even Basic. If anyone knows a good language that can easily alter the tone of a playing sound or music let me know. Or an open source program that has this feature and we could just shoehorn in the whammy bar code. Thanks.
Edit: Just tested out the analog stick on the classic controller for mouse movement and it works in windows but not in FoF so I removed it. Also changed some lines to show the whammy bar is mapped to shoulder buttons.
Edit2: Finally figured out how to read information from the analog shoulder buttons. Now when you run the script the debug window in GlovePie will show the % depressed for each shoulder button for both players. Each classic controller analog button has different min and max percentages so don't worry if yours doesn't go from 1-99. We can use this to find out if the whammy bar uses just the right analog button or both the right and left.
Also, if someone can use the accelerometer mouse script and place the WiiGuitar in the position you need to activate the star power so I can see how many degrees up the controller needs to move to activate the key. Thanks
Last Edit: Got the game today so I tested out the script and finished up everything. It ran great. The whammy bar is mapped only to the right shoulder button. I will make a new post whenever I decide to update the script with the accelerometer values to activate a star power. Or if any of the other additions get anywhere. Not that you need them for FoF since it doesn't have any of those features, but just in case someone from the FoF community uses the script it will be ready if they want to add those features, or if another Guitar game is being worked on they could add those. |
|
| Back to top |
|
 |
HowardC
Joined: 05 Feb 2007 Posts: 9 Location: USA
Digg It |
Posted: Thu Nov 01, 2007 12:14 am Post subject: |
|
|
Good work with the script man, you beat me to it!
About the tilt sensor... I *think* that it works more on a relative change than a set angle. This allows people who hold the guitar differently to keep from accidentally setting it off. Of course I think after a certain extreme it kicks in anyway, but it's really high, like 70+ degrees. |
|
| 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
|