 |
WiiLi.org a new revolution
|
| View previous topic :: View next topic |
| Author |
Message |
Brantis
Joined: 15 Dec 2007 Posts: 14
Digg It |
Posted: Sat Dec 15, 2007 3:39 am Post subject: Metal Slug (NeoRageX) |
|
|
Sooo, I thought that this would be a good addition to the script area.
All is explained in the script.
| Code: |
//Metal Slug
//NeoRageX
//This setup is pretty much the Controlls of the Wii Game, But they are a little sketchy due to
//some things that are not implemented in the Original NeoGeo Game.
//This is just the setup that I like for the game, and to me they work pretty well, so if you
//like it then by all means use it.
//Mapping For NeoRageX
//Set Player One Controls to Keyboard.
//Direction Buttons should be set in NeoRageX to your arrow buttons.
//A Button = A
//B Button = B
//C Button = C
//Controls If You Have Nunchuk
//Nunchuk Stick = Controlls the Gun Aim.(Only When Shooting)
//Throw Grenade = Simply Jerk the Nunchuk Up.
//Fire = Nunchuk Z Button
//Jump = Nunchuk C Button
//Wiimote Analog = Character Movement
//Player 1 Start = One
//Insert Coin = Two
//Save State = Wiimote -
//Load State = Wiimote +
//Controls if you have Classic Controller
//Movement/Aim = Analog or Left Thumbstick
//Throw Grenade = C
//Fire = A
//Jump = B
//Wiimote Direction Pad = Character Movement
//Player 1 Start = Classic +
//Insert Coin = Classic -
//Save State = Classic L Bumper
//Load State = Classic R Bumper
//ESC = Classic Home
if Wiimote.HasNunChuck
key.Left = (-1.2 < wiimote.Nunchuk.JoyX < -0.5)
key.Right = (0.5 < wiimote.Nunchuk.JoyX < 1.2)
key.Up = (-1.2 < wiimote.Nunchuk.JoyY < -0.5)
key.Down = (0.5 < wiimote.Nunchuk.JoyY < 1.2)
key.Left = Wiimote.Left
key.Right = Wiimote.Right
key.Down = Wiimote.Down
Key.C = MapRange(Wiimote.Nunchuk.RawForceY, -100,100, 0,1)
Key.A = Wiimote.Nunchuk.ZButton
Key.B = Wiimote.Nunchuk.CButton
Key.Three = Wiimote.Two
Key.One = Wiimote.One
Key.F11 = Wiimote.Minus
Key.F12 = Wiimote.Plus
endif
if Wiimote.HasClassic
Key.Up = Wiimote.Classic.Up
Key.Down = Wiimote.Classic.Down
Key.Left = Wiimote.Classic.Left
Key.Right = Wiimote.Classic.Right
key.Left = (-1.2 < wiimote.Classic.Joy1X < -0.5)
key.Right = (0.5 < wiimote.Classic.Joy1X < 1.2)
key.Up = (-1.2 < wiimote.Classic.Joy1Y < -0.5)
key.Down = (0.5 < wiimote.Classic.Joy1Y < 1.2)
Key.A = Wiimote.Classic.b
Key.B = Wiimote.Classic.y
Key.C = Wiimote.Classic.a
Key.Three = Wiimote.Classic.Minus
Key.One = Wiimote.Classic.Plus
Key.Esc = Wiimote.Classic.Home
Key.F11 = Wiimote.Classic.L
Key.F12 = Wiimote.Classic.R
endif
|
|
|
| Back to top |
|
 |
