Hacking Do you use the Wiimote on your PC, yet?

  • Thread starter Thread starter OrR
  • Start date Start date
  • Views Views 6,823
  • Replies Replies 36

OrR

Rice-megatron Expert
Member
Joined
Nov 24, 2005
Messages
1,562
Reaction score
10
Trophies
1
Age
41
Location
Hildesheim/Germany
Website
Visit site
XP
233
Country
Gambia, The
This is so awesome... I just played some Half Life 2 and it works perfectly!
smile.gif

Here is the easy to modify GlovePIE script I use for pretty much everything. It's got IR pointing (use candles!) and arrow keys mapped to the Nunchuck analog, B and A as left and right mouse buttons as well as every other Wiimote and Nunchuck button mapped to a random keyboard key.
I could use a nunchuck-shake to button skript as well as other motion scripts. Do you have some?
CODE//Mouse Control Script using IR
//by vkapadia with much assistance from inio
//[email protected]
//
//Calibration:
//To calibrate, run this program and put the Wiimote on a flat surface face-up.
//Then read the values in the debug line (next to the run button).
//Change these values until the debug line reads approx. all zeros.
var.xtrim = 6
var.ytrim = -31
var.ztrim = 6
//
//Options:
var.deadzone = 5 //distance in pixels that you have to move the wiimote in
 //order for it to register movement. Creates a "dead zone" around the pointer
 //to make it easier to click. Higher = smoother but less accurate.
var.KITTspeed = 100 ms //delay speed for flashing LEDs. higher = slower
var.rumble = false //makes the wiimote rumble if you hit the edge of the screen
//more options to be added later

//Controls:
//Point Wiimote = Move Mouse
//D-Pad = Arrow Keys
//B-Button = Left Click
//Home = Middle Click
//A-Button = Right Click
//Plus and Minus = Control Volume
//One = Unmapped
//Two = Unmapped
//
//If the pointer hits the edge of the screen, the Wiimote will rumble a bit.
//
//The LEDs attempt to emulate KITT's grill from Knight Rider

//***Do not edit anything below this line unless you know what you are doing.***

//Mouse Buttons
Mouse.RightButton = Wiimote.A
Mouse.LeftButton = Wiimote.B
Mouse.MiddleButton = Wiimote.Home

// analog = movement
Up = Wiimote.Nunchuk.JoyY < -0.2
Down = Wiimote.Nunchuk.JoyY > 0.2
Left = Wiimote.Nunchuk.JoyX < -0.2
Right = Wiimote.Nunchuk.JoyX > 0.2

//wiimote One and Two
e = Wiimote.One
r = Wiimote.Two
//Plus and Minus
t = Wiimote.Plus
z = Wiimote.Minus
//Nunchuck Buttons
u = Wiimote.Nunchuk.CButton
i = Wiimote.Nunchuk.ZButton
//Wiimote D-Pad
w = Wiimote.Up
s = Wiimote.Down
a = Wiimote.Left
d = Wiimote.Right

//LEDs look somewhat like KITT's grill from Knight Rider
if 0 = 0 then
Âif var.kitt = 0 then
 Âwiimote.Leds = 1
Âendif
Âif var.kitt = 1 then
 Âwiimote.Leds = 3
Âendif
Âif var.kitt = 2 then
 Âwiimote.Leds = 6
Âendif
Âif var.kitt = 3 then
 Âwiimote.Leds = 12
Âendif
Âif var.kitt = 4 then
 Âwiimote.Leds = 8
Âendif
Âif var.kitt = 5 then
 Âwiimote.Leds = 12
Âendif
Âif var.kitt = 6 then
 Âwiimote.Leds = 6
Âendif
Âif var.kitt = 7 then
 Âwiimote.Leds = 3
Âendif
Âwait var.KITTspeed
Âvar.kitt = (var.kitt + 1) % 8
endif

//If the mouse reaches the end, rumble for 200 milliseconds
if var.rumble and (mouse.x = 0 or mouse.x = 1 or mouse.y = 0 or mouse.y = 1) then
Âif var.rmbl = false
 Âwiimote.Rumble = 1
 Âwait 200 ms
 Âwiimote.Rumble = 0
