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.

If this is too much, you can find a simpler script, with just mouse controls here.

For more fun articles, please visit my blog, The Brain Collective.

This article has now paid me over $25, and counting!  Click here to join Triond and start making money for youself!

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

- The + and – buttons control forward and back in your web browser

- The 1 button opens email

- The 2 button refreshes your web browser

- 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!

====Script starts here, copy everything below this line====

//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

==== Script is over, do not copy this line====

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.

Moshevi180
09.08.01

Now i can control my mouse with the nunchuck thanks to you! :) :)

09.08.01

Like many others I was looking for an easy “how to” about making music with my WiiMote, I couldn’t find it so I wrote my own. Check my website:
http://www.winko-erades.nl/

Regards,

Winko

kumar
09.08.01

thank you very much for this. it is awesome!!!

comments powered by Disqus
Loading