 |
WiiLi.org a new revolution
|
| View previous topic :: View next topic |
| Author |
Message |
Junp3i
Joined: 09 May 2008 Posts: 1
Digg It |
Posted: Fri May 09, 2008 5:34 am Post subject: A script ive been working on, need help. |
|
|
Hey guys, first post here, nice to meet y'all!
straight to the meat of my post~
I was running Wiinremote doing some tests and discovered that in steam games (noteable Team Fortress 2) the way it handles mouse input when you tell it you are using a joystick.
The further you move the mouse from the middle of the screen, the faster you turn, much like a wii game.
Unfortunately wiinremote has no functioning mappable nunchuck support for the analog stick.
Then i tried running Wiinremote and using glovepie to script the nunchuck, but i find once more than a single program are trying to use the wiimote i get IR lag for the mouse cursor. This happened when trying to use Pinnacle game profiles (which has no IR support) with Wiinremote.
SO, im trying to get it all done in glove pie, and im here for help.
requirements for the perfect TF2 glovepie script.
Standard IR input as you would control a mouse.
Left mouse button = wiimote B
Right Mouse button = nunchuck Z
keyboard c = nunchuck c
keyboard space = wiimote A
keyboard W A S D = Analog stick Up , left, down, right
keyboard R = wiimote dpad down
keyboard B = wiimote dpad left
keyboard comma = wiimote dpad right
keyboard period = wiimote dpad up
scrollwheel down = wiimote minus
scrollwheel up = wiimote plus
and thats all.. thats EVERYTHING for Team Fortress 2 in steam. It covers team and class switching thanks to the "," and "."
reloading is accounted for with R, Auto Spy Disguise with B, weapon scrolling with + and -. jumping and crouching with A and C.
left and right clicking with A and Z (right clicking is sparsely used in TF2, and its far more usefull to have it on a seperate hand)
Now it may look like ive come here asking for all the work to be done, but ive spent the better of last 7 hours (its 6am now) trying to do this in glovepie by combining other scripts and even writing some of my own and im shit outta luck.
Help me wiili dot org, your my only hope
Thanks for your time reading this EPIC POST.
and thanks for any help you may offer or wisdom you may impart unpon me. |
|
| Back to top |
|
 |
TheDro
Joined: 10 Feb 2008 Posts: 39 Location: Canada
Digg It |
Posted: Mon Jun 30, 2008 4:44 pm Post subject: |
|
|
| From what I understand, your problem is lag right? If so, I'm having the same problem which makes steam games practically unplayable. I'm mainly replying to bump this post and hopefully some1 knows how to speed things up. Would it be possible to set GlovePIE's priority to something higher to correct a lag problem? |
|
| Back to top |
|
 |
Wreyth

Joined: 03 Nov 2007 Posts: 75
Digg It |
Posted: Mon Jun 30, 2008 8:55 pm Post subject: |
|
|
ok for starters guys i have had no luck in the steam games either.. it's not due to the mouse lag but it is because steam uses the mouse pointer input differently than standard games. basicly it is fairly hard to emulate the mouse in steam games. the only approach i haven't attempted yet is a ppjoy approach but i have a feeling that even that is going to be a dead end i'm sorry to say.
basicly when you move in any direction with the wiimote it is in reality sending an emulated cursor move the more you move in any direction other than dead center the more it tells it to move the cursor that way... so it's not ACTUALY moving the true mouse cursor and stopping it's the equivelent to if you move a joystick any direction other than dead center it continues to read it as moving in that direction till you center it again ..... basicly it's the same concept as holding a joystick if that helps to clear things up for you any i can try to come up with something when i get some spare time but i work for a tow truck company and have newborn twins so my time gets very very limited. i can't remember if i tried using a mouse.DirectInput command yet but i think i did try it with my ir gloves script that uses mouse direct input for smoothing out the mouse cursor and it just spun on me as well. but if i run accross anything i will let you know. |
|
| Back to top |
|
 |
TheDro
Joined: 10 Feb 2008 Posts: 39 Location: Canada
Digg It |
Posted: Tue Jul 08, 2008 5:02 pm Post subject: |
|
|
| Well the way it interprets the wiimote acting as a mouse isn't actually a problem. It lets you control your character almost in the same way as in a first person shooter like metroid prime3. The only problem I'm having is lag which makes moving around and aiming spaztastic. |
|
| Back to top |
|
 |
Maxadam5

