FoamyGuy
Joined: 19 Apr 2008 Posts: 1
Digg It |
Posted: Sat Apr 19, 2008 3:15 pm Post subject: GlovePie Wiimote/Nunchuck Mouse Script |
|
|
A simple script to use the wiimote/nunchuk combo as a mouse. This was designed specifically for navigating Firefox. But can be easily adapted to many other applications.
Please note: While I was working on this my Wiimote/Nunchuk combo was set to wiimote2 in glovePie, so unless yours is also that way you'll have to find/replace "wiimote2" with "wiimote"
| Code: | //FoamyGuy Nunchuk Mouse
//Modified version of:
//Kunal Khiyani's nunchuk mouse
// based on
// Modified version of Squeakypants' D-Pad mouse script
if (-1.2 < wiimote2.Nunchuk.JoyY < -0.09) {
Mouse.DirectInputY = Mouse.DirectInputY + 40 * wiimote2.Nunchuk.JoyY;
}
if (0.09 < wiimote2.Nunchuk.JoyY < 1.2) {
Mouse.DirectInputY = Mouse.DirectInputY + 40 * wiimote2.Nunchuk.JoyY;
}
if (-1.2 < wiimote2.Nunchuk.JoyX < -0.09) {
Mouse.DirectInputX = Mouse.DirectInputX + 40 * wiimote2.Nunchuk.JoyX;
}
if (0.09 < wiimote2.Nunchuk.JoyX < 1.2) {
Mouse.DirectInputX = Mouse.DirectInputX + 40 * wiimote2.Nunchuk.JoyX;
}
//LED
wiimote2.Led1 = true
//Mouse Buttons
Mouse.MiddleButton = wiimote2.Nunchuk.ZButton;
Mouse.RightButton = wiimote2.A;
Mouse.LeftButton = wiimote2.B;
//Firefox shortcuts
Keyboard.Ctrl + Keyboard.R = wiimote2.Nunchuk.CButton; //Refresh
Keyboard.Alt + Keyboard.Left = wiimote2.Left; //Back
Keyboard.Alt + Keyboard.Right = wiimote2.Right; //Forward
Keyboard.Alt + Keyboard.Q = wiimote2.Plus; //Stumble (Note: My stumble is set to alt + "q", default is alt + "`" )
Keyboard.Ctrl + Keyboard.Tab = wiimote2.Minus; //Switch tabs
Keyboard.Alt + Keyboard.W = wiimote2.One; // Thumbs up stumble(Default is: Alt + "1")
Keyboard.Alt + Keyboard.E = wiimote2.Two; // Thumbs down for stumble(Default is Alt + "2")
//Scroll
if (wiimote2.Up) {
Mouse.WheelUp = true
wait 30 ms
Mouse.WheelUp = false
}
if (wiimote2.Down) {
Mouse.WheelDown = true
wait 30 ms
Mouse.WheelDown = false
}
|
|
|