bakou
Joined: 18 Dec 2007 Posts: 2
Digg It |
Posted: Tue Dec 18, 2007 2:19 am Post subject: |
|
|
Alright, I recently got my wiimote up and working with my PC (Windows only.. no linux yet)
the main reason I wanted it was to play point blank in mame with friends.. much to my dismay, there was no half decent script to do that!
Well, I realized it wasn't hard to adapt the decent mouse movement scripts people have written to work as 2P mame joystick/lightgun scripts.
You should note that MAME really doesn't like you to be using 2 wiimotes in the input menu.. ver 121 seems to instantly crash in it, I ended up having to edit the XML config files directly to get it working, and it's annoying because Windows seems to assign joystick #s at random (This would probably be more sensible in Linux..)
Anyways, here is my 2nd attempt using Carl kenner's mouse smooth move script:
| Code: |
// My best IR Mouse Script, with 5DOF Tracking
// By Carl Kenner
//Edited for MAME 2P/ppjoy by Bakou
// Change these values for wiimote1:
var.SensorBarSeparation = 8.0 inches // distance between middles of two sensor bar dots
var.NoYawAllowed = true // Calculates X if no yaw is allowed, otherwise calculates Yaw but not X
var.IRMulX = 1.0
var.IRMulY = 1.0
var.IROffsetX = 0 // add to mouse.x
var.IROffsetY = 0 // add to mouse.y
var.IRLeftButton = Wiimote1.A
var.IRRightButton = Wiimote1.B
var.FreezeTime = 25ms
// change these values for wiimote2
var.SecondSensorBarSeparation = 8.0 inches // distance between middles of two sensor bar dots
var.SecondNoYawAllowed = true // Calculates X if no yaw is allowed, otherwise calculates Yaw but not X
var.SecondIRMulX = 1.2
var.SecondIRMulY = 1.2
var.SecondIROffsetX = 0 // add to mouse.x
var.SecondIROffsetY = 0 // add to mouse.y
var.SecondIRLeftButton = Wiimote2.A
var.SecondIRRightButton = Wiimote2.B
var.SecondFreezeTime = 25ms
// Code for wiimote 1 ------------------------------------------------------------------------------------
// Compensate for roll
var.c = cos(Smooth(wiimote1.roll, 10))
var.s = sin(Smooth(wiimote1.roll, 10))
if wiimote1.dot1vis then
var.dot1x = var.c*(511.5-wiimote1.dot1x)/511.5 - var.s*(wiimote1.dot1y-383.5)/511.5
var.dot1y = var.s*(511.5-wiimote1.dot1x)/511.5 + var.c*(wiimote1.dot1y-383.5)/511.5
end if
if wiimote1.dot2vis then
var.dot2x = var.c*(511.5-wiimote1.dot2x)/511.5 - var.s*(wiimote1.dot2y-383.5)/511.5
var.dot2y = var.s*(511.5-wiimote1.dot2x)/511.5 + var.c*(wiimote1.dot2y-383.5)/511.5
end if
// if both dots are visible check which is which and how far apart
if wiimote1.dot1vis and wiimote1.dot2vis then
if var.dot1x <= var.dot2x then
var.leftdot = 1
var.dotdeltay = var.dot2y - var.dot1y
else
var.leftdot = 2
var.dotdeltay = var.dot1y - var.dot2y
end if
var.dotdeltax = abs(var.dot1x-var.dot2x)
var.DotSep = hypot(var.dotdeltax, var.dotdeltay) * 511.5
var.IRDistance = var.SensorBarSeparation * 1320 / var.DotSep
end if
// sort out the position of the left and right dots
if var.leftdot = 1 then
if wiimote1.dot1vis and wiimote1.dot2vis then
var.LeftDotX = var.dot1x
var.LeftDotY = var.dot1y
var.LeftDotVis = true
var.RightDotX = var.dot2x
var.RightDotY = var.dot2y
var.RightDotVis = true
else if wiimote1.dot1vis then
if hypot(var.leftdotx-var.dot1x,var.leftdoty-var.dot1y) <= hypot(var.rightdotx-var.dot1x,var.rightdoty-var.dot1y) then
// is the real dot 1
var.LeftDotX = var.dot1x
var.LeftDotY = var.dot1y
var.RightDotX = var.dot1x + var.dotdeltax
var.RightDotY = var.dot1y + var.dotdeltay
var.LeftDotVis = true
var.RightDotVis = false
else
// was originally dot 2, but now called dot 1.
var.leftdot = 2 // this dot (1) is actually the right dot
var.LeftDotX = var.dot1x - var.dotdeltax
var.LeftDotY = var.dot1y - var.dotdeltay
var.RightDotX = var.dot1x
var.RightDotY = var.dot1y
var.RightDotVis = true
var.LeftDotVis = false
end if
else if wiimote1.dot2vis then
var.LeftDotX = var.dot2x - var.dotdeltax
var.LeftDotY = var.dot2y - var.dotdeltay
var.RightDotX = var.dot2x
var.RightDotY = var.dot2y
var.RightDotVis = true
var.LeftDotVis = false
end if
else if var.leftdot = 2 then
if wiimote1.dot1vis and wiimote1.dot2vis then
var.LeftDotX = var.dot2x
var.LeftDotY = var.dot2y
var.LeftDotVis = true
var.RightDotX = var.dot1x
var.RightDotY = var.dot1y
var.RightDotVis = true
else if wiimote1.dot1vis then
if hypot(var.leftdotx-var.dot1x,var.leftdoty-var.dot1y) <= hypot(var.rightdotx-var.dot1x,var.rightdoty-var.dot1y) then
var.leftdot = 1 // dot 1 is now the left dot
var.LeftDotX = var.dot1x
var.LeftDotY = var.dot1y
var.RightDotX = var.dot1x + var.dotdeltax
var.RightDotY = var.dot1y + var.dotdeltay
var.LeftDotVis = true
var.RightDotVis = false
else
// the real dot 1 (on the right)
var.LeftDotX = var.dot1x - var.dotdeltax
var.LeftDotY = var.dot1y - var.dotdeltay
var.RightDotX = var.dot1x
var.RightDotY = var.dot1y
var.RightDotVis = true
var.LeftDotVis = false
end if
else if wiimote1.dot2vis then
var.RightDotX = var.dot2x + var.dotdeltax
var.RightDotY = var.dot2y + var.dotdeltay
var.LeftDotX = var.dot2x
var.LeftDotY = var.dot2y
var.LeftDotVis = true
var.RightDotVis = false
end if
else
var.LeftDotX = var.dot1x
var.LeftDotY = var.dot1y
var.RightDotX = var.LeftDotX
var.RightDotY = var.LeftDotY
var.LeftDotVis = true
var.RightDotVis = true
end if
// Find the imaginary middle dot
var.MiddleDotX = (var.leftdotx + var.rightdotx)/2
var.MiddleDotY = (var.leftdoty + var.rightdoty)/2
var.MiddleDotVis = wiimote1.dot1vis or wiimote1.dot2vis
if var.MiddleDotVis then
var.TotalPitch = atan2(511.5*var.MiddleDotY,1320) + Wiimote.Pitch
var.DotYaw = atan2(-511.5*var.MiddleDotX,1320) // assume yaw is 0
var.WiimoteYawNoX = atan2(511.5*var.MiddleDotX,1320)
var.WiimoteXNoYaw = -sin(var.dotyaw)*var.IRDistance
var.WiimoteY = -sin(var.totalpitch)*var.IRDistance
var.WiimoteZ = (-sqrt(sqr(var.IRDistance) - sqr(var.WiimoteY)))*var.IRDistance/RemoveUnits(var.IRDistance)
end if
// scale it to the screen range 0 to 1
var.IRx = var.IRMulX*var.middledotx/2 + 0.5
var.IRy = var.IRMulY*var.middledoty*1023/767/2 + 0.5
var.IRvis = wiimote1.dot1vis or wiimote1.dot2vis
var.IROnScreen = 0 <= var.IRx <= 1 and 0 <= var.IRy <= 1
// is it off the screen?
var.IRTooFarLeft = var.IRx < 0 or (var.IRx < 0.1 and (not var.IRvis))
var.IRTooFarRight = var.IRx > 1 or (var.IRx > 1-0.1 and (not var.IRvis))
var.IRTooFarUp = var.IRy < 0 or (var.IRy < 0.1 and (not var.IRvis))
var.IRTooFarDown = var.IRy > 1 or (var.IRy > 1-0.1 and (not var.IRvis))
// Heavily smooth small movements, but do zero lag for quick movements
var.MoveAmount = 1024*hypot(delta(var.IRx), delta(var.IRy))
if smooth(var.MoveAmount) > 12 then
var.SmoothX = var.IRx
var.SmoothY = var.IRy
var.LastSureFrame = PIE.Frame
else if (PIE.frame-var.LastSureFrame) > 18 then
var.SmoothX = Smooth(var.IRx, 18, 4/1024)
var.SmoothY = Smooth(var.IRy, 18, 4/1024)
else if (PIE.frame-var.LastSureFrame) > 14 then
var.SmoothX = Smooth(var.IRx, 14, 4/1024)
var.SmoothY = Smooth(var.IRy, 14, 4/1024)
else if (PIE.frame-var.LastSureFrame) > 10 then
var.SmoothX = Smooth(var.IRx, 10, 4/1024)
var.SmoothY = Smooth(var.IRy, 10, 4/1024)
else if (PIE.frame-var.LastSureFrame) > 6 then
var.SmoothX = Smooth(var.IRx, 6, 4/1024)
var.SmoothY = Smooth(var.IRy, 6, 4/1024)
else if (PIE.frame-var.LastSureFrame) > 2 then
var.SmoothX = Smooth(var.IRx, 2, 4/1024)
var.SmoothY = Smooth(var.IRy, 2, 4/1024)
end if
// Freeze the mouse cursor while they start pressing the button
// otherwise it will make the cursor jump
var.Freeze = (var.IRLeftButton or var.IRRightButton) and KeepDown(pressed(var.IRLeftButton) or pressed(var.IRRightButton), var.FreezeTime)
// Only change the mouse position if pointing at the screen
// otherwise they can still use a real mouse
if var.IRvis and (not var.Freeze) then
// convert to joystick coordinates
ppjoy0.Analog0 = (var.SmoothX - 0.5 ) * 2.0
ppjoy0.Analog1 = (var.SmoothY - 0.5 ) * 2.0
end if
// delay the buttons slightly so we have time to freeze the cursor (is that needed?)
ppjoy0.Digital0 = var.IRLeftButton and (not KeepDown(pressed(var.IRLeftButton), 40ms))
ppjoy0.Digital0 = var.IRRightButton and (not KeepDown(pressed(var.IRRightButton), 40ms))
ppjoy0.Digital3 = wiimote1.One
// Code for wiimote #2 ------------------------------------------------------------------------------------
// Compensate for roll
var.Secondc = cos(Smooth(wiimote2.roll, 10))
var.Seconds = sin(Smooth(wiimote2.roll, 10))
if wiimote2.dot1vis then
var.Seconddot1x = var.Secondc*(511.5-wiimote2.dot1x)/511.5 - var.Seconds*(wiimote2.dot1y-383.5)/511.5
var.Seconddot1y = var.Seconds*(511.5-wiimote2.dot1x)/511.5 + var.Secondc*(wiimote2.dot1y-383.5)/511.5
end if
if wiimote2.dot2vis then
var.Seconddot2x = var.Secondc*(511.5-wiimote2.dot2x)/511.5 - var.Seconds*(wiimote2.dot2y-383.5)/511.5
var.Seconddot2y = var.Seconds*(511.5-wiimote2.dot2x)/511.5 + var.Secondc*(wiimote2.dot2y-383.5)/511.5
end if
// if both dots are visible check which is which and how far apart
if wiimote2.dot1vis and wiimote2.dot2vis then
if var.Seconddot1x <= var.Seconddot2x then
var.Secondleftdot = 1
var.Seconddotdeltay = var.Seconddot2y - var.Seconddot1y
else
var.Secondleftdot = 2
var.Seconddotdeltay = var.Seconddot1y - var.Seconddot2y
end if
var.Seconddotdeltax = abs(var.Seconddot1x-var.Seconddot2x)
var.SecondDotSep = hypot(var.Seconddotdeltax, var.Seconddotdeltay) * 511.5
var.SecondIRDistance = var.SecondSensorBarSeparation * 1320 / var.SecondDotSep
end if
// sort out the position of the left and right dots
if var.Secondleftdot = 1 then
if wiimote2.dot1vis and wiimote2.dot2vis then
var.SecondLeftDotX = var.Seconddot1x
var.SecondLeftDotY = var.Seconddot1y
var.SecondLeftDotVis = true
var.SecondRightDotX = var.Seconddot2x
var.SecondRightDotY = var.Seconddot2y
var.SecondRightDotVis = true
else if wiimote2.dot1vis then
if hypot(var.Secondleftdotx-var.Seconddot1x,var.Secondleftdoty-var.Seconddot1y) <= hypot(var.Secondrightdotx-var.Seconddot1x,var.Secondrightdoty-var.Seconddot1y) then
// is the real dot 1
var.SecondLeftDotX = var.Seconddot1x
var.SecondLeftDotY = var.Seconddot1y
var.SecondRightDotX = var.Seconddot1x + var.Seconddotdeltax
var.SecondRightDotY = var.Seconddot1y + var.Seconddotdeltay
var.SecondLeftDotVis = true
var.SecondRightDotVis = false
else
// was originally dot 2, but now called dot 1.
var.Secondleftdot = 2 // this dot (1) is actually the right dot
var.SecondLeftDotX = var.Seconddot1x - var.Seconddotdeltax
var.SecondLeftDotY = var.Seconddot1y - var.Seconddotdeltay
var.SecondRightDotX = var.Seconddot1x
var.SecondRightDotY = var.Seconddot1y
var.SecondRightDotVis = true
var.SecondLeftDotVis = false
end if
else if wiimote2.dot2vis then
var.SecondLeftDotX = var.Seconddot2x - var.Seconddotdeltax
var.SecondLeftDotY = var.Seconddot2y - var.Seconddotdeltay
var.SecondRightDotX = var.Seconddot2x
var.SecondRightDotY = var.Seconddot2y
var.SecondRightDotVis = true
var.SecondLeftDotVis = false
end if
else if var.Secondleftdot = 2 then
if wiimote2.dot1vis and wiimote2.dot2vis then
var.SecondLeftDotX = var.Seconddot2x
var.SecondLeftDotY = var.Seconddot2y
var.SecondLeftDotVis = true
var.SecondRightDotX = var.Seconddot1x
var.SecondRightDotY = var.Seconddot1y
var.SecondRightDotVis = true
else if wiimote2.dot1vis then
if hypot(var.Secondleftdotx-var.Seconddot1x,var.Secondleftdoty-var.Seconddot1y) <= hypot(var.Secondrightdotx-var.Seconddot1x,var.Secondrightdoty-var.Seconddot1y) then
var.Secondleftdot = 1 // dot 1 is now the left dot
var.SecondLeftDotX = var.Seconddot1x
var.SecondLeftDotY = var.Seconddot1y
var.SecondRightDotX = var.Seconddot1x + var.Seconddotdeltax
var.SecondRightDotY = var.Seconddot1y + var.Seconddotdeltay
var.SecondLeftDotVis = true
var.SecondRightDotVis = false
else
// the real dot 1 (on the right)
var.SecondLeftDotX = var.Seconddot1x - var.Seconddotdeltax
var.SecondLeftDotY = var.Seconddot1y - var.Seconddotdeltay
var.SecondRightDotX = var.Seconddot1x
var.SecondRightDotY = var.Seconddot1y
var.SecondRightDotVis = true
var.SecondLeftDotVis = false
end if
else if wiimote2.dot2vis then
var.SecondRightDotX = var.Seconddot2x + var.Seconddotdeltax
var.SecondRightDotY = var.Seconddot2y + var.Seconddotdeltay
var.SecondLeftDotX = var.Seconddot2x
var.SecondLeftDotY = var.Seconddot2y
var.SecondLeftDotVis = true
var.SecondRightDotVis = false
end if
else
var.SecondLeftDotX = var.Seconddot1x
var.SecondLeftDotY = var.Seconddot1y
var.SecondRightDotX = var.SecondLeftDotX
var.SecondRightDotY = var.SecondLeftDotY
var.SecondLeftDotVis = true
var.SecondRightDotVis = true
end if
// Find the imaginary middle dot
var.SecondMiddleDotX = (var.Secondleftdotx + var.Secondrightdotx)/2
var.SecondMiddleDotY = (var.Secondleftdoty + var.Secondrightdoty)/2
var.SecondMiddleDotVis = wiimote2.dot1vis or wiimote2.dot2vis
if var.SecondMiddleDotVis then
var.SecondTotalPitch = atan2(511.5*var.SecondMiddleDotY,1320) + Wiimote.Pitch
var.SecondDotYaw = atan2(-511.5*var.SecondMiddleDotX,1320) // assume yaw is 0
var.SecondWiimoteYawNoX = atan2(511.5*var.SecondMiddleDotX,1320)
var.SecondWiimoteXNoYaw = -sin(var.Seconddotyaw)*var.SecondIRDistance
var.SecondWiimoteY = -sin(var.Secondtotalpitch)*var.SecondIRDistance
var.SecondWiimoteZ = (-sqrt(sqr(var.SecondIRDistance) - sqr(var.SecondWiimoteY)))*var.SecondIRDistance/RemoveUnits(var.SecondIRDistance)
end if
// scale it to the screen range 0 to 1
var.SecondIRx = var.SecondIRMulX*var.Secondmiddledotx/2 + 0.5
var.SecondIRy = var.SecondIRMulY*var.Secondmiddledoty*1023/767/2 + 0.5
var.SecondIRvis = wiimote2.dot1vis or wiimote2.dot2vis
var.SecondIROnScreen = 0 <= var.SecondIRx <= 1 and 0 <= var.SecondIRy <= 1
// is it off the screen?
var.SecondIRTooFarLeft = var.SecondIRx < 0 or (var.SecondIRx < 0.1 and (not var.SecondIRvis))
var.SecondIRTooFarRight = var.SecondIRx > 1 or (var.SecondIRx > 1-0.1 and (not var.SecondIRvis))
var.SecondIRTooFarUp = var.SecondIRy < 0 or (var.SecondIRy < 0.1 and (not var.SecondIRvis))
var.SecondIRTooFarDown = var.SecondIRy > 1 or (var.SecondIRy > 1-0.1 and (not var.SecondIRvis))
// Heavily smooth small movements, but do zero lag for quick movements
var.SecondMoveAmount = 1024*hypot(delta(var.SecondIRx), delta(var.SecondIRy))
if smooth(var.SecondMoveAmount) > 12 then
var.SecondSmoothX = var.SecondIRx
var.SecondSmoothY = var.SecondIRy
var.SecondLastSureFrame = PIE.Frame
else if (PIE.frame-var.SecondLastSureFrame) > 18 then
var.SecondSmoothX = Smooth(var.SecondIRx, 18, 4/1024)
var.SecondSmoothY = Smooth(var.SecondIRy, 18, 4/1024)
else if (PIE.frame-var.SecondLastSureFrame) > 14 then
var.SecondSmoothX = Smooth(var.SecondIRx, 14, 4/1024)
var.SecondSmoothY = Smooth(var.SecondIRy, 14, 4/1024)
else if (PIE.frame-var.SecondLastSureFrame) > 10 then
var.SecondSmoothX = Smooth(var.SecondIRx, 10, 4/1024)
var.SecondSmoothY = Smooth(var.SecondIRy, 10, 4/1024)
else if (PIE.frame-var.SecondLastSureFrame) > 6 then
var.SecondSmoothX = Smooth(var.SecondIRx, 6, 4/1024)
var.SecondSmoothY = Smooth(var.SecondIRy, 6, 4/1024)
else if (PIE.frame-var.SecondLastSureFrame) > 2 then
var.SecondSmoothX = Smooth(var.SecondIRx, 2, 4/1024)
var.SecondSmoothY = Smooth(var.SecondIRy, 2, 4/1024)
end if
// Freeze the mouse cursor while they start pressing the button
// otherwise it will make the cursor jump
var.SecondFreeze = (var.SecondIRLeftButton or var.SecondIRRightButton) and KeepDown(pressed(var.SecondIRLeftButton) or pressed(var.SecondIRRightButton), var.SecondFreezeTime)
// Only change the mouse position if pointing at the screen
// otherwise they can still use a real mouse
if var.SecondIRvis and (not var.SecondFreeze) then
// convert to joystick coordinates
ppjoy2.Analog0 = (var.SecondSmoothX - 0.5 ) * 2.0
ppjoy2.Analog1 = (var.SecondSmoothY - 0.5 ) * 2.0
end if
// delay the buttons slightly so we have time to freeze the cursor (is that needed?)
ppjoy2.Digital0 = var.SecondIRLeftButton and (not KeepDown(pressed(var.SecondIRLeftButton), 40ms))
ppjoy2.Digital0 = var.SecondIRRightButton and (not KeepDown(pressed(var.SecondIRRightButton), 40ms))
ppjoy2.Digital3 = wiimote2.One
debug = 'Joy0: ' + ppjoy0.Analog0 + ' ' + ppjoy0.Analog1 + 'Joy2: ' + ppjoy2.Analog0 + ' ' + ppjoy2.Analog1
| [/code] |
|
| Back to top |
|
 |