Âendif
Âvar.rmbl = true
else
Âvar.rmbl = false
endif

var.accx = wiimote.RawForceX + var.xtrim
var.accy = wiimote.RawForceY + var.ytrim
var.accz = wiimote.RawForceZ + var.ztrim

if wiimote.dot1vis and wiimote.dot2vis then

Âif var.accy > -7 then
 Âvar.orientation = 0
Âelseif var.accy > -45 then
 Âif var.accx < 0 then
  Âvar.orientation = 3
 Âelse
  Âvar.orientation = 1
 Âendif
Âelse
 Âvar.orientation = 2
Âendif

Âif var.leftpoint = 0 then
 Âif var.orientation = 0 then
  Âif wiimote.dot1x < wiimote.dot2x then
   Âvar.leftpoint = 1
  Âelse
   Âvar.leftpoint = 2
  Âendif
 Âendif
 Âif var.orientation = 1 then
  Âif wiimote.dot1y > wiimote.dot2y then
   Âvar.leftpoint = 1
  Âelse
   Âvar.leftpoint = 2
  Âendif
 Âendif
 Âif var.orientation = 2 then
  Âif wiimote.dot1x > wiimote.dot2x then
   Âvar.leftpoint = 1
  Âelse
   Âvar.leftpoint = 2
  Âendif
 Âendif
 Âif var.orientation = 3 then
  Âif wiimote.dot1y < wiimote.dot2y then
   Âvar.leftpoint = 1
  Âelse
   Âvar.leftpoint = 2
  Âendif
 Âendif
Âendif

Âif var.leftpoint = 1 then
 Âvar.fix1x = wiimote.dot1x
 Âvar.fix1y = wiimote.dot1y
 Âvar.fix2x = wiimote.dot2x
 Âvar.fix2y = wiimote.dot2y
Âelse
 Âvar.fix1x = wiimote.dot2x
 Âvar.fix1y = wiimote.dot2y
 Âvar.fix2x = wiimote.dot1x
 Âvar.fix2y = wiimote.dot1y
Âendif

Âvar.dx = var.fix2x - var.fix1x
Âvar.dy = var.fix2y - var.fix1y
Âvar.cx = (var.fix1x+var.fix2x)/1024.0 - 1
Âvar.cy = (var.fix1y+var.fix2y)/1024.0 - .75

Âvar.d = sqrt(var.dx*var.dx+var.dy*var.dy)

Âvar.dx = var.dx / var.d
Âvar.dy = var.dy / var.d

Âvar.ox = -var.dy*var.cy-var.dx*var.cx;
Âvar.oy = -var.dx*var.cy+var.dy*var.cx;

Âvar.ax = (var.ox * screen.desktopwidth) + (screen.desktopwidth / 2)
Âvar.ay = (-var.oy * screen.desktopwidth) + (screen.desktopheight / 2)




Âvar.dx = var.ax - mouse.cursorposx
Âvar.dy = var.ay - mouse.cursorposy

Âvar.d = sqrt((var.dx*var.dx)+(var.dy*var.dy))

Âvar.a = 180 / (200 + var.d * var.d * var.d * .001)

Âif var.d
 
Oh GlovePIE, ive had so many problems with that. I went through 3 different stacks then finally went back to my original BlueSoleil settings and it works for the most part...
 
on wiili.org you can find all about wiimote hacking and sure if you have scripting skills you can do pretty much everything.

i'd like to controll my mouse with wiimote and right and left click with A B..
with an exe application that when started change mouse controll to wiimote
someone can do this simple script and post here?

thanks
 
All the scripts you wants exists in the Wiimotescripts directory of glovepie... inclusive wiimouse IR.pie.
 
i'm going to try it this night for world of warcraft
smile.gif

tho I'm not sure what I'm going to use as IR...
frown.gif

Do I really dare bringing small candle thingies to school? guess I'm going to have to bring my wii
tongue.gif
 
