// Set keys to wiimote/nunchuk buttons var.up = 0 var.down = 0 var.left = 0 var.right = 0 var.a = 0 var.b = 0 var.c = 0 var.one = 0 var.two = 0 var.home = 0 var.minus = 0 var.plus = 0 if Wiimote.Up or Wiimote.Classic.Up then var.up = 1 endif if Wiimote.Down or Wiimote.Classic.Down then var.down = 1 endif if Wiimote.Left or Wiimote.Classic.Left then var.left = 1 endif if Wiimote.Right or Wiimote.Classic.Right then var.right = 1 endif if Wiimote.A or Wiimote.Classic.a then var.a = 1 endif if Wiimote.B or Wiimote.Classic.b then var.b = 1 endif if Wiimote.Nunchuk.CButton then var.c = 1 endif if Wiimote.One then var.one = 1 endif if Wiimote.Two then var.two = 1 endif if Wiimote.Home or Wiimote.Classic.Home then var.home = 1 endif if Wiimote.Minus or Wiimote.Classic.Minus then var.minus = 1 endif if Wiimote.Plus or Wiimote.Classic.Plus then var.plus = 1 endif X = Wiimote.Classic.x Y = Wiimote.Classic.y Z = Wiimote.Nunchuk.ZButton or Wiimote.Classic.ZL or Wiimote.Classic.ZR L = Wiimote.Classic.L R = Wiimote.Classic.R // Set PPJoy Virtual Joystick to nunchuk joystick PPJoy.Analog0 = Wiimote.Nunchuk.JoyX PPJoy.Analog1 = Wiimote.Nunchuk.JoyY // Rumble when shift is pressed //Wiimote.Rumble = Shift // Set the middle two LEDs to ON Wiimote.Led1 = false Wiimote.Led2 = true Wiimote.Led3 = true Wiimote.Led4 = false // Show the IR dots as fake cursors Cursor1.Visible = Wiimote.dot1vis Cursor1.x = Wiimote.dot1x / 1023 Cursor1.y = Wiimote.dot1y / 1023 Cursor2.Visible = Wiimote.dot2vis Cursor2.x = Wiimote.dot2x / 1023 Cursor2.y = Wiimote.dot2y / 1023 Cursor3.Visible = Wiimote.dot3vis Cursor3.x = Wiimote.dot3x / 1023 Cursor3.y = Wiimote.dot3y / 1023 Cursor4.Visible = Wiimote.dot4vis Cursor4.x = Wiimote.dot4x / 1023 Cursor4.y = Wiimote.dot4y / 1023 // Check expansion if Wiimote.HasNunchuk then var.expansion = Wiimote.Nunchuk.JoyX+','+Wiimote.Nunchuk.JoyY+' NC.Force='+Wiimote.Nunchuk.gx+','+Wiimote.Nunchuk.gy+','+Wiimote.Nunchuk.gz else if Wiimote.HasClassic then var.expansion = 'CL: '+Wiimote.Classic.RawJoy1X+','+Wiimote.Classic.RawJoy1Y else var.expansion = "" end if // Show expansion and wiimote forces debug = 'Bat='+Wiimote.Battery+', Pitch='+RemoveUnits(Wiimote.SmoothPitch)+', Roll='+RemoveUnits(Wiimote.SmoothRoll)+', '+Wiimote.RelAccX+', '+Wiimote.RelAccY+', '+Wiimote.RelAccZ+' '+var.up+' '+var.down+' '+var.left+' '+var.right+' '+var.one+' '+var.two+' '+var.home+' '+var.plus+' '+var.minus+' '+var.a+' '+var.b+' '+var.c //debug = 'Bat='+Wiimote.Battery+', Pitch='+RemoveUnits(Wiimote.Pitch)+', Roll='+RemoveUnits(Wiimote.Roll)+', '+Wiimote.RelAccX+', '+Wiimote.RelAccY+', '+Wiimote.RelAccZ SendOsc("localhost", 4950, "/", RemoveUnits(Wiimote.SmoothPitch), RemoveUnits(Wiimote.SmoothRoll), Wiimote.RelAccX, Wiimote.RelAccY, Wiimote.RelAccZ, var.up, var.down, var.left, var.right, var.one, var.two, var.home, var.plus, var.minus, var.a, var.b, var.c, Wiimote.Battery) if Wiimote.Exists then Wiimote.Led1 = true //debug = Wiimote.Led1 endif //wait 1000 ms