WiiLi Wiki frontpage Include your post in the News Get links Hoteles Quito
WiiLi.org Forum Index WiiLi.org
a new revolution
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Wii mouse control in fps

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    WiiLi.org Forum Index -> Wii Remote and Nunchuck
View previous topic :: View next topic  
Author Message
crono141



Joined: 27 Dec 2006
Posts: 33

Digg It
PostPosted: Thu Dec 28, 2006 12:07 am    Post subject: Wii mouse control in fps

This is expanding upon my trouble I mentioned in the other thread.

I've tried various .pie scripts in halo, star wars bf, and tron 2.0 (the only fps's currently installed) using both rel & abs IR for pointing.

The mouse works in the desktop for both configs, but once inside of halo + swbf, mouse cursor won't move in menus, and in game won't move in any of them. I'm using code from bundled wiimouse IR relative script, and hl2 abs code from Marco Ceppi.

Sorry for bad grammer. Keyboard is on the fritz & typing w/ on screen keyoard.

Code:

// Type your program here, or click the GUI tab to autogenerate it!
 /**************************************************
 *                       HL2.pie
 *                     ----------
 *     BY:  Marco Ceppi <marco at ilmbsr dot com>
 *    FOR:  GlovePIE 0.28+
 *   DATE:  Thursday Dec. 21, 2006
 * RIGHTS:  Released under GNU License. Feel free
 *          to edit and use to your liking. For all
 *          to enjoy. Marco Ceppi.
 *
 **************************************************/

// Make sure the debug window reads 0,28,0
var.dummy = wiimote.rawforcex

// Get Nunchuk axis locations. Range is -0.99 to 0.99
// Multiply by 100 to get whole numbers. (-99 to 99)
var.xNunchuk = Wiimote.Nunchuk.JoyX * 100
var.yNunchuk = Wiimote.Nunchuk.JoyY * 100
// X/Y offsets. If it's too sensative then make the numbers larger.
var.xOff = 5
var.yOff = 5
// Acceleration ammount for Nunchuk Reload (default = 17.0)
var.nunchukAccX = 19.0
// Blink rate for battery check.
var.Blink = 500ms
// Mouse IR Offsets
var.xtrim = 2
var.ytrim = -28
var.ztrim = 4
var.deadzone = 5

//var.sensor = true

//Simple debugs.
//debug = 'N:' + Wiimote.Nunchuk.JoyX + 'N:' + Wiimote.Nunchuk.JoyY + 'X:' + var.xRot + ', ' + 'Y:' + var.yRot + ', ' + 'Z:' + var.zRot

if var.xNunchuk > var.xOff and var.yNunchuk > var.yOff then
   key.w = false
   key.a = false
   key.s = true
   key.d = true
   debug = 'SE'
else if var.xNunchuk > var.xOff and var.yNunchuk < -var.yOff then
   key.w = true
   key.a = false
   key.s = false
   key.d = true
   debug = 'NE'
else if var.xNunchuk < -var.xOff and var.yNunchuk < -var.yOff then
   key.w = true
   key.a = true
   key.s = false
   key.d = false
   debug = 'NW'
else if var.xNunchuk < -var.xOff and var.yNunchuk > var.yOff then
   key.w = false
   key.a = true
   key.s = true
   key.d = false
   debug = 'SW'
else if var.xNunchuk > var.xOff then
   key.w = false
   key.a = false
   key.s = false
   key.d = true
   debug = 'Right'
else if var.xNunchuk < -var.xOff then
   key.w = false
   key.a = true
   key.s = false
   key.d = false
   debug = 'Left'
else if var.yNunchuk < -var.yOff then
   key.w = true
   key.a = false
   key.s = false
   key.d = false
   debug = 'Up'
else if var.yNunchuk > var.yOff then
   key.w = false
   key.a = false
   key.s = true
   key.d = false
   debug = 'Down'
else if var.xNunchuk > -var.xOff and < var.xOff and var.yNunchuk < var.yOff and > -var.yOff then
   key.w = false
   key.a = false
   key.s = false
   key.d = false
   debug = 'Khai sucks'
else
   key.w = false
   key.a = false
   key.s = false
   key.d = false
   debug = 'Khai sucks'
