//Dark Messiah Script v0.9 for the Wiimote + MotionPlus + Nunchuk by MoreDread W = -2 < Wiimote.Nunchuk.JoyY < -0.2 S = 2 > Wiimote.Nunchuk.JoyY > 0.2 A = -2 < Wiimote.Nunchuk.JoyX < -0.2 D = 2 > Wiimote.Nunchuk.JoyX > 0.2 if var.holdmouse = false mouse.LeftButton = wiimote.B or (var.direction = "down") elseif var.holdmouse and (wiimote.B or (var.direction = "down")) mouse.leftbutton = false var.holdmouse = false var.readyforswing = false endif mouse.rightbutton = (wiimote.roll > 70 and wiimote.nunchuk.roll > 70) or wiimote.one or (wiimote.roll < -70 and wiimote.nunchuk.roll > 70) Keyboard.Space = Wiimote.Minus Keyboard.Ctrl = Wiimote.Home Keyboard.F = Wiimote.Plus key.E = Wiimote.Nunchuk.CButton Key.LeftShift = wiimote.Nunchuk.ZButton if wiimote.Nunchuk.CButton = false and wiimote.Nunchuk.ZButton = false keyboard.1 = Wiimote.up keyboard.2 = Wiimote.down keyboard.Tab = wiimote.two Mouse.WheelUp, 100 ms = wiimote.Left Mouse.WheelDown, 100 ms = Wiimote.Right endif if wiimote.Nunchuk.CButton = true and wiimote.Nunchuk.CButton = false keyboard.3 = Wiimote.up keyboard.4 = Wiimote.down key.v = wiimote.Left endif if wiimote.Nunchuk.ZButton = true and wiimote.Nunchuk.ZButton = false keyboard.5 = Wiimote.up keyboard.6 = Wiimote.down endif if wiimote.Nunchuk.CButton = true and wiimote.Nunchuk.ZButton = true keyboard.7 = Wiimote.up keyboard.8 = Wiimote.down keyboard.esc = wiimote.two key.f6 = wiimote.Left key.f9 = wiimote.right endif /* Wii MotionPlus Mouse v 2010.01.24 by lednerg */ var.MoveButton = wiimote.A var.CalibrateButton = key.Home var.Speed = 75 // 0 to 100 var.BorderStop = true // (true=DirectInput, false=Mouse.X/Y) var.FrameRate = 100hz // ==== Wii MotionPlus Mouse ================================================= debug = var.CalDebug if var.init = true and var.CalibrateButton = false { PIE.FrameRate = var.FrameRate if var.CalibrationTimeOut = var.CTO { var.CalibYaw = Smooth(wiimote.MotionPlus.YawSpeed,10) var.CalibPitch = Smooth(wiimote.MotionPlus.PitchSpeed,10) if abs(var.CalibYaw) + abs(var.CalibPitch) = 0 { var.CalDebug = "[ CALIBRATION TIME OUT! If pointer is unstable, press Minus or restart this script. ]" else var.CalDebug = "[ CALIBRATION ERROR! Using Secondary Calibration. You may need to restart this script. ]" } var.CalibrationTimeOut = "timed out" } if var.CalibrationTimeOut = 1 AND var.CalibYaw = 0 AND var.CalibPitch = 0 AND Smooth(var.ysDelta,10) = 0 AND Smooth(var.psDelta,10) = 0 { var.CalDebug = "[ Calibration Completed. ]" elseif var.CTO > var.CalibrationTimeOut > 1 AND var.CalibYaw = 0 AND var.CalibPitch = 0 var.CalDebug = "[ Possible Error. If pointer is unstable, press Minus or restart this script. ]" elseif var.CTO > var.CalibrationTimeOut > 1 AND (var.CalibYaw != 0 OR var.CalibPitch != 0) var.CalDebug = "[ Possible Error. Using Secondary Calibration. If pointer is unstable, press Minus or restart this script. ]" } } if wiimote.HasMotionPlus = false then debug = "[ WiiMotion Plus NOT DETECTED! ]" if var.CalibrationTimeOut = false then var.CalTimeDebug = ". ]" if var.init = false and wiimote.HasMotionPlus = true { PIE.FrameRate = 5hz // Change var.FrameRate instead, not this. var.CTO = 50 var.CalDebug = "[ Please place the Wiimote down" + var.CalTimeDebug if var.StartupWait = false then wait 3 seconds var.StartupWait = true var.CalibrationTimeOut++ var.CalTimeDebug = " !!! CALIBRATING - ( Will time out in "+ RemoveUnits((var.CTO-var.CalibrationTimeOut) / PIE.FrameRate) +" seconds. ) ]" var.ysDelta=abs(Delta(wiimote.MotionPlus.YawSpeed)) var.psDelta=abs(Delta(wiimote.MotionPlus.PitchSpeed)) if abs(delta(Smooth(var.ysDelta,10))) = 0 then var.CalibYaw = Smooth(wiimote.MotionPlus.YawSpeed,10) if abs(delta(Smooth(var.psDelta,10))) = 0 then var.CalibPitch = Smooth(wiimote.MotionPlus.PitchSpeed,10) if (var.CalibYaw = wiimote.MotionPlus.YawSpeed and var.CalibPitch = wiimote.MotionPlus.PitchSpeed) or var.CalibrationTimeOut >= var.CTO then var.init = true } if var.init != false and var.CalibrateButton = true { var.init = "waiting" var.CalDebug = "[ Please place the Wiimote down. ]" var.CalibYaw = 0 var.CalibPitch = 0 var.CalibrationTimeOut = false wait 3 seconds var.init = false } if wiimote.HasMotionPlus = true and var.MoveButton = true { var.YawSpeed = wiimote.MotionPlus.YawSpeed - var.CalibYaw var.PitchSpeed = wiimote.MotionPlus.PitchSpeed - var.CalibPitch if SameValue( Smooth(wiimote.SmoothRoll, 30), wiimote.SmoothRoll, 30) then var.Roll = Smooth(wiimote.SmoothRoll, 30) else var.Roll = wiimote.SmoothRoll if var.Roll < 0 and var.Roll >= -90 { var.XYswap = 1 - EnsureMapRange(var.Roll, -90, 0, 0, 1) var.RightDown = -1 var.TopUp = 1 elseif var.Roll <= 90 and var.Roll >= 0 { var.XYswap = 1 - EnsureMapRange(var.Roll, 90, 0, 0, 1) var.RightDown = 1 var.TopUp = 1 elseif var.Roll > 90 and var.Roll <= 180 { var.XYswap = 1 - EnsureMapRange(var.Roll, 90, 180, 0, 1) var.RightDown = 1 var.TopUp = -1 else { var.XYswap = 1 - EnsureMapRange(var.Roll, -90, -180, 0, 1) var.RightDown = -1 var.TopUp = -1 } var.TopUpFix = Smooth(var.TopUp,30) / abs(Smooth(var.TopUp,30)) var.RightDownFix = Smooth(var.RightDown,30) / abs(Smooth(var.RightDown,30)) var.SpeedX = var.TopUpFix * var.YawSpeed - ( var.TopUpFix * var.YawSpeed * var.XYswap ) + ( var.RightDownFix * var.PitchSpeed * var.XYswap ) var.SpeedY = var.TopUpFix * var.PitchSpeed - ( var.TopUpFix * var.PitchSpeed * var.XYswap) + ( -var.RightDownFix * var.YawSpeed * var.XYswap ) if var.BorderStop = true { mouse.DirectInputX = RemoveUnits(int(var.MouseX)) mouse.DirectInputY = RemoveUnits(int(var.MouseY)) var.MouseX = var.MouseX + (var.SpeedX / (10500000 - EnsureMapRange(var.Speed, 0, 100, 0, 10000000))) var.MouseY = var.MouseY - (var.SpeedY / (10500000 - EnsureMapRange(var.Speed, 0, 100, 0, 10000000))) else mouse.x = RemoveUnits(var.MouseX) mouse.y = RemoveUnits(var.MouseY) var.MouseX = var.MouseX + (var.SpeedX / (15500 - EnsureMapRange(var.Speed, 0, 100, 0, 15000))) var.MouseY = var.MouseY - (var.SpeedY / (15500 - EnsureMapRange(var.Speed, 0, 100, 0, 15000))) } } if var.MoveButton = false { if var.BorderStop = true { var.MouseX = mouse.DirectInputX var.MouseY = mouse.DirectInputY else var.MouseX = mouse.x var.MouseY = mouse.y } } if wiimote.A = false if wiimote.MotionPlus.YawSpeed > 220 or wiimote.MotionPlus.YawSpeed < -220 or wiimote.MotionPlus.PitchSpeed > 220 or wiimote.MotionPlus.PitchSpeed < -220 var.wiimove = 1 else var.wiimove = 0 endif if var.direction = "left" a = true else if not(-2 < Wiimote.Nunchuk.JoyX < -0.2) a = false endif endif if var.direction = "right" d = true else if not(2 > Wiimote.Nunchuk.JoyX > 0.2) d = false endif endif if var.direction = "front" w = true else if not(-2 < Wiimote.Nunchuk.JoyY < -0.2) w = false endif endif if var.direction = "back" s = true else if not(2 > Wiimote.Nunchuk.JoyY > 0.2) s = false endif endif if wiimote.MotionPlus.YawSpeed > 220 var.direction = "right" elseif wiimote.MotionPlus.YawSpeed < -220 var.direction = "left" elseif wiimote.MotionPlus.PitchSpeed > 220 var.direction = "up" elseif wiimote.MotionPlus.PitchSpeed < -220 var.direction = "down" /* elseif wiimote.Stabbing = true if wiimote.RawForceZ > 0 var.direction = "front" else var.direction = "back" endif */ else var.direction = "none" endif if var.wiimove = true and var.holdmouse = false and var.readyforswing = false and var.recharge = false and var.direction != "none" if var.direction != "down" var.holdmouse = true mouse.leftbutton = true endif elseif var.wiimove = false and var.holdmouse = true and var.readyforswing = false wait 500ms var.readyforswing = true elseif (var.wiimove = true and var.holdmouse = true and var.readyforswing = true) or var.direction = "down" mouse.leftbutton = false var.holdmouse = false var.readyforswing = false var.recharge = true endif if var.recharge = true wait 500ms var.recharge = false endif endif