JohnnyBoy
Joined: 25 Dec 2007 Posts: 2
Digg It |
Posted: Wed Dec 26, 2007 7:59 pm Post subject: |
|
|
About that mame joystick script, well since it is a joystick if you point it in one direction the cursor will keep moving in that direction. Any fix for this?
Also, for me in-game its very jumpy, any settings to change? |
|
| Back to top |
|
 |
ButterBeer
Joined: 27 Dec 2007 Posts: 3
Digg It |
Posted: Thu Dec 27, 2007 5:14 pm Post subject: |
|
|
Here is a script that uses the nunchuk to control the mouse.
| Code: |
//Set these values to match the debug screen
var.trimjoyx = .04
var.trimjoyy = .10
//Change this to adjust how fast the cursor goes
var.acceleration = 30
//Change this to make the cursor more/less smooth
var.interval = 1
//Buttons
mouse.leftbutton = wiimote.nunchuk.zbutton
mouse.rightbutton = wiimote.nunchuk.cbutton
//Movement Control
if wiimote.nunchuk.joyx > var.trimjoyx + .05
mouse.x = mouse.x + (wiimote.nunchuk.joyx - var.trimjoyx)/var.acceleration
wiimote.led3=1
wait var.interval ms
wiimote.led3=0
endif
if wiimote.nunchuk.joyx < var.trimjoyx - .05
mouse.x = mouse.x - (wiimote.nunchuk.joyx - var.trimjoyx)/var.acceleration*-1
wiimote.led1=1
wait var.interval ms
wiimote.led1=0
endif
if wiimote.nunchuk.joyy > var.trimjoyy + .05
mouse.y = mouse.y + (wiimote.nunchuk.joyy - var.trimjoyy)/var.acceleration
wiimote.led2=1
wait var.interval ms
wiimote.led2=0
endif
if wiimote.nunchuk.joyy < var.trimjoyy - .05
mouse.y = mouse.y - (wiimote.nunchuk.joyy - var.trimjoyy)/var.acceleration*-1
wiimote.led4=1
wait var.interval ms
wiimote.led4=0
endif
debug = wiimote.nunchuk.joyx + " , " + wiimote.nunchuk.joyy
|
|
|
| Back to top |
|
 |
