- Joined
- Nov 24, 2005
- Messages
- 1,562
- Trophies
- 0
- Age
- 38
- Location
- Hildesheim/Germany
- Website
- Visit site
- XP
- 193
- Country
This is so awesome... I just played some Half Life 2 and it works perfectly!
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
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