endif

//
// Game buttons.
//
// Wiimote
key.Shift = Wiimote.Up
mouse.WheelUp = Wiimote.Left
mouse.WheelDown = Wiimote.Right
key.e = Wiimote.Down

mouse.LeftButton = Wiimote.B
Wiimote.Rumble = Wiimote.B
mouse.RightButton = Wiimote.A

key.q = Wiimote.Minus
key.escape = Wiimote.Home
key.f = Wiimote.Plus

key.One = Wiimote.One
// Wiimote.Two handles Battery.


//
// Nunchuk
//
key.space = Wiimote.Nunchuk.ZButton
key.Ctrl = Wiimote.Nunchuk.CButton

//
// Reload
//
if Wiimote.Nunchuk.RawAccX > var.nunchukAccX or < -var.nunchukAccX then
key.r = true
key.r = false
debug = 'VROOM!'
endif

Wiimote.leds = 0

//
// Battery Check!
//
// A full battery gives 0xC0 (192)
if Wiimote.Two == true then
   var.Batt = wiimote.Battery / 48

   if true then
      wait 5 seconds
      // it sends an instruction that tells the Wiimote to actually
      // send the report.
      Wiimote.Report15 = 0x80 | Int(wiimote.Rumble)
   endif

   // Display the battery level of your wiimote using the four LEDs on the bottom.
   // Battery level is displayed in four levels increasing to the right, like a cell
   // phone battery gauge. As the battery gets close to the next level down, the LED
   // for the current level will blink.

   debug = "Battery level: " + 100*48*var.Batt/192 + "%"
   if 0 <= var.Batt <= 0.25 then
      Wiimote.Leds = 1
      wait var.Blink
      Wiimote.Leds = 0
      wait var.Blink
   elseif 0.25 < var.Batt<=1 then
      Wiimote.Leds = 1
   elseif 1 < var.Batt<=1.25 then
      Wiimote.Leds = 3
      wait var.Blink
      Wiimote.Leds = 1
      wait var.Blink
   elseif 1.25 < var.Batt<=2 then
      Wiimote.Leds = 3
   elseif 2 < var.Batt<=2.25 then
      Wiimote.Leds = 7
      wait var.Blink
      Wiimote.Leds = 3
      wait var.Blink
   elseif 2.25 < var.Batt<=3 then
      Wiimote.Leds = 7
   elseif 3 < var.Batt<=3.25 then
      Wiimote.Leds = 15
      wait var.Blink
      Wiimote.Leds = 7
      wait var.Blink
   elseif 3.25 < var.Batt<=4 then
      Wiimote.Leds = 15
   else
      Wiimote.Leds = 0
   endif
endif

//
// Mouse IR
//
if wiimote.dot1vis then
var.actualX=((1-(round(Wiimote.dot1x)/1024))*Screen.Width)
var.speedX = ((var.actualX/((Screen.Width /2))) - 1) * 25
if abs(var.speedX) > 1 then Mouse.CursorPosX = Mouse.CursorPosX+var.speedX
var.actualY=(((round(Wiimote.dot1y)/1024))*Screen.Height)
var.speedY = ((var.actualY/((Screen.Height /2))) - 1) * 25
if abs(var.speedY) > 1 then Mouse.CursorPosY = Mouse.CursorPosY+var.speedY
endif

Back to top
View user's profile Send private message
mrsoyo



Joined: 27 Dec 2006
Posts: 2
Location: Sverige

Digg It
PostPosted: Thu Dec 28, 2006 10:05 pm    Post subject:

I have that same problem but with SHOGO and NOLF.
It reacts in the menus but not in the game.

Other than that its a great script! thanks marco
_________________
myspace.com/mrsoyo
Back to top
View user's profile Send private message
Marco Ceppi



Joined: 21 Dec 2006
Posts: 51

Digg It
PostPosted: Thu Dec 28, 2006 10:20 pm    Post subject:

There is a newer version of this script out. It has a totally new IR pointing script from Arianol.

I went ahead and made a topic for it here:
http://www.wiili.org/forum/hl2---nunchuk--ir-t786.html#4859
Back to top
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    WiiLi.org Forum Index -> Wii Remote and Nunchuck All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group