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 

GlovePIE Wii-Mote Scripts
Goto page Previous  1, 2, 3 ... 43, 44, 45 ... 53, 54, 55  Next
 
Post new topic   Reply to topic    WiiLi.org Forum Index -> GlovePie
View previous topic :: View next topic  
Author Message
punx777



Joined: 28 Jan 2008
Posts: 2

Digg It
PostPosted: Mon Jan 28, 2008 7:35 pm    Post subject:

A very simple and basic script to test the Wiimote's read and write functions. If you press A the vibration and LED sequence will stop. I have an HP integrated Vista PC, and I'm have yet to be able to Read from the wiimote. Write-only access. Any help?






Code:
Wiimote.Rumble = true;
Wiimote1.LED1 = true;
wait 100 ms
Wiimote1.LED1 = false;
Wiimote.Rumble = false;
Wiimote1.LED2 = true;
wait 100 ms
Wiimote1.LED2 = false;
Wiimote.Rumble = true;
Wiimote1.LED3 = true;
wait 100 ms
Wiimote1.LED3 = false;
Wiimote.Rumble = false;
Wiimote1.LED4 = true;
wait 100 ms
Wiimote1.LED4 = false;

If Wiimote1.A = True
Wiimote2.LED1 = true;
Wiimote2.LED2 = true;
Wiimote2.LED3 = true;
Wiimote2.LED4 = true;
Endif
Back to top
View user's profile Send private message
Jokr2Thief



Joined: 29 Jan 2008
Posts: 1

Digg It
PostPosted: Tue Jan 29, 2008 7:33 pm    Post subject: Switch

This is not all my work, and the calibration for both the Wiimote and nunchuk was c/o the forums at Wiili. Many thanks to all the posters here for saving me a great deal of time and frustration, as initially, I couldn't get my mouse to stop jumping around long enough for the Wiimote to be of any sort of use.

Code:
//Jokr2Thief's Wiimote Mouse Movement Toggle
//Script to switch mouse control between the Wiimote
//And Nunchuk using the Home Button

//State 0 (default): Mouse controlled by Wiimote Accelerometer
//Mouse 1 = B, Mouse 2 = A

//State 1: Mouse Controlled by Nunchuk Analog Stick
//Mouse 1 = Z, Mouse 2=C


if Wiimote.Home then
 if var.switch = 0 then
 wait 250 ms
 var.switch = 1
 endif

 if var.switch = 1 then
 wait 250 ms
 var.switch = 0
 endif
endif


// Show wiimote forces
debug = "X="+Wiimote.RawForceX+' Y='+Wiimote.RawForceY+' Z='+Wiimote.RawForceZ

if var.switch = 0 then

// set these to the offsets when the wiimote is at rest
// will be different for each wiimote most likely

 var.x = Wiimote.RawForceX +0 //trim to 0
 var.y = Wiimote.RawForceY -0 // trim to 0
 var.z = Wiimote.RawForceZ +0 //trim to 0

//precision
 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.x > var.thresh0x
  mouse.x = mouse.x - 1/var.sense0
 endif
 if var.x < -var.thresh0x
  mouse.x = mouse.x + 1/var.sense0
 endif

//yaxis
 if var.z > var.thresh0y
  mouse.y = mouse.y - 1/var.sense0
 endif
 if var.z < -var.thresh0y
  mouse.y = mouse.y + 1/var.sense0
 endif


//second sensitivity setting
//xaxis
 if var.x > var.threshx
  mouse.x = mouse.x - 1/var.sense
 endif
 if var.x < -var.threshx
  mouse.x = mouse.x + 1/var.sense
 endif

//yaxis
 if var.z > var.threshy
  mouse.y = mouse.y - 1/var.sense
 endif
 if var.z < -var.threshy
  mouse.y = mouse.y + 1/var.sense
 endif

//third sensitivity setting
//xaxis
 if var.x > var.thresh2x
  mouse.x = mouse.x - 1/var.sense2
 endif
 if var.x < -var.thresh2x
  mouse.x = mouse.x + 1/var.sense2
 endif

//yaxis
 if var.z > var.thresh2y
  mouse.y = mouse.y - 1/var.sense2
 endif
 if var.z < -var.thresh2y
  mouse.y = mouse.y + 1/var.sense2
 endif

//fourth sensitivity setting
//xaxis
 if var.x > var.thresh3x
  mouse.x = mouse.x - 1/var.sense3
 endif
 if var.x < -var.thresh3x
  mouse.x = mouse.x + 1/var.sense3
 endif

