A Useful Glovepie Script for Controlling Your Computer with a Wii Remote

This is a script that controls the mouse, things like your music player and your browser, and more with a Wii Remote.

If you don’t know much about GlovePIE, go here to learn how to use it.

Here is a rundown of the controls:

The Joystick controls the mouse

A is click and B is right click

Left and right on the D-Pad controls the volume

Up and Down on the D-Pad scrolls

+ and – controls forward and back on the internet

The 1 button opens email

The 2 button refreshes the internet

The C button play the next track on your music player

The the Z button is lots of random fun

That’s it, your can change anything if you want to.  Have fun!

//Start Script

//Variables
     var.minim = 0.08    //Joy sensibility
       var.top = 10       //Maximum speed( pixels/frame )
var.freezetime = 300 ms
 pie.FrameRate = 100 hz  //Leave between 60 and 100 Hz

//Freeze
var.freeze = KeepDown(Pressed(nunchuk.ZButton),var.freezetime)

//Mouse
If var.active=True and var.freeze=false
Mouse.x=Smooth((1/(screen.Width/var.x)), 2)
Mouse.y=Smooth((1/(screen.Height/var.y)), 2)
Else
var.x = MapRange(Mouse.x, 0, 1, 1, screen.Width)
var.y = MapRange(Mouse.y, 0, 1, 1, screen.Height)
Endif

var.speedy=Smooth((abs(wiimote.Nunchuk.Joyy)*var.top))
var.speedx=Smooth((abs(wiimote.Nunchuk.Joyx)*var.top))
if (-var.minim<(wiimote.Nunchuk.Joyy or wiimote.Nunchuk.Joyx)
//Joys
If wiimote.Nunchuk.Joyy < -var.minim Then var.y=var.y-var.speedy
If wiimote.Nunchuk.Joyy > var.minim Then var.y=var.y+var.speedy
If wiimote.Nunchuk.Joyx < -var.minim Then var.x=var.x-var.speedx
If wiimote.Nunchuk.Joyx > var.minim Then var.x=var.x+var.speedx

//random
if pressed (Wiimote1.Nunchuk.ZButton)
wiimote.rumble = 1
if var.check = 1
wiimote.leds = var.led+1
var.led = var.led+1
else
wiimote.leds = 1
var.led = 1
var.check = 1
endif
wait 150 ms
wiimote.rumble = 0
endif

//Buttons
Mouse.LeftButton = Wiimote1.A
Mouse.RightButton = Wiimote1.B
Key.VolumeDown = Wiimote1.Left
Key.VolumeUp = Wiimote1.Right
Mouse.WheelUp = Wiimote1.Up
Mouse.WheelDown = Wiimote1.Down
Key.WebBack = Wiimote1.Minus
Key.WebForward = Wiimote1.Plus
Key.WebHome = Wiimote1.Home
Key.Mail = Wiimote1.One
Key.WebRefresh = Wiimote1.Two
Key.NextTrack = Wiimote1.Nunchuk.CButton

//End Script

3 Responses

Kevin
09.08.01

i need your help…
i used your wiimote script and my only issue is that the joystick(to control mouse) does not work.

it is connected and also the buttons on the nunchuck work

luigijacks
09.08.01

hey i can help you just add >

var.speed = nunchuck.Joy

var.speed = var.speed * 15
end if

mouse.DirectInput2D += var.speed

and the nunchuck works
i am not the one who made the script up at the top of this page!
i just thought i might help!

luigijacks
09.08.01

by the way> var.speed = var.speed * 15<the 15 can be changed

it refers to the speed of the cursor.

Leave Your Response