GlovePIE:Chromadrome 2
From WiiLi
(Redirected from Chromadrome 2)
Script for controlling Chromadrome 2 using tilt feature of wiimote.
// Chromadrome 2 script by Klaus Post
// v1.1 (De)acceleration added.
// v2.0 Rewritten for better control. Fixed mouseclick.
// Contains code by Kasten
// NOTE for this code to work right with the wiimote please
// read the following
// Controls:
// Hold your wiimote in your hand, with the 1+2 side on your right and
// power button at your left hand. Hold it level when starting a course.
// 2 is left mouse button.
// 1 is right mouse button (not used in game)
// Up is Escape (to go back a menu)
// You can diable the controls, by clicking A.
// LED will go out, and the mouse will no longer be controlled by your wiimote
// This is very useful for menu navigation, so you can use your mouse.
// Use 1/2 or A to re-enable the wiimote.
// Change this if you would like your mouse to go faster
var.speed = 10.0
// change these to a higher number if your hands are not steady or lower if they are
var.xCutoff = 0.0
var.yCutoff = 0.0
var.zCutoff = 0.0
var.xRot = Smooth(Delta(Wiimote.RawForceX), 2 ) // Two frames seems like an acceptable delay
var.yRot = Smooth(Delta(Wiimote.RawForceY), 2 )
var.zRot = Smooth(Delta(Wiimote.RawForceZ), 2 )
debug = "X:" + var.xRot + ", " + "Y:" + var.yRot + ", " + "Z:" +var.zRot
// This is the code that moves your mouse
if (wiimote.Leds == 1) {
If var.xRot > var.xCutoff Then Mouse.DirectInputY = Mouse.DirectInputY + var.speed * (var.xRot - var.xCutoff)
If var.xRot < -var.xCutoff Then Mouse.DirectInputY = Mouse.DirectInputY + var.speed * (var.xRot + var.xCutoff)
If var.zRot > var.zCutoff Then Mouse.DirectInputX = Mouse.DirectInputX + var.speed * (var.zRot - var.zCutoff)
If var.zRot < -var.zCutoff Then Mouse.DirectInputX = Mouse.DirectInputX + var.speed * (var.zRot + var.zCutoff)
}
// 2 for left click and 1 for right click
if (Wiimote.1) {
Mouse.RightButton = true
wiimote.Leds = 1
} else {
Mouse.RightButton = false
}
if (Wiimote.Up) {
Keyboard.Escape = true
} else {
Keyboard.Escape = false
}
if (Wiimote.2) {
Mouse.LeftButton = true
wiimote.Leds = 1
} else {
Mouse.LeftButton = false
}
if (Wiimote.A) {
if (wiimote.Leds == 1) {
wiimote.Leds = 0
} else {
wiimote.Leds = 1
}
wait 1000ms
}