coolbrow
Joined: 29 Dec 2007 Posts: 6
Digg It |
Posted: Sat Dec 29, 2007 2:57 am Post subject: |
|
|
I edited a few peoples scripts together to come up with this one... I take credit for none of this.
Its a script for NES controls and optional Nunchuck mouse control.
With the Nunchuck unplugged the Wiimote is the mouse with tilt and such, no sensor bar required.
Emulator Set Up:
A button: Z
B button: X
Start: Enter
Select: Shift
Controls: Arrow Keys
Controls for Wiimote (turned Sidways):
D-Pad: Arrow keys, turned sideways
A button: Left Mouse Click
B button: Start/Enter
Minus: Restores Window
Plus: Maximize Window
Home: Turn Wiimote on
1 button: A button (NES)
2 Button: B button (NES)
NES and MOUSE control Wiimote
| Code: |
/*
COMPATIBLE with
Wiimote
Nunchuk
INCOMPATIBLE with
Sensor Bar
HOW TO USE IT
ATTENTION: The GlovePIE window will hide itself once you run this script.
You can hide/unhide GlovePIE's window by double-clicking the Home button on your Wiimote, Classic Controller or keyboard.
This script offers Lock Key function. You have to press Home button once to unlock the keys. You can press it again to lock them once more.
Mouse Control
Move mouse = Analog (Nunchuk)
Left Click = c (Nunchuk)
Right Click = Z (Nunchuk)
WHAT THE LEDS MEAN
No LEDS = Buttons locked or Wiimote not connected or script not active
Flashing LEDS = You just connected with your PC your Wiimote. Just press Home to unlock the buttons or script not active
2+3 LEDS = Wiimote buttons (and Nunchuk if connected) are working
*/
// Hide/Show GlovePIE window by double-clicking the Home button
if var.run == FALSE then
var.run = TRUE
HidePie
var.hidden = TRUE
endif
if ((DoubleClicked(Wiimote.Home) and Wiimote.HasClassic == FALSE) or (DoubleClicked(Home) and LeftShift == FALSE) or DoubleClicked(Wiimote.Classic.Home)) and var.hidden then
ShowPie
var.hidden = FALSE
elseif ((DoubleClicked(Wiimote.Home) and Wiimote.HasClassic == FALSE) or (DoubleClicked(Home) and LeftShift == FALSE) or DoubleClicked(Wiimote.Classic.Home)) and var.hidden == FALSE then
HidePie
var.hidden = TRUE
endif
// Rumbles when you lock or unlock keys.
var.IwantRUMBLE = TRUE // If you don't want the Rumble, then change the TRUE to FALSE
// Home button enables and disables the buttons. Function similar to the Lock Key
var.home = (SingleClicked(Wiimote.Home) and Wiimote.HasClassic == FALSE) or SingleClicked(Wiimote.Classic.Home)
If var.home and var.on then
If var.IwantRUMBLE then
Wiimote.Rumble = TRUE
wait 100ms
Wiimote.Rumble = FALSE
wait 150ms
Wiimote.Rumble = TRUE
wait 100ms
Wiimote.Rumble = FALSE
endif
var.on = FALSE
elseif var.home and var.on = FALSE then
If var.IwantRUMBLE then
Wiimote.Rumble = TRUE
wait 150ms
Wiimote.Rumble = FALSE
endif
var.on = TRUE
endif
// LEDS
Wiimote.Led1 = var.on and Wiimote.HasClassic
Wiimote.Led2 = var.on and Wiimote.HasClassic == FALSE
Wiimote.Led3 = var.on and Wiimote.HasClassic == FALSE
Wiimote.Led4 = var.on and Wiimote.HasClassic
//Keys for Wiimote.
Left = Wiimote.Up and var.on and Wiimote.HasClassic == FALSE
Right = Wiimote.Down and var.on and Wiimote.HasClassic == FALSE
Down = Wiimote.Left and var.on and Wiimote.HasClassic == FALSE
Up = Wiimote.Right and var.on and Wiimote.HasClassic == FALSE
Mouse.LeftButton = Wiimote.A and var.on and Wiimote.HasClassic == FALSE
Enter = Wiimote.B and var.on and Wiimote.HasClassic == FALSE
LeftAlt+Enter = Wiimote.A and Wiimote.B and var.on and Wiimote.HasClassic == FALSE
Z = Wiimote.One and var.on and Wiimote.HasClassic == FALSE
X = Wiimote.Two and var.on and Wiimote.HasClassic == FALSE
LeftShift+M = Wiimote.Minus and Wiimote.Plus and var.on and Wiimote.HasClassic == FALSE
LeftAlt+Space+R = Wiimote.Minus and var.on and Wiimote.HasClassic == FALSE
LeftAlt+Space+X = Wiimote.Plus and var.on and Wiimote.HasClassic == FALSE
// Keys for Nunchuk
if wiimote.HasNunchuk == FALSE and var.on == TRUE then
if wiimote.one = true or Space = true then
var.a = -var.xRot
var.b = -var.yRot
var.c = -var.zRot
wait 200 ms // prevent to return this routine while pressing button1
end if
//wait 200 ms // prevent to return this routine while pressing button1
// End of wiimote calibration routine------------------------------------------
var.xRot = Wiimote.RawForceX + var.xOffset
var.yRot = Wiimote.RawForceY + var.yOffset
var.zRot = Wiimote.RawForceZ + var.zOffset
var.sense0 = 500
var.thresh0x = 5
var.thresh0y = 2
var.sense = 300
var.threshx = 10
var.threshy = 5
var.sense2 = 100
var.thresh2x = 15
var.thresh2y = 8
var.sense3 = 50
var.thresh3x = 20
var.thresh3y = 12
//first sensitivity setting
//xaxis
if var.xRot > var.thresh0x
mouse.x = mouse.x - 1/var.sense0
endif
if var.xRot < -var.thresh0x
mouse.x = mouse.x + 1/var.sense0
endif
//yaxis
if var.zRot > var.thresh0y
mouse.y = mouse.y - 1/var.sense0
endif
if var.zRot < -var.thresh0y
mouse.y = mouse.y + 1/var.sense0
endif
//second sensitivity setting
//xaxis
if var.xRot > var.threshx
mouse.x = mouse.x - 1/var.sense
endif
if var.xRot < -var.threshx
mouse.x = mouse.x + 1/var.sense
endif
//yaxis
if var.zRot > var.threshy
mouse.y = mouse.y - 1/var.sense
endif
if var.zRot < -var.threshy
mouse.y = mouse.y + 1/var.sense
endif
//third sensitivity setting
//xaxis
if var.xRot > var.thresh2x
mouse.x = mouse.x - 1/var.sense2
endif
if var.xRot < -var.thresh2x
mouse.x = mouse.x + 1/var.sense2
endif
//yaxis
if var.zRot > var.thresh2y
mouse.y = mouse.y - 1/var.sense2
endif
if var.zRot < -var.thresh2y
mouse.y = mouse.y + 1/var.sense2
endif
//fourth sensitivity setting
//xaxis
if var.xRot > var.thresh3x
mouse.x = mouse.x - 1/var.sense3
endif
if var.xRot < -var.thresh3x
mouse.x = mouse.x + 1/var.sense3
endif
//yaxis
if var.zRot > var.thresh3y
mouse.y = mouse.y - 1/var.sense3
endif
if var.zRot < -var.thresh3y
mouse.y = mouse.y + 1/var.sense3
endif
endif
//Nuncuck as mouse, when connected
if Wiimote.HasNunchuk and var.on == True then
var.joyfix = 5 / 100
Mouse.LeftButton = Wiimote.Nunchuk.CButton and var.on // C = left mouse click
Mouse.RightButton = Wiimote.Nunchuk.ZButton and var.on // Z = right mouse click
if (Wiimote.Nunchuk.JoyX > var.joyfix or Wiimote.Nunchuk.JoyX < -var.joyfix) and var.on then mouse.x = mouse.x + Wiimote.Nunchuk.JoyX/50 // {Analog is used
if (Wiimote.Nunchuk.JoyY > var.joyfix or Wiimote.Nunchuk.JoyY < -var.joyfix) and var.on then mouse.y = mouse.y + Wiimote.Nunchuk.JoyY/50 // for mouse movement}
endif
// Keys for Classic Controller
Left = Wiimote.Classic.Up and var.on
Right = Wiimote.Classic.Down and var.on
Down = Wiimote.Classic.Left and var.on
Up = Wiimote.Classic.Right and var.on
Enter = Wiimote.Classic.a and var.on
Space = Wiimote.Classic.b and var.on
LeftAlt+Enter = Wiimote.Classic.x and var.on
Z = Wiimote.Classic.ZR and var.on
X = Wiimote.Classic.R and var.on
LeftShift+End = Wiimote.Classic.Minus and var.on
LeftShift+Home = Wiimote.Classic.Plus and var.on
LeftControl+M = Wiimote.Classic.y and var.on
Mouse.RightButton = Wiimote.Classic.ZL and var.on // ZL = right mouse click
Mouse.LeftButton = Wiimote.Classic.L and var.on // L = left mouse click
if (Wiimote.Classic.Joy1X > var.joyfix or Wiimote.Classic.Joy1X < -var.joyfix) and var.on then mouse.x = mouse.x + Wiimote.Classic.Joy1X/50 // {Left analog is used
if (Wiimote.Classic.Joy1Y > var.joyfix or Wiimote.Classic.Joy1Y < -var.joyfix) and var.on then mouse.y = mouse.y + Wiimote.Classic.Joy1Y/50 // for mouse movement}
// Battery info
if Wiimote.Battery <= 12 and var.warned == FALSE then
Say "Low Battery"
var.warned = TRUE
endif
var.bat = Wiimote.Battery / 192 * 100
debug ='Battery= '+var.bat+'%'
|
Please tell me if I copied something wrong, and enjoy! |
|
| Back to top |
|
 |
