GlovePIE FPS Script without SensorBar

hellu 🙂 this is a script for control fps games without sensorbar (a bit difficult but.. just try it). Rember to read the comments for calibrate your wiimote with the script. enjoy it them.

————————————————–

// FPSGame by Kasten, improved by Lotti
// Thanks to TaggeD for the automatic configuration of the wiimote’s offsets

// Motion Mouse
// Manual Configuration
// When configuring the offsets please put the wiimote flat and do not move it.
// These are offsets change them so that your debug output reads 0,28,0
// The debug output is at the top of this window.
// Ex if you get -7,33,-6 then change the offsets to 7,-5,6

var.xNunchukOffset = 5
var.yNunchukOffset = -3
var.zOffset = 4

var.xRot = Wiimote.RawForceX + var.xNunchukOffset
var.yRot = Wiimote.RawForceY + var.yNunchukOffset
var.zRot = Wiimote.RawForceZ + var.zOffset

debug = ‘X:’ + var.xRot + ‘, ‘ + ‘Y:’ + var.yRot + ‘, ‘ + ‘Z:’ + var.zRot

// Automatic Configuration
// Simple press – and + buttons on wiimote before start playing

if Wiimote.Minus && Wiimote.Plus then
var.xNunchukOffset = -Wiimote.RawForceX
var.zOffset = -Wiimote.RawForceZ
var.yNunchukOffset = -Wiimote.RawForceY + 28
endif

// Change this if you would like your mouse to go faster
var.xMinSpeed = 1
var.xMaxSpeed = 5
var.xSpeedDivision = 27 //default 27
var.zMinSpeed = 1
var.zMaxSpeed = 5
var.zSpeedDivision = 27 //default 27

// change these to a higher number if your hands are not steady or lower if they are
var.xCutoff = 4
var.zCutoff = 4

// X/Y offsets for Analog. If it’s too sensitive then make the numbers larger.
var.xNunchukOff = .07
var.yNunchukOff = .07

//Switch off the leds
Wiimote.leds = 0

//
// Game buttons.
//

mouse.LeftButton = Wiimote.B
mouse.RightButton = Wiimote.A
mouse.WheelUp = Wiimote.Plus
mouse.WheelDown = Wiimote.Minus
mouse.WheelUp = Wiimote.Right
mouse.WheelDown = Wiimote.Left
key.Escape = Wiimote.Two

key.e = Wiimote.Down
key.Space = Wiimote.Up
key.q = Wiimote.Nunchuk.CButton
key.Shift = Wiimote.Nunchuk.ZButton

//
// Analog Movements
//

if Wiimote.Nunchuk.JoyX < -var.xNunchukOff then key.a = true else key.a = false endif if Wiimote.Nunchuk.JoyX > var.xNunchukOff then
key.d = true
else key.d = false
endif
if Wiimote.Nunchuk.JoyY < -var.yNunchukOff then key.w = true else key.w = false endif if Wiimote.Nunchuk.JoyY > var.yNunchukOff then
key.s = true
else key.s = false
endif

//
// Reload
//

if Wiimote.Nunchuk.RawForceY > 60 then
key.r = true
Wiimote.Rumble = true
Wiimote.Leds = 15
else
key.r = false
Wiimote.Rumble = false
Wiimote.Leds = 0
endif

// This is the code that moves your mouse
var.xSpeedInc=(var.xMaxSpeed-var.xMinSpeed)/var.xSpeedDivision
var.zSpeedInc=(var.zMaxSpeed-var.zMinSpeed)/var.zSpeedDivision

var.xSpeed=var.xMinSpeed+abs(var.xRot)*var.xSpeedInc
var.zSpeed=var.zMinSpeed+abs(var.zRot)*var.zSpeedInc

if var.xRot > var.xCutoff then mouse.x = mouse.x – .001 * var.xSpeed * (var.xRot – var.xCutoff)
if var.xRot < -var.xCutoff then mouse.x = mouse.x - .001 * var.xSpeed * (var.xRot + var.xCutoff) if var.zRot > var.zCutoff then mouse.y = mouse.y – .001 * var.zSpeed * (var.zRot – var.zCutoff)
if var.zRot < -var.zCutoff then mouse.y = mouse.y - .001 * var.zSpeed * (var.zRot + var.zCutoff) //debug = ‘X:’ + var.xRot + ‘, ‘ + ‘Z:’ + var.zRot

1 thought on “GlovePIE FPS Script without SensorBar

  1. michael baldwin

    I have a motion plus mouse script that doesn’t use the ir bar:

    if key.end = true then
    ExitProgram
    end if

    if pie.Frame = 0 then
    var.x = 0.5
    var.y = 0.5
    var.run = false
    var.int = false
    end if

    if var.calibration = 0.25 then
    var.sensitivityGyro = [.47, .45] //Change To Higher or Lower Values to Increase or Decrease Sensitivity
    var.deadzoneGyro = [0, 0]
    var.Gyro = [0, 0]
    if (Abs(WiiMote.MotionPlus.YawSpeed + var.calibrationGyro[1]) > var.deadzoneGyro[1]) then var.Gyro[1] = RemoveUnits(WiiMote.MotionPlus.YawSpeed + var.calibrationGyro[1]) – (Sign(WiiMote.MotionPlus.YawSpeed) * var.deadzoneGyro[1])
    if (Abs(WiiMote.MotionPlus.PitchSpeed + var.calibrationGyro[2]) > var.deadzoneGyro[2]) then var.Gyro[2] = RemoveUnits(WiiMote.MotionPlus.PitchSpeed + var.calibrationGyro[2]) – (Sign(WiiMote.MotionPlus.PitchSpeed) * var.deadzoneGyro[2])
    var.x = ((var.Gyro[1] * var.sensitivityGyro[1]) / 1000 )
    mouse.x = mouse.x + var.x
    var.y = ((-1 * var.Gyro[2] * var.sensitivityGyro[2]) /1000 )
    mouse.y = mouse.y + var.y
    end if
    end if

    end if
    //——————————–startup—-calibration——————–
    // Set your Wiimote LEDs to your liking. Binary value, 1-15
    var.leds = 1

    // Determinate Offset
    if var.calibrate 0 then
    var.xRot = Wiimote1.RawForceX – var.xOffset
    else
    var.xRot = Wiimote1.RawForceX + var.xOffset
    endif

    if var.YOS > 0 then
    var.yRot = Wiimote1.RawForceY – var.yOffset
    else
    var.yRot = Wiimote1.RawForceY + var.yOffset
    endif

    if var.ZOS > 0 then
    var.zRot = Wiimote1.RawForceZ – var.zOffset
    else
    var.zRot = Wiimote1.RawForceZ + var.zOffset
    endif
    //———————-end of calibration——————————–

    key.W = wiimote.Nunchuk.Up
    key.A = wiimote.Nunchuk.Left
    key.S = wiimote.Nunchuk.Down
    key.D = wiimote.Nunchuk.Right

    if wiimote2.Nunchuk.Shakiness >= 20 then
    key.space = true
    wait 5ms
    key.space = false
    end if

    if wiimote.Home = true then
    var.x = 0.5
    var.y = 0.5
    end if

    mouse.LeftButton = wiimote.Nunchuk.CButton
    mouse.RightButton = wiimote.B
    mouse.WheelUp = wiimote.Up
    mouse.WheelDown = wiimote.Down
    key.space = wiimote.Nunchuk.SwingUp

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.