Joined: 23 May 2008 Posts: 38
Digg It |
Posted: Thu Aug 14, 2008 2:29 am Post subject: |
|
|
Yeah I think this will do, don't worry it only took me like 10 minutes to do.
| Code: | pie.FrameRate = 60 hertz
var.InputX = Wiimote1.Dot1X // X component
var.InputXRangeStart = 0 Pixels // Smallest X value possible
var.InputXRangeEnd= 1023 Pixels //Biggest X value possible
var.InputXRangeSiz= (var.InputXRangeEnd- var.InputXRangeStart ) //calculates the size of the avaiable range
var.InputY = Wiimote1.Dot1Y // Y component
var.InputYRangeStart = 0 Pixels // Smallest Y value possible
var.InputYRangeEnd = 767 Pixels //Biggest Y value possible
var.InputYRangeSiz= (var.InputYRangeEnd- var.InputYRangeStart ) //calculates the size of the avaiable range
var.InputEnabled= Wiimote1.Dot1Vis //checks to see if the data is avaiable
// how much of the Y axis us destuned to "Absolute" motion,
// more than this in either direction will go into "Relative" mode
var.RangeX=(var.InputXRangeSiz / 4)
// how much of the Y axis us destuned to "Absolute" motion,
// more than this in either direction will go into "Relative" mode
var.RangeY= (var.InputYRangeSiz / 4)
var.eyesizeX= 300 Mickeys //the size of the "Absolute" X movement in DirectInput units
var.eyesizeY= 225 Mickeys //the size of the "Absolute" y movement in DirectInput units
var.edgespeedX= 30mickeys //Speed of the X axis when in "relative" mode
var.edgespeedY= 20Mickeys //Speed of the Y axis when in "relative" mode
if (var.InputEnabled)then //if the data is avaiable process it
// X offset in relation to the relative position
var.Xloc= -MapRange(var.InputX, var.InputXRangeStart , var.InputXRangeEnd, -var.eyesizeX,var.eyesizeX)mickeys
// Y offset in relation to the relative position
var.Yloc= MapRange(var.InputY, var.InputYRangeStart , var.InputYRangeEnd, -var.eyesizeY,var.eyesizeY)mickeys
//not used anymore, returns the distance from the relative position, I choose to use the distance per axis instead
var.dist =sqrt(sqr((var.InputXRangeSiz/2) - var.InputX)+ sqr((var.InputYRangeSiz/2)- var.InputY))
var.text= ""
//if X is bigger than the Absolute range then process it as relative
if ( sqrt(sqr((var.InputXRangeSiz /2) - var.InputX)) > var.RangeX) then
// change the relative position based on the direction the cursor is
var.MiddleX = var.MiddleX+ (Maprange(var.Xloc, -Var.EyeSizex,var.eyesizex, -var.edgespeedX,var.EdgeSpeedX))
var.text =var.text+"edging X " //adds to the debug thing what it is doing
endif
//if Y is bigger than the Absolute range then process it as relative
if ( sqrt(sqr((var.InputYRangeSiz /2) - var.InputY)) > var.RangeY) then
// change the relative position based on the direction the cursor is
var.MiddleY = var.MiddleY+ (Maprange(var.Yloc, -Var.EyeSizeY,var.eyesizeY, -var.edgespeedY,var.EdgeSpeedY))
var.text= var.text+ "edging Y " //adds to the debug thing what it is doing
endif
//if inside the absolute rnage then do whatever it is required
if ((sqrt(sqr(((var.InputYRangeSiz)/2) - var.InputY)) <= var.RangeY)) OR ( sqrt(sqr((var.InputXRangeSiz/2) - var.InputX)) <= var.RangeX)then
var.Text=var.Text+"local "// not much to be done, only ads to the debug thing what it is doing
endif
debug = var.text+ Mouse.DirectInputPos
//Position the DirectInput cursor based on what it has processed
Mouse.DirectInputPos = [var.MiddleX + var.Xloc, var.MiddleY + var.Yloc]
endif
var.A = Wiimote1.A
var.B = Wiimote1.B
var.home = Wiimote1.Home
var.plus = Wiimote1.Plus
var.minus = Wiimote1.Minus
var.Cbutton = wiimote.Nunchuk.CButton
var.Zbutton = wiimote.Nunchuk.ZButton
var.one = wiimote.One
var.two = wiimote.Two
var.up = wiimote.Up
var.down = wiimote.Down
var.left = wiimote.Left
var.right = wiimote.right
var.nunchukswing = (wiimote.Nunchuk.RawAccX > 25 or < -25) or (wiimote.Nunchuk.RawAccY > 25 or < -25) or (wiimote.Nunchuk.RawAcc > 25 or < -25)
var.nunchukx = (wiimote.Nunchuk.RawAccX > 25 or < -25)
var.nunchuky = (wiimote.Nunchuk.RawAccY > 25 or < -25)
var.nunchukz = (wiimote.Nunchuk.RawAccZ > 25 or < -25)
var.wiimoteswing = (wiimote.RawAccX > 25 or < -25) or (wiimote.RawAccY > 25 or < -25) or (wiimote.RawAcc > 25 or < -25)
var.wiimoteX = (wiimote.RawAccX > 25 or < -25)
var.wiimoteY = (wiimote.RawAccY > 25 or < -25)
var.wiimoteZ = (wiimote.RawAccZ > 25 or < -25)
var.nunchukjoyy = wiimote.Nunchuk.JoyY
var.nunchukjoyx = wiimote.Nunchuk.JoyX
if var.nunchukjoyy > .2
Keyboard.S = 1
else if var.nunchukjoyy < -.2
Keyboard.W = 1
else
Keyboard.S = 0
Keyboard.W = 0
endif
if var.nunchukjoyx > .2
Keyboard.D = 1
else if var.nunchukjoyx < -.2
Keyboard.A = 1
else
Keyboard.D = 0
Keyboard.A = 0
endif
mouse.LeftButton = var.b
mouse.RightButton = var.zbutton
key.C = var.cbutton
key.Space = var.a
key.R = var.down
key.B = var.left
key.Comma = var.right
key.Period = var.up
mouse.WheelDown = var.minus
mouse.WheelUp = var.plus
|
|
|
| Back to top |
|
 |