Cpkppp
Joined: 19 Oct 2007 Posts: 4
Digg It |
Posted: Sat Dec 29, 2007 2:07 pm Post subject: Die by the Sword(gravity).PIE |
|
|
It's for a swordfighting game "Die by the Sword". I think this game is really fit for Wii. You will know what I'm saying to watch the video below that uses this script.
Oops I can't post URL yet. Just search "Die by the Sword - Wiimote & Nunchuk" at Youtube.
| Code: | /*
Die by the Sword(gravity).PIE by Cpkppp
version 2.1
28, Dec 2007
-------------------------------------------------------------------------------
About the setting of PPJoy
-------------------------------------------------------------------------------
Install PPJoy and confirm there is "PPJoy Virtual joystick 1" in joystick
option.
Select "Modify the mapping for this controller" in the first of the PPJoy's
mapping wizard. You need to set 2 axes. Then map axes like the below in
"Define the number and type of axes...".
X axis as Axis1
Y axis as Axis2
Then set axes like the below in "Configure mapping for axes".
Analog0 as X Axis
Analog1 as Y Axis
Other PPJoy settings are not needed for this script. Also if you use WinXP,
you must set PPJoy Virtual Joystick as the default device used in an old
application, in control panel of the joystick.
About the Nunchuk thing, it just performs a custom movement which I have set
for the shield/off-arm so you need to make the similar custom movements and
set them for your custom movements.
-------------------------------------------------------------------------------
How to use
-------------------------------------------------------------------------------
[Wiimote]
Roll is for analog0(X) and pitch is for analog1(Y). When acceleration is over
var.RumbleDeadzone, the wiimote vibrates.
[Nunchuk]
If you have a nunchuk you can use it together. Joystick is for EDSF. C and Z
are for turning right or left. Roll and pitch are for mainly custom movement.
[etc.]
Wiimote's LEDs show battery level.
Note:
Since wiimote doesn't capture Yaw movement without IR sensor bar,
roll movement is used for x axis: you need to roll/twist the wiimote to input
x axis. But you can swing your arm to have the vibrate longer, rolling the
wiimote.
-------------------------------------------------------------------------------
How to make a shield movement
-------------------------------------------------------------------------------
I will explain how to make a keep-the-shield-up movement that allows player to
swing the sword independently of the custom movement playing.
Firstly, make only the Offarm/shield record then record it to hit keypad 8 to
move the shield up.
Secondly, make Body record(red triangle), Arm stop(square) and Offarm
play(yellow triangle) then record it until the shield's play ends.
Thirdly, cut the excessive frames. I set the frame length about 20.
Now you can use it with Nunchak motion after mapping it in DbtS configuration.
Btw I use 4 shield movements; up, down, right-to-left and default position.
*/
//-----------------------------------------------------------------------------
// Key setting
//-----------------------------------------------------------------------------
// Wiimote key setting
// Die by the Sword can't recognize over 4 buttons of joystick, so I recomend you
// to use keyboard for the assign, not PPJoy.Digital*.
Key.One = Wiimote1.Up
Key.Two = Wiimote1.Down
Key.Three = Wiimote1.Left
Key.Four = Wiimote1.Right
Key.Five = Wiimote1.A
Key.Six = Wiimote1.B
Key.Seven = Wiimote1.Minus
Key.Eight = Wiimote1.Plus
//Key.ScrollLock = Wiimote1.Minus // for screenshot with Fraps
// to select the savedata in Quest
Key.Enter = Wiimote1.Home
Key.Escape = DoubleClicked(Wiimote1.Home)
Key.PageUp = Wiimote1.One
Key.PageDown = Wiimote1.Two
var.inputmax= 1
PPJoy.Analog0 = -maprange(Wiimote1.gX, -var.inputmax, var.inputmax, -1,1) //roll
PPJoy.Analog1 = -maprange(Wiimote1.gZ, -var.inputmax, var.inputmax, -1,1) //pitch
// Nunchuk key setting
Key.Space = Wiimote1.Nunchuk.CButton
Key.Shift = Wiimote1.Nunchuk.ZButton
var.NunchukJoyDeadzone = 0.3
Key.F = Wiimote1.Nunchuk.JoyX > var.NunchukJoyDeadzone
Key.S = Wiimote1.Nunchuk.JoyX < -var.NunchukJoyDeadzone
Key.D = Wiimote1.Nunchuk.JoyY > var.NunchukJoyDeadzone
Key.E = Wiimote1.Nunchuk.JoyY < -var.NunchukJoyDeadzone
/*
This part can make dodge easy to input EDSF near the max input of joystick,
though I don't use it.
// Nunchuk dodge setting
var.DodgeDeadzone = 0.92
if DoubleClicked(Wiimote1.Nunchuk.JoyX > var.DodgeDeadzone) then
Key.F = false
wait 10ms
Key.F = true
wait 10ms
Key.F = false
wait 10ms
Key.F = true
wait 10ms
Key.F = false
endif
if DoubleClicked(Wiimote1.Nunchuk.JoyX < -var.DodgeDeadzone) then
Key.S = false
wait 10ms
Key.S = true
wait 10ms
Key.S = false
wait 10ms
Key.S = true
wait 10ms
Key.S = false
endif
if DoubleClicked(Wiimote1.Nunchuk.JoyY > var.DodgeDeadzone) then
Key.D = false
wait 10ms
Key.D = true
wait 10ms
Key.D = false
wait 10ms
Key.D = true
wait 10ms
Key.D = false
endif
if DoubleClicked(Wiimote1.Nunchuk.JoyY < -var.DodgeDeadzone) then
Key.E = false
wait 10ms
Key.E = true
wait 10ms
Key.E = false
wait 10ms
Key.E = true
wait 10ms
Key.E = false
endif
*/
// Nunchuk tilt setting
var.NunchukTiltDeadzonePitch = 0.5
var.NunchukTiltDeadzoneRoll = 0.7
// continuous input mainly for keeping to do a custom movement of the shield
if Wiimote1.Nunchuk.gz > var.NunchukTiltDeadzonePitch then // pitch up
Key.Up = true
wait 10ms
Key.Up = false
wait 0.5s
else if Wiimote1.Nunchuk.gz < -var.NunchukTiltDeadzonePitch then // pitch down
Key.Down = true
wait 10ms
Key.Down = false
wait 0.5s
else if Wiimote1.Nunchuk.gx > var.NunchukTiltDeadzoneRoll then // roll left
Key.Left = true
wait 10ms
Key.Left = false
wait 0.5s
else if Wiimote1.Nunchuk.gx < -var.NunchukTiltDeadzoneRoll then // roll right
Key.Right = true
wait 10ms
Key.Right = false
wait 0.5s
endif
// rumble code
var.RumbleDeadzone = 2 // the smaller, the more sensitive
if (abs(Wiimote1.RelAccX) > var.RumbleDeadzone) or (abs(Wiimote1.RelAccZ) > var.RumbleDeadzone) then
Wiimote1.Rumble = true
else
Wiimote1.Rumble = false
endif
// debug code
debug = "X: " + PPJoy.Analog0 + " Y: " + PPJoy.Analog1 + " RelAccX: " + Wiimote1.RelAccX + "RelAccY: " +Wiimote1.RelAccY + "RelAccZ: " +Wiimote1.RelAccZ + "NunGX: " + Wiimote1.Nunchuk.gX + " NunGZ: " + Wiimote1.Nunchuk.gZ + " NunJoyX " + Wiimote1.Nunchuk.JoyX + " NunJoyY " + Wiimote1.Nunchuk.JoyY
//-----------------------------------------------------------------------------
// Battery display code
//-----------------------------------------------------------------------------
//Wiimote Battery Display
//by J.Coulston
// Modified by Carl Kenner for GlovePIE 0.25
// use up battery power :-)
// comment out this line if you don't need it
//wiimote1.Rumble = shift
//A full battery gives 0xC0 (192)
var.Batt = wiimote1.Battery / 48
if true then
wait 5 seconds
//it sends an instruction that tells the Wiimote to actually
//send the report.
wiimote1.Report15 = 0x80 | Int(wiimote1.Rumble)
end if
//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.
//Blink rate
//var.Blink = 500ms
//debug = "Battery level: " + 100*48*var.Batt/192 + "%"
if 0<=var.Batt<=0.25 then
wiimote1.Leds = 1
//wait var.Blink
//wiimote1.Leds = 0
//wait var.Blink
elseif 0.25 < var.Batt<=1 then
wiimote1.Leds = 1
elseif 1 < var.Batt<=1.25 then
wiimote1.Leds = 3
//wait var.Blink
//wiimote1.Leds = 1
//wait var.Blink
elseif 1.25 < var.Batt<=2 then
wiimote1.Leds = 3
elseif 2 < var.Batt<=2.25 then
wiimote1.Leds = 7
//wait var.Blink
//wiimote1.Leds = 3
//wait var.Blink
elseif 2.25 < var.Batt<=3 then
wiimote1.Leds = 7
elseif 3 < var.Batt<=3.25 then
wiimote1.Leds = 15
//wait var.Blink
//wiimote1.Leds = 7
//wait var.Blink
elseif 3.25 < var.Batt<=4 then
wiimote1.Leds = 15
else
wiimote1.Leds = 0
endif |
|
|
| Back to top |
|
 |