Thanks for sharing, dude! I didn't know they got the onscreen pointer thingy working out!

I'm getting a bluetooth adapter this afternoon, gonna see if it works!
 
i'm going to try it this night for world of warcraft
smile.gif

tho I'm not sure what I'm going to use as IR...
frown.gif

Do I really dare bringing small candle thingies to school? guess I'm going to have to bring my wii
tongue.gif


Trouble is the Wii needs to be on for the sensor bar to be on and then it will also talk to the Wiimote...
unsure.gif

on wiili.org you can find all about wiimote hacking and sure if you have scripting skills you can do pretty much everything.

i'd like to controll my mouse with wiimote and right and left click with A B..
with an exe application that when started change mouse controll to wiimote
someone can do this simple script and post here?

thanks

The GlovePIE script I posted above does exactly what you want and it's easy to modify.
cool.gif

QUOTE(Shinji @ Jan 5 2007, 04:00 PM)Oh GlovePIE, ive had so many problems with that. I went through 3 different stacks then finally went back to my original BlueSoleil settings and it works for the most part...
I never had any problems once I finally understood how to connect my Wiimote with BlueSolei...
 
I dunno, I tried (not for long, though), and even though the wiimote was correctly "detected" by wiinremote, mii megamall and glovepie, it didn't detect any input at all... And I tried pressing 1 and 2 several times whenever some faq said you have to, but it didn't change a thing... Do you need to keep pressing them, or does it need to be only twice?

What's the best driver for this to work? Didn't get any noticeable results with the vanilla microsoft stack or the toshiba stack provided with my connectland bluetooth key.
 
I think the Wiili Wiki recommends the BlueSolei drivers. Luckily they came with my stick but they should be available for download somewhere.
You only have to press 1&2 until your Wiimote is connected to your PC...
 
Here is a script I made. You can add anywhere at bottoms of other sctips to display Wiimote battery status with the leds.


CODEvar.bat = Wiimote.Battery
var.leds = 4




Âif var.bat < 0.25 then
 Âvar.leds = 1

Âelseif var.bat > 0.25 then
 Âif var.bat < 0.5 then
  Âvar.leds = 2
  Âelseif Âvar.bat > 0.5 then
   Âif var.bat > 0.75 then
     var.leds = 3
   Âelse var.leds = 4
  Âendif
 Âelse var.leds = 4
 Âendif

endif
endif

if var.leds = 4 then
Wiimote.Led1 = true
Wiimote.Led2 = true
Wiimote.Led3 = true
Wiimote.Led4 = true
endif

if var.leds = 3 then
Wiimote.Led1 = true
Wiimote.Led2 = true
Wiimote.Led3 = true
Wiimote.Led4 = false
endif

if var.leds = 2 then
Wiimote.Led1 = true
Wiimote.Led2 = true
Wiimote.Led3 = false
Wiimote.Led4 = false
endif

if var.leds = 1 then
Wiimote.Led1 = true
Wiimote.Led2 = false
Wiimote.Led3 = false
Wiimote.Led4 = false
endif
 
who can help me? I have set up a bluetooth adapter (Widdcom) and it finds the Wiimote, I have connected it but the PC only sends data to the Wiimote (which leds have to go on, or rumble) but doesn't receive like tilting the Wiimote, button presses etc :S
 
Turns out I didn't need to install the bluesoleil drivers, the toshiba ones worked fine!
I just... Needed to reboot. I was so proud of my fucklong uptime, that it blinded me to the simplest truth : fuck windows.

(god, I feel stupid)
 
Yup, I tried connecting the Wiimote to my father's laptop. Works perfectly, though I haven't tried GlovePIE yet, Wiinmote is okay for everything that doesn't require a nunchuck.
 
I've been using mine to play old nes games on my macbook. Pretty rad that I know have a 2 in 1 controller for both my console and my computer.
 
Yeah, first I thought making the Xbox 360 controller available for Windows was a good idea but this is so much better.
biggrin.gif

Did anyone connect it to their Playstation 3 Linux, yet?
rofl2.gif
 

Site & Scene News

Popular threads in this forum