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 Wiimote/Nunchuck Mouse Script

 
Post new topic   Reply to topic    WiiLi.org Forum Index -> Wii Scripts
View previous topic :: View next topic  
Author Message
FoamyGuy



Joined: 19 Apr 2008
Posts: 1

Digg It
PostPosted: 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
}

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
Page 1 of 1

 
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