UnknownJoe
Joined: 31 Dec 2007 Posts: 1
Digg It |
Posted: Mon Dec 31, 2007 2:28 pm Post subject: MK 64 Z-Button movement |
|
|
This script is for Mario Kart 64.
Note that I hope that you do actually own the game using VC or have the actual cartrige.
This one is different, because it uses shaking as the Z button. Just shake forward quickly to use it. If you want to change it, just assign it a different button. You could use up/down to be the Z button and up/down, but it might have some odd effects during the menus.
You must have PPJoy to use this one. 4 virtual controllers need to be installed and have 11 or more buttons and at least one axis. You also should probably use Project 64 because there are so many controllers your computer will be seeing at the same time.
| Code: | // Show wiimote forces
debug = Wiimote1.RawForceZ+', '+Wiimote2.RawForceZ+', '+Wiimote3.RawForceZ+', '+Wiimote4.RawForceZ
// Set keys to wiimote buttons
PPJoy1.Digital0 = Wiimote1.Up
PPJoy1.Digital1 = Wiimote1.Down
PPJoy1.Digital2 = Wiimote1.Left
PPJoy1.Digital3 = Wiimote1.Right
PPJoy1.Digital4 = Wiimote1.A
PPJoy1.Digital5 = Wiimote1.B
PPJoy1.Digital6 = Wiimote1.One
PPJoy1.Digital7 = Wiimote1.Two
PPJoy1.Digital8 = Wiimote1.Home
PPJoy1.Digital9 = Wiimote1.Minus
PPJoy1.Digital10 = Wiimote1.Plus
// Set keys to wiimote buttons
PPJoy2.Digital0 = Wiimote2.Up
PPJoy2.Digital1 = Wiimote2.Down
PPJoy2.Digital2 = Wiimote2.Left
PPJoy2.Digital3 = Wiimote2.Right
PPJoy2.Digital4 = Wiimote2.A
PPJoy2.Digital5 = Wiimote2.B
PPJoy2.Digital6 = Wiimote2.One
PPJoy2.Digital7 = Wiimote2.Two
PPJoy2.Digital8 = Wiimote2.Home
PPJoy2.Digital9 = Wiimote2.Minus
PPJoy2.Digital10 = Wiimote2.Plus
// Set keys to wiimote buttons
PPJoy3.Digital0 = Wiimote3.Up
PPJoy3.Digital1 = Wiimote3.Down
PPJoy3.Digital2 = Wiimote3.Left
PPJoy3.Digital3 = Wiimote3.Right
PPJoy3.Digital4 = Wiimote3.A
PPJoy3.Digital5 = Wiimote3.B
PPJoy3.Digital6 = Wiimote3.One
PPJoy3.Digital7 = Wiimote3.Two
PPJoy3.Digital8 = Wiimote3.Home
PPJoy3.Digital9 = Wiimote3.Minus
PPJoy3.Digital10 = Wiimote3.Plus
PPJoy4.Digital0 = Wiimote4.Up
PPJoy4.Digital1 = Wiimote4.Down
PPJoy4.Digital2 = Wiimote4.Left
PPJoy4.Digital3 = Wiimote4.Right
PPJoy4.Digital4 = Wiimote4.A
PPJoy4.Digital5 = Wiimote4.B
PPJoy4.Digital6 = Wiimote4.One
PPJoy4.Digital7 = Wiimote4.Two
PPJoy4.Digital8 = Wiimote4.Home
PPJoy4.Digital9 = Wiimote4.Minus
PPJoy4.Digital10 = Wiimote4.Plus
// Rumble when Z is pressed
if Wiimote1.RawForceY>50 then
Wiimote1.Rumble=true
PPJoy1.Digital11=1
Wait(20 ms);
PPJoy1.Digital11=0
Wait(230 ms);
Wiimote1.Rumble=false
end if;
// Rumble when Z is pressed
if Wiimote2.RawForceY>50 then
Wiimote2.Rumble=true
PPJoy2.Digital11=1
Wait(20 ms);
PPJoy2.Digital11=0
Wait(230 ms);
Wiimote2.Rumble=false
end if;
// Rumble when Z is pressed
if Wiimote3.RawForceY>50 then
Wiimote3.Rumble=true
PPJoy3.Digital11=1
Wait(20 ms);
PPJoy3.Digital11=0
Wait(230 ms);
Wiimote3.Rumble=false
end if;
// Rumble when Z is pressed
if Wiimote4.RawForceY>50 then
Wiimote4.Rumble=true
PPJoy4.Digital11=1
Wait(20 ms);
PPJoy4.Digital11=0
Wait(230 ms);
Wiimote4.Rumble=false
end if;
// Set the LEDs to ON
Wiimote1.Leds = 1
// Set the LEDs to ON
Wiimote2.Leds = 2
// Set the LEDs to ON
Wiimote3.Leds = 4
// Set the LEDs to ON
Wiimote3.Leds = 8
//replace the "Wiimote#.RawForceZ +/- #" to "Wiimote#.RawForceZ +/- (The opposite or your values when flat)"
PPJoy1.Analog0 = sin((Wiimote1.RawForceZ+9)*(3+(1/3)))/2+((Wiimote1.RawForceZ+9)/28)/2
PPJoy2.Analog0 = sin((Wiimote2.RawForceZ-3)*(3+(1/3)))/2+((Wiimote2.RawForceZ-3)/28)/2
PPJoy3.Analog0 = sin((Wiimote3.RawForceZ+4)*(3+(1/3)))/2+((Wiimote3.RawForceZ+4)/28)/2
PPJoy4.Analog0 = sin((Wiimote4.RawForceZ+4)*(3+(1/3)))/2+((Wiimote4.RawForceZ+4)/28)/2[code/] |
|
|
| 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
|