//yaxis
 if var.z > var.thresh3y
  mouse.y = mouse.y - 1/var.sense3
 endif
 if var.z < -var.thresh3y
  mouse.y = mouse.y + 1/var.sense3
 endif
endif

if var.switch = 1 then
 if (Wiimote.Nunchuk.JoyX > var.joyfix or Wiimote.Nunchuk.JoyX < -var.joyfix) then mouse.x = mouse.x + Wiimote.Nunchuk.JoyX/50      // {Analog is used
 if (Wiimote.Nunchuk.JoyY > var.joyfix or Wiimote.Nunchuk.JoyY < -var.joyfix) then mouse.y = mouse.y + Wiimote.Nunchuk.JoyY/50      //  for mouse movement}
endif

if var.switch = 0 then
 Mouse.LeftButton = Wiimote.B
 Mouse.RightButton = Wiimote.A
endif

if var.switch = 1 then
 Mouse.LeftButton = Wiimote.Nunchuk.ZButton
 Mouse.RightButton = Wiimote.Nunchuk.CButton
endif

_________________
"We have normality. Anything you still can’t cope with is therefore your own problem." - Trillian; The Hitchhiker's Guide to the Galaxy

Jokr2Thief - Your speed bump on the Information Superhighway
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
leynadix



Joined: 28 Dec 2007
Posts: 44
Location: Mataró, Catalunya

Digg It
PostPosted: Wed Jan 30, 2008 5:58 pm    Post subject:

Hey Shakipu
Hey GMA
I dont know exactly run yours scripts, ¿do you explain me a little more?
Thanks
Back to top
View user's profile Send private message
funkamatic



Joined: 06 Feb 2008
Posts: 7

Digg It
PostPosted: Wed Feb 06, 2008 4:10 am    Post subject:

Ultimate FPS control:

took me a coupla weeks, but rocks. instructions included.

Code:

/*
Best FPS controller

 EXPLINATION:
  The wiimote controls like a mouse except if it leaves the bounding-
  box. There is a "bounding box" that when the Wiimote IR points to
  the left or right it will start to auto-turn. This is analog so the
  further you go out of the box, the faster you turn.  It will also
  rumble to feedback that you are turning. Otherwise, it just controls
  like a mouse. I experimented for weeks with this thing and it's the
  best.

  To put it simply, it controls like a mouse until you leave the
  bounds, then it acts like a joystick and mouse put together, giving
  you the pixel-perfect (well, close) accuracy while still being able
  to make analog turns.

  Requires sensor bar
  Requires PPjoy with X & Y axis )don't need BUTTONS OR POV)

  your game has to be able to customize the controls including the
  joystick. The only game that I own that does not work is Hexen II.
  You could modify the program to accomodat it by swallowing and
  other techniques.

  Please be aware that after you start the program, make sure the
  wiimote is pointing away from the sensor bar until you get in the
  game.

  Also, sometime the Nunchuck is not recognized as plugged in, so
  I added a little feature that when you push the A and B buttons
  at the same time, the wiimote leds will flash if the nunchuk
  wasn't recognized.  Just unplug the nunchuck and replug it back
  in until they don't flash anymore.


  GETTING STARTED:
  Make sure that you have PPJoy installed and running analog0 and
  analog1. Then get in to you game simply map the buttons as shown
  below or if the game recognizes button presses just press the
  button on the wiimote/nunchuck that you want. Cake. Keep in mind
  that a hearty swing from the wiimote outputs "W" and nunchuck "N"
  so they can be mapped.  The W is rather inconveinient while
  trying to aim, so don't make it anything critical (if anything
  at all).

  Don't forget to also set your games sensativity in the sensativity
  settings below.
  for the bounding box size I use 3 for DooM/Heretic/HeXeN and 5
  for Halo PC. Mess with them till your comfortable.

  Wiimote button mapping:
   d-pad: up = U
          down = D
          left = L
          right = R
   a = A
   b = B
   minus = M
   plus = P
   one = One
   two = Two
   swing = W

   Nunchuck:
   c = C
   z = Z
   swing: N
   control stick x = PPJoy1.Analog0
   control stick y = PPJoy1.Analog1                 */


// user settings for sensativity:
var.box = 3     //change size of bounding box: 1 - 10.
                //basically how far you have to go before you start
                //to auto turn
var.boxs1 = 40  //changes sensativity when outside box 10 - 100
                //10 (very slow), 100 (very fast)