Jehd
Joined: 26 Aug 2008 Posts: 3
Digg It |
Posted: Tue Aug 26, 2008 9:56 pm Post subject: |
|
|
Maxadam5, could you give me just the code to replace the WASD keys by the nunchuk's joystick Please ?
I have already created all the other codes for the mouse, and all the rest of the game but I can't find this code !  |
|
| Back to top |
|
 |
Maxadam5

Joined: 23 May 2008 Posts: 38
Digg It |
Posted: Tue Aug 26, 2008 11:49 pm Post subject: |
|
|
| Jehd wrote: | Maxadam5, could you give me just the code to replace the WASD keys by the nunchuk's joystick Please ?
I have already created all the other codes for the mouse, and all the rest of the game but I can't find this code !  |
this code includes it and has ir like wiinremote and all the button mappings just use that but if you haaaaaaaaaaave to have the nunchuk part here
| Code: | var.A = Wiimote1.A
var.B = Wiimote1.B
var.home = Wiimote1.Home
var.plus = Wiimote1.Plus
var.minus = Wiimote1.Minus
var.Cbutton = wiimote.Nunchuk.CButton
var.Zbutton = wiimote.Nunchuk.ZButton
var.one = wiimote.One
var.two = wiimote.Two
var.up = wiimote.Up
var.down = wiimote.Down
var.left = wiimote.Left
var.right = wiimote.right
var.nunchukswing = (wiimote.Nunchuk.RawAccX > 25 or < -25) or (wiimote.Nunchuk.RawAccY > 25 or < -25) or (wiimote.Nunchuk.RawAcc > 25 or < -25)
var.nunchukx = (wiimote.Nunchuk.RawAccX > 25 or < -25)
var.nunchuky = (wiimote.Nunchuk.RawAccY > 25 or < -25)
var.nunchukz = (wiimote.Nunchuk.RawAccZ > 25 or < -25)
var.wiimoteswing = (wiimote.RawAccX > 25 or < -25) or (wiimote.RawAccY > 25 or < -25) or (wiimote.RawAcc > 25 or < -25)
var.wiimoteX = (wiimote.RawAccX > 25 or < -25)
var.wiimoteY = (wiimote.RawAccY > 25 or < -25)
var.wiimoteZ = (wiimote.RawAccZ > 25 or < -25)
var.nunchukjoyy = wiimote.Nunchuk.JoyY
var.nunchukjoyx = wiimote.Nunchuk.JoyX
if var.nunchukjoyy > .2
Keyboard.S = 1
else if var.nunchukjoyy < -.2
Keyboard.W = 1
else
Keyboard.S = 0
Keyboard.W = 0
endif
if var.nunchukjoyx > .2
Keyboard.D = 1
else if var.nunchukjoyx < -.2
Keyboard.A = 1
else
Keyboard.D = 0
K
|
_________________ [img]C:\Users\Adam\Desktop\my sig.swf[/img] |
|
| Back to top |
|
 |
|
|
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
|