Wiimote.Rumble = Joystick.ForceFeedback //Wiimote.Led1 = Wiimote.Battery > 38 //Wiimote.Led2 = Wiimote.Battery > 76 //Wiimote.Led3 = Wiimote.Battery > 115 //Wiimote.Led4 = Wiimote.Battery > 153 Wiimote.Leds = Wiimote.Battery / 12.8 //Mouse1.Visible = true //Mouse1.Cursor = Random(21) if Wiimote.Up then Mouse1.WheelUp = true Mouse1.WheelUp = false endif if Wiimote.Down then Mouse1.WheelDown = true Mouse1.WheelDown = false endif if Wiimote.Left then Mouse1.WheelLeft = true Mouse1.WheelLeft = false endif if Wiimote.Right then Mouse1.WheelRight = true Mouse1.WheelRight = false endif Mouse1.RightButton = Wiimote.B Mouse1.LeftButton = Wiimote.A Mouse1.MiddleButton = Wiimote.Home //if Wiimote.Plus then // if var.osk = false then // Execute("osk") // var.osk = true // endif //endif //if Wiimote.Minus then // if var.osk = true then // ExitProgram // var.osk = false // endif //endif Mouse1.XButton1 = Wiimote.Minus Mouse1.XButton2 = Wiimote.Plus Keyboard.Enter = Wiimote.One Keyboard.Esc = Wiimote.Two // set these to the offsets when the wiimote is at rest // will be different for each wiimote most likely var.x = Wiimote.RawForceX + 9 //trim to 0 var.y = Wiimote.RawForceY - 32 // trim to 0 var.z = Wiimote.RawForceZ + 9 //trim to 0 var.nx = Wiimote.Nunchuk.RawForceX - 2 var.ny = Wiimote.Nunchuk.RawForceY - 45 var.nz = Wiimote.Nunchuk.RawForceZ + 19 Cursor0.Visible = Wiimote.HasNunchuk 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 <= var.deadzone then var.a = 1 debug = var.d + " " + var.a var.finalx = mouse.cursorposx * var.a + var.ax * (1 - var.a) var.finaly = mouse.cursorposy * var.a + var.ay * (1 - var.a) mouse.cursorposx = var.finalx mouse.cursorposy = var.finaly else var.leftpoint = 0 endif