//That should be it!  ENJOY!










// varible modifiers
var.boxs = var.boxs1 * 10
var.box1 = var.box / 10
var.m1 = (var.m * -1) + 11
var.m2 = (1 - (1 / var.m1)) / 2


// leds based on battery life 25/ 50/ 75/ 100%
var.batt = (wiimote.Battery / 2 + 4)
if var.batt < 25
   var.Leds = 1
endif
if var.batt < 50 and > 24
   var.Leds = 3
endif
if var.batt < 75 and > 49
   var.Leds = 7
endif
if var.batt > 74
   var.Leds = 15
endif
Wiimote.leds = var.leds



//Wiimote IR and bouding box
var.dot1x = wiimote.dot1x
var.dot1y = wiimote.dot1y
var.wpx = ((Wiimote.PointerX) - .5) * 2
var.wpy = ((Wiimote.PointerY) - .5) * 2
if wiimote.PointerVisible but not var.PointerBump then
   if var.wpx > var.box1 or < -var.box1
     var.cnt = var.cnt + 1
      if var.cnt < 2
         var.joyx = wiimote.PointerX
      endif
      var.joyx1 = wiimote.pointerx - var.joyx
      var.r = 1  //for rumble
   else
      var.cnt = 0
      var.r = 0  //for rumble
      var.joyx = 0
      var.joyx1 = 0
   endif
         var.joyx2 = var.joyx2 + var.joyx1
         mouse.DirectInputX = (((var.dot1x - (var.joyx2 * var.boxs))* -1) + 500)/ 2
         mouse.DirectInputY = ((var.dot1y) - 200)
endif


//rumble when outside of bounding box
if var.r = 1
   Wiimote.Rumble = TRUE
   wait 1ms
   Wiimote.Rumble = FALSE
   wait 40ms
else
Wiimote.Rumble = FALSE
endif

// Wiimote buttons
key.A = Wiimote.A
key.B = Wiimote.B
key.M = Wiimote.Minus
key.P = Wiimote.Plus
key.L = Wiimote.Left
key.U = Wiimote.Up
key.R = Wiimote.Right
key.D = Wiimote.Down
key.One = Wiimote.One
key.Two = Wiimote.Two
key.Escape = Wiimote.Home

// Nunchuck buttons
key.C = Wiimote.Nunchuk.CButton
key.Z = Wiimote.Nunchuk.ZButton

// Nunchuk Analog stick
PPJoy1.Analog0 = MapRange(Wiimote.Nunchuk.JoyX, -1,1, -1,1)
PPJoy1.Analog1 = MapRange(Wiimote.Nunchuk.JoyY, -1,1, -1,1)

// Wiimote swing:
if (wiimote.RelAccX > 35 or < -35) or (wiimote.RelAccY > 35 or < -35) or (wiimote.RelAccZ > 35 or < -35)
   key.W = true
else
   key.W = false
   var.swing = 0
endif

//Nunchuck swing:
if (wiimote.Nunchuk.RawAccX > 25 or < -25) or (wiimote.Nunchuk.RawAccY > 25 or < -25) or (wiimote.Nunchuk.RawAcc > 25 or < -25)
   key.N = true
else
   key.N = false
endif

//press a & b to see if nunchuk is connected correctly, leds flash if not
if wiimote.a && wiimote.b = true
   if wiimote.HasNunchuk = false
      wiimote.Leds = 0
   endif
endif

[/code]
_________________
Nintendo Forever.
Back to top
View user's profile Send private message
Maxx



Joined: 10 Feb 2008
Posts: 1

Digg It
PostPosted: Sun Feb 10, 2008 5:43 pm    Post subject:

I'm new here, but I've gotten a code..
Care to play Banjo-Kazooie with the wiimote?
Banjo-Kazoowii!
It was based off the principles of the LOZ code by BMH, but I'm screwing around with it.
Code:

