

 /* This PIE requires that you have either one or two IR points to aim the 
 Wiimote at. A lit teacandle sitting in a small glass works nicely as a 
 single point and reduces fire hazard. The Wii Sensor Bar is best for the 
 two-point setting. At any time you can point the Wiimote away from the sensor 
 and Press 1 to revert back to natural mouse movement. Please set the value 
 of the following variable to your number of infrared points (1 or 2). */ 
 var.irAmount = 2 // 1 OR 2 

 /* When configuring xNunchuk please hold the nunchuk flat in your hand and do 
 not move it. You want to look at the debug output at the top of this 
 window, and modify the value of xNunchuk until the debug value equals zero. 
 The debug value will be very jumpy so just get as close as you can. */ 
 var.xNunchuk = -4.4

 /* Set these numbers so that the cursor reaches the edges 
 of your screen. (Defaults are both 1.1) */ 
 var.xStretch = 1.1 
 var.yStretch = 1.1 

 /* The following variables are all a matter of personal preference.
 /* Remember you can change mouse sensitivity in your options in game. This will
 effect your look speed */
 var.speed = 1/7 // Master Sensitivity (Default 1/7) 
 var.zoom = 1/3 // Speed When Aiming Down Sight (Default 1/3) 
 var.deadzone = 250 // Less Sensitive Area Around Cursor (Default 250px) 


 /* You can change these to your sensitivity. Less lean is faster response. */
 r = Wiimote1.Nunchuk.Roll + var.xNunchuk < -25 // Lean Zapper Left Reload
 e = Wiimote1.Nunchuk.Roll + var.xNunchuk > 20 // Lean Zapper Right Interact


 // Control Stick Movement 
 w = Wiimote1.Nunchuk.JoyY < -0.5
 a = Wiimote1.Nunchuk.JoyX < -0.5
 s = Wiimote1.Nunchuk.JoyY > 0.5
 d = Wiimote1.Nunchuk.JoyX > 0.5




 /* Code for Pointing Mechanism 
 --------------------------- 
 Do Not Modify */ 

 // If Using A Two-Dot Sensor, Find Midpoint 
 If var.irAmount = 2 Then 
 var.xPos = (Wiimote.dot1x + Wiimote.dot2x) / 2 
 var.yPos = (Wiimote.dot1y + Wiimote.dot2y) / 2 
 Else 
 var.xPos = Wiimote.dot1x 
 var.yPos = Wiimote.dot1y 
 EndIf 

 // If At Least One Dot Is Visible, Move Cursor 
 If Wiimote.dot1vis Then 
 // Locate Infrared Focal Point 
 var.xPoint = (1-(round(var.xPos) / 1024)) * Screen.Width 
 var.yPoint = ((round(var.yPos) / 768)) * Screen.Height 
 // Create Virtual Grid System And Draw Point Coordinates 
 var.xGrid = var.xPoint - (Screen.Width / 2) 
 var.yGrid = var.yPoint - (Screen.Height / 2) 
 // Find Cursor on Grid 
 var.xCursor = Mouse.CursorPosX - (Screen.Width / 2) 
 var.yCursor = Mouse.CursorPosY - (Screen.Height / 2) 
 // Calculate Distance To Move 
 var.xDist = (var.xGrid - var.xCursor) 
 var.yDist = (var.yGrid - var.yCursor) 
 // Calculate Speed Multipliers Based On DeadZone Parameters 
 If abs(var.xDist / var.deadzone) > 1 Then var.xMult = 1 Else var.xMult = abs(var.xDist / var.deadzone) 
 If abs(var.yDist / var.deadzone) > 1 Then var.yMult = 1 Else var.yMult = abs(var.yDist / var.deadzone) 
 // Calculate Motion Speed &amp; Add In Scope Multiplier If Needed 
 If Wiimote.A = True Then 
 var.xMotion = var.xDist * var.xMult * var.Speed * var.Zoom 
 var.yMotion = var.yDist * var.yMult * var.Speed * var.Zoom 
 Else 
 var.xMotion = var.xDist * var.xMult * var.Speed 
 var.yMotion = var.yDist * var.yMult * var.Speed 
 EndIf 
 // Calculate New Cursor Position 
 If abs(var.xDist) > 0 Then var.xCursor = (var.xCursor + var.xMotion) * var.xStretch 
 If abs(var.yDist) > 0 Then var.yCursor = (var.yCursor + var.yMotion) * var.yStretch 
 // Move Cursor 
 Mouse.CursorPosX = var.xCursor + (Screen.Width / 2) 
 Mouse.CursorPosY = var.yCursor + (Screen.Height / 2) 
 // Backup Last Motions 
 var.xLast = var.xMotion 
 var.yLast = var.yMotion 
 // Reload (If Minus Fails) 
  
 EndIf 

 // Debug 
 debug = 'Debug: xNunchuk: ' + (Wiimote.Nunchuk.Roll + var.xNunchuk) + ' SpeedY: ' + var.speedY + ' SpeedX: ' + var.speedX


mouse.leftButton = wiimote.B
mouse.rightButton = wiimote.A
Key.E = Wiimote1.Minus
Mouse.WheelDown = Wiimote1.Plus
Esc = Wiimote1.Home
WASD = Nunchuk1.Joy
Space = Nunchuk1.Z
LCtrl = nunchuk1.C
Key.3 = Wiimote1.Up // Squad, Move Out 
Key.4 = Wiimote1.Down // Squad, Hold Position
Key.1 = Wiimote1.Left // Squad, At Ease 
Key.2 = Wiimote1.Right // Squad, Follow Me
Key.R = Wiimote1.Home
Key.C = Wiimote1.Two
Key.F = Wiimote1.One