/*
Banjo:
 |  /            _____   ______   ____                       ~~~~~ ~~~~~
 | /                 // |      | |    |        \            /  |     |
 |/       /\      ///   |      | |    | _____   \    /\    /   |     |
 |\      /  \    /      |      | |    | |____|   \  /  \  /    |     |
 | \    /----\  /       |      | |    |           \/    \/   ~~~~~ ~~~~~
 |  \  /      \ ------  ~~~~~~~  ~~~~~
 Banjo Kazooie with Nunchuk - Version .2
Written by Maxx
*/
//
// Set PJ64 to these buttons (Options: Configure Controller Plugin...)
// Analog Stick = Up, Down, Left, and Right Arrow Keys
// Start = S
// Z-Button = z
// R-Button = r
// A-Button = a
// B-Button = b
// L-Button = l
// C-Up = NUMPAD8
// C-Down = NUMPAD5
// C-Left = NUMPAD4
// C-Right = NUMPAD6
//
//
// CONTROLS:
//
// Wiimote:
//
// Shake the wiimote = roll/claw
// D-pad = C buttons
// A =  Jump
// B trigger = Use shield
// Minus = also start
// Home = stop playing
// Plus = Start (/red button in menus)
// 1 = Save State
// 2 = Load State
//
// Nunchuk:
//
// Shake the nunchuk = Dodge
// Analoge stick = movement
// C = L, No function
// Z = Crouch


// Nunchuk movement:
if 2 > Wiimote1.Nunchuk.JoyX > 0.5 then
Right = true
wait 60 ms
Right = false
endif
if -2 < Wiimote1.Nunchuk.JoyX < -0.5 then
left = true
wait 60 ms
left = false
endif
if 2 > Wiimote1.Nunchuk.JoyY > 0.5 then
down = true
wait 60 ms
down = false
endif
if -2 < Wiimote1.Nunchuk.JoyY < -0.5 then
up = true
wait 60 ms
up = false
endif

// Dodge (Not really in game)
if (wiimote.Nunchuk.RawAccX  > 20) then
left    = true
wait 90 ms
left    = false
right   = true
B       = true
wait    10 ms
right = false
B = false
wait           600 ms
wiimote.Rumble = false
endif

// LEDs & rumble during dodge
if (wiimote.Nunchuk.RawAccX  > 20) then
wait 90 ms
wiimote.Rumble = true
wait 20 ms
Wiimote.Led1 = 1
wait 75 ms
Wiimote.Led2 = 1
wait 75 ms
Wiimote.Led3 = 1
wait 75 ms
Wiimote.Led4 = 1
wait 75 ms
Wiimote.Led1 = 0
wait 75 ms
Wiimote.Led2 = 0
wait 75 ms
Wiimote.Led3 = 0
wait 75 ms
Wiimote.Led4 = 0
wait 75 ms
wiimote.Rumble = false
endif

// Nunchuck controls
Z = wiimote.Nunchuk.ZButton
l = Wiimote.Nunchuk.CButton

// Wiimote controls:
S = wiimote.Plus
s = wiimote.Minus
r = wiimote.two
f12 = wiimote.home
numpad8 = Wiimote.Up
numpad4 = Wiimote.Left
numpad6 = Wiimote.Right
numpad2 = Wiimote.Down
a = Wiimote.A
f5 = wiimote.One
f7 = Wiimote.two
endif

// Led control on attack, attack code
if (wiimote.RelAccX > 25) or (wiimote.RelAccY > 25) or (wiimote.RelAccZ > 15) then
B = true
wiimote.Rumble = true
wiimote.led1 = 1
wiimote.led3 = 1
wait 120 ms
wiimote.led2 = 1
wiimote.led4 = 1
wiimote.led1 = 0
wiimote.led3 = 0
wait 120 ms
wiimote.led2 = 0
wiimote.led4 = 0
wait 60 ms
B = false
wait 100 ms
wiimote.Rumble = false
endif
// Yeah. I hope you liked it.
Back to top
View user's profile Send private message
Bohlio



Joined: 03 Feb 2008
Posts: 19

Digg It
PostPosted: Mon Feb 11, 2008 2:46 am    Post subject:

Heres my script for LOTR- Return of The King, Uses motion sensing and the nunchuck. Swing the sword left or right for a quick attack, down for a fierce attack, Jab the butt of the wiimote down to stab, etc... Try it out and tell me what you think! Very Happy
Code:
// Lord of the Rings - Return of the King Wiimote script
//Version 1.0
//For use with GlovePIE version 0.30
//By Bohlio

//I haven't dealt with the multiplayer controls,
//but you should be fine if the second player is using a controller

//-The Wiimote Dpad is for menu navigation
//-Nunchuck joystick is your movement and mouse movement, B is to click
//-Swing the Wiimote left or right for a quick attack (B works also)
//-Swing the Wiimote down for a Fierce Attack, (A) to Power Fierce attack
//-Hold the wiimote vertical (ir sensor up) and Jab the wiimote down
//for a killing attack (Like you are stabbing a sword down)
//-Push the Nunchuck Forward for a physical attack (like Link's Shield attack)
//-Shake the Nunchuk to parry
//-Swing the Nunchuck up to jump backwards
//-Hold Z and Pull the Trigger (B) to fire your ranged weapon
//-Press C for Action
//-Press 1 for your special ability
//-Press Home to pause or go back
//- plus and minus control volume
// press 2 to change which Leds are on, default is none

//---In Game Settings---
//These are the Default values, clicking reset will return to them.
//please make sure they are set in-game

//W - Move Forward
//A - Move Left
//S - Move Backward
//D - Move Right
//NUM 2 or LMB - Speed Attack
//NUM 8 or RMB- Fierce Attack
//NUM 6 - Physical Attack
//NUM 4 - Parry
//Spacebar - Killing Move
//Left Shift - Equip Ranged Weapon
//Tab - Jump Back
//E - Action
//F5 - Special Ability
//Esc - Pause/back

// Here's the script feel free to edit it if you know what you're doing!
//Menu Navigation
Key.Escape = Wiimote.Home
Key.Up = Wiimote.Up
Key.Down = Wiimote.Down
Key.Left = Wiimote.Left
Key.Right = Wiimote.Right


//Nunchuck Movement
mouse.DirectInputX = mouse.DirectInputX + 10*deadzone(Nunchuk.JoyX)
mouse.DirectInputY = mouse.DirectInputY + 10*deadzone(Nunchuk.JoyY)
If Nunchuk.JoyX >= .25 then
Keyboard.D = True
else
Keyboard.D = False
endif
If Nunchuk.JoyY >= .25 then
Keyboard.s = True
else
Keyboard.s = False
endif
If Nunchuk.JoyX <= -.25 then
Keyboard.A = True
else
Keyboard.A = False
endif
If Nunchuk.JoyY <= -.25 then
Keyboard.w = True
else
Keyboard.w = False
endif

//The Quick Attack
If abs(Wiimote.RawAccX) >= 25 then
press(mouse.LeftButton)
wait 50ms
release(mouse.LeftButton)
endif
mouse.LeftButton = wiimote.B


//The Fierce Attack
If Wiimote.RawAccY <= -25 then
press(mouse.RightButton)
wait 50ms
release(mouse.RightButton)
endif
Mouse.RightButton = wiimote.A

//The Killing Move
If Wiimote.RawAccZ <= -4 and wiimote.pitch>=40 then
press(keyboard.Space)
wait 50ms
release(keyboard.Space)
endif

//The Physical Attack
If Nunchuk.RawAccZ >= 20 then
press(keyboard.NUMPAD6)
wait 50ms
release(keyboard.NUMPAD6)
endif

//The Parry
If Nunchuk.RawAccX >= 20 then
press(keyboard.NUMPAD4)
wait nunchuk.RawAccY <=-10
release(keyboard.NUMPAD4)
endif


//Jump Backwards
If nunchuk.RawAccY >=30 then
press(key.Tab)
wait 50ms
release(key.Tab)
endif


//Action Button
key.E = nunchuk.CButton

//Ranged Weapon
Key.LeftShift = nunchuk.ZButton

//Special move
Key.F5 = wiimote.One

//Volume Control
Key.VolumeDown = Wiimote.Minus
Key.VolumeUp = Wiimote.Plus

//Led control, changes every time you press "2"
wiimote.Leds = var.leds + 1
if wiimote.Two = true then
var.leds = var.leds+1
wait 200ms
endif
if var.leds = 16 then
var.leds = 0
endif

//Wiimote Battery Display
//by J.Coulston
// Modified by Carl Kenner for GlovePIE 0.25
var.Batt = wiimote.Battery / 48
// Debug
debug = "Battery level: " + 100*48*var.Batt/192 + "%"
Back to top
View user's profile Send private message
IceDrizzle



Joined: 20 Feb 2008
Posts: 1

Digg It
PostPosted: Wed Feb 20, 2008 2:31 am    Post subject: N64 Classic Controller

Anyone know of a script that allows the user to use the Classic Controller to operate Project64, including the joystick use? Preferably without the use of ppjoy... Also, in people's opinion, is the use of the nunchuck a more natural match than the classic controller?
Back to top
View user's profile Send private message Send e-mail AIM Address
Display posts from previous:   
Post new topic   Reply to topic    WiiLi.org Forum Index -> GlovePie All times are GMT
Goto page Previous  1, 2, 3 ... 43, 44, 45 ... 53, 54, 55  Next
Page 44 of 55

 
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