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 1, 2, 3 ... 45, 46, 47  Next
 
Post new topic   Reply to topic    WiiLi.org Forum Index -> GlovePie
View previous topic :: View next topic  
Author Message
LiquidIce



Joined: 22 Nov 2006
Posts: 36

Digg It
PostPosted: Tue Dec 05, 2006 4:14 pm    Post subject: GlovePIE Wii-Mote Scripts

I thought it would be a good idea to have a dedicated thread for the Wii-Mote scripts everyone has created so far for GraphPIE. If you have new ones to add or want to update the ones I've posted here, just reply to this post with the new scripts.

Mouse Movement
Provided by Blackfrog/Octovir:

Code:

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

if wiimote.Up then
Mouse.WheelUp = true
wait 120 ms
Mouse.WheelUp = false
endif
if wiimote.Down then
Mouse.WheelDown = true
wait 120 ms
Mouse.WheelDown = false
endif
if wiimote.Left then
Mouse.WheelLeft = true
wait 120 ms
Mouse.WheelLeft = false
endif
if wiimote.Right then
Mouse.WheelRight = true
wait 120 ms
Mouse.WheelRight = false
endif

Mouse.RightButton = Wiimote.A
Mouse.LeftButton = Wiimote.B

Mouse.MiddleButton = Wiimote.Home
if Wiimote.Plus then
if var.osk= false then
Execute("osk")
var.osk = true
wait 300 ms
endif
endif
if Wiimote.Minus then
if var.osk = true then
ExitProgram
wait 300 ms
var.osk= false
endif
endif

if wiimote.one then
wiimote.leds = wiimote.leds + 1
if(wiimote.Leds>15)
wiimote.Leds=15
endif
wait 120 ms
endif
if wiimote.two then
wiimote.leds = wiimote.leds - 1
if(wiimote.Leds<0)>
wiimote.leds = 0
endif
wait 120 ms
endif

// set these to the offsets when the wiimote is at rest
// will be different for each wiimote most likely
var.x = Wiimote.RawForceX +12 //trim to 0
var.y = Wiimote.RawForceY -37 // trim to 0
var.z = Wiimote.RawForceZ +12 //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



Code for playing FPS Games
Posted by Kasten

Code:

/* NOTE for this code to work right with the wiimote please
   read the following                                      */

// 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.xOffset = 0
var.yOffset = 0
var.zOffset = 0


// Change this if you would like your mouse to go faster
var.speed = 1

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


var.xRot = Wiimote.RawForceX + var.xOffset
var.yRot = Wiimote.RawForceY + var.yOffset
var.zRot = Wiimote.RawForceZ + var.zOffset

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

// This is the code that moves your mouse
if var.xRot > var.xCutoff then mouse.x = mouse.x - .001 * var.speed * (var.xRot - var.xCutoff)
if var.xRot < -var.xCutoff then mouse.x = mouse.x - .001 * var.speed * (var.xRot + var.xCutoff)
if var.zRot > var.zCutoff then mouse.y = mouse.y - .001 * var.speed * (var.zRot - var.zCutoff)
if var.zRot < -var.zCutoff then mouse.y = mouse.y - .001 * var.speed * (var.zRot + var.zCutoff)

/* The following is for turning wii button presses into keyboard presses and mouse clicks */
// WASD for fsp games
w = Wiimote.Up
s = Wiimote.Down
a = Wiimote.Left
d = Wiimote.Right

// Press 1 on the wiimote to press e on the keyboard
e = Wiimote.One
// Press 2 on the wiimote to press control on the keyboard
control = Wiimote.Two

// B for left click and A for right click
mouse.LeftButton = Wiimote.B
mouse.RightButton = Wiimote.A

// Plus and Minus on the wiimote to use the scroll wheel
// get for scrolling though weapens in fsp games
mouse.WheelUp = Wiimote.Plus
mouse.WheelDown = Wiimote.Minus


// Rumbles wiimote when shift is pressed on your keyboard
Wiimote.Rumble = Shift

// Have some fun and press 1, 2, 3, and/of 4 to little up the lights on the wiimote
Wiimote.Led1 = four
Wiimote.Led2 = three
Wiimote.Led3 = two
Wiimote.Led4 = one

// If you move your controler up and down quickly then it will press space
// Great for jumping on games
if var.yRot >= 100 then space = true else space = false



NES Controller (for virtualnes, etc)
posted by llamawoot
Code:

if wiimote.Up then
Key.left = true
wait 60 ms
Key.left = false
endif
if wiimote.Down then
Key.right = true
wait 60 ms
Key.right = false
endif
if wiimote.Left then
Key.down = true
wait 60 ms
Key.down = false
endif
if wiimote.Right then
Key.up = true
wait 60 ms
Key.up = false
endif
if wiimote.one
key.Z = true
wait 60 ms
key.Z = false
ENDIF
if wiimote.Two
key.x = true
wait 60 ms
key.x = false
endif
if wiimote.Plus
key.enter = true
wait 60 ms
key.enter = false
endif
if wiimote.Minus
key.Ctrl = true
wait 60 ms
key.ctrl= false
endif

_________________
-LiquidIce

LiquidIce's Wii Hacks
http://wiihacks.blogspot.com
Back to top
View user's profile Send private message
bmxr



Joined: 30 Nov 2006
Posts: 19
Location: Vancouver Canada

Digg It
PostPosted: Tue Dec 05, 2006 9:25 pm    Post subject:

Heres Mine For Need For Speed. Kinda Hack Way to make it work.
Ps Hold Controller sideway just like Excite Truck and NFS Carbon for wii

Code:

//NEED FOR SPEED MOST WANTED
/* NOTE for this code to work right with the wiimote please
   read the following                                      */

// 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.xOffset = 4
var.yOffset = -2
var.zOffset = 6

// 1st player led on so you know it's running
Wiimote.leds = 1


// Change this if you would like your mouse to go faster
var.speed = 1

// change these to a higher number if your hands are not steady or lower if they are
var.zCutoff1 = 4
var.zCutoff2 = 8
var.zCutoff3 = 15


var.xRot = Wiimote.RawForceX + var.xOffset
var.yRot = Wiimote.RawForceY + var.yOffset
var.zRot = Wiimote.RawForceZ + var.zOffset

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

// Car Movement
if var.zRot > var.zCutoff3 then
key.right = true
key.left = true
key.left = false
wait 20ms
key.right = false
else if var.zRot < -var.zCutoff3 then
key.left = true
key.right = true
key.right = false
wait 20ms
key.left = false
else if var.zRot > var.zCutoff2 then
key.right = true
key.left = true
key.left = false
wait 12ms
key.right = false
else if var.zRot < -var.zCutoff2 then
key.left = true
key.right = true
key.right = false
wait 12ms
key.left = false
else if var.zRot > var.zCutoff1 then
key.right = true
key.left = true
key.left = false
wait 2ms
key.right = false
else if var.zRot < -var.zCutoff1 then
key.left = true
key.right = true
key.right = false
wait 2ms
key.left = false
else
key.left = True
key.right = True
key.left = false
key.right = false
endif

l= Wiimote.Up                             //look behind
key.FakeRightCtrl = Wiimote.Down          //speedbreaker
key.space = Wiimote.Left                  //HandBrake
key.alt = Wiimote.Right                   //nitrous

key.down = Wiimote.One                   // Press 1 = accel
key.up = Wiimote.Two                      // Press 2  = brake/reverse

key.enter = Wiimote.B                     //enter
t = Wiimote.A                             //song change

c = Wiimote.Plus                          //change view
r = Wiimote.Minus                          //reset car

key.Escape = Wiimote.Home                  //escape


// Useless but fun
Wiimote.Rumble = Shift

_________________
www.ipodlinux.org/User:bmxr
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Marauding Master



Joined: 11 Dec 2006
Posts: 56
Location: :3!

Digg It
PostPosted: Mon Dec 11, 2006 2:30 am    Post subject:

Ladies only
(Made myself)

Code:
//Wii-brator
//
//Wii-brator, something I flipped together in a few seconds. Simple, yet affective.
//Designed for the ladies, won't do anything funny with your mouse so you can still
//browse the net while using your Wii-brator.
//
//Have fun!
//
//Made by Marauding Master
// depthcon@gmail.com

//If you want a timer for example because you're in a rush then remove the "var.rmbl= false"
//value and replace the 5 second timer with anything (600 for 10 minutes).
if var.rmbl = false
wiimote.Rumble = 1
wait 5 s
wiimote.Rumble = 0
endif
var.rmbl = true
var.rmbl = false
endif
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Xarath



Joined: 12 Dec 2006
Posts: 6
Location: In front of the Wii

Digg It
PostPosted: Tue Dec 12, 2006 3:04 am    Post subject:

Very Simple Windows Media Player Control
By Xarath

Code:

//Wiimote WMP Control
//Created By Xarath
//Windows Media Player must be the front window while using this! This
//is very basic and is meant for you coding-impared.  ;)
//
//Controls:
// Plus - Next Song
// Minus - Previous Song
// Home - Play/Pause
// Left - Volume down
// Right - Volume up
// Up - Speed Up
// Down - Slow down
// A - Normal Speed
// B - No use.
// 1 - Turns on rumble
// 2 - Turns off rumble


Control && F = Wiimote.Plus
Control && B = Wiimote.Minus
CTRL && P = Wiimote.Home
F9 = Wiimote.Left
F10 = Wiimote.Right
Control && Shift && N = Wiimote.A
Control && Shift && G = Wiimote.Up
Control && Shift && S = Wiimote.Down

If Wiimote.one then

Wiimote.Led1 = true
Wiimote.Led2 = true
Wiimote.Led3 = true
Wiimote.Led4 = true

wiimote.Rumble = 1
endif
//wait 50000 ms
//wiimote.Rumble = 0
If wiimote.two then

Wiimote.Led1 = false
Wiimote.Led2 = false
Wiimote.Led3 = false
Wiimote.Led4 = false

wiimote.Rumble = 0
endif
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
deceased
Site Admin


Joined: 11 Dec 2006
Posts: 287
Location: Aurora, ON

Digg It
PostPosted: Tue Dec 12, 2006 4:23 am    Post subject:

Like Marauding Master I also wrote Wiibrator code...lol


here's mine

Code:

//Wiibrator
//By deceased

// Does not control mouse so feel free to surf ^^

// D pad up turns it on
// D pad down turns it off
if wiimote.Up
  wiimote.Rumble = 1
endif
if wiimote.Down
  wiimote.Rumble = 0
endif

_________________
-deceased-

Wiili - a gnu revolution
Back to top
View user's profile Send private message
deceased
Site Admin


Joined: 11 Dec 2006
Posts: 287
Location: Aurora, ON

Digg It
PostPosted: Tue Dec 12, 2006 4:30 am    Post subject:

This is WiiMouse IR code I got from vkapadia on December 9th and I find much more respondent then the one posted above.

Code:

//Mouse Control Script using IR
//by vkapadia with much assistance from inio
//vkapadia@vkapadia.com
//
//Calibration:
//To calibrate, run this program and put the Wiimote on a flat surface face-up.
//Then read the values in the debug line (next to the run button).
//Change these values until the debug line reads approx. all zeros.
var.xtrim = 4
var.ytrim = -30
var.ztrim = 6
//
//Options:
var.KITTspeed = 100 ms //delay speed for flashing LEDs. higher = slower
var.rumble = false //makes the wiimote rumble if you hit the edge of the screen
//more options to be added later

//Controls:
//Point Wiimote = Move Mouse
//D-Pad = Arrow Keys
//B-Button = Left Click
//Home = Middle Click
//A-Button = Right Click
//Plus and Minus = Control Volume
//One = close (alt+f4)
//Two = switch window (alt+tab)
//
//If the pointer hits the edge of the screen, the Wiimote will rumble a bit.
//
//The LEDs attempt to emulate KITT's grill from Knight Rider

//***Do not edit anything below this line unless you know what you are doing.***

//Set the D-Pad to function as the Arrow Keys
if wiimote.Up
  Up = true
else
  Up = false
endif
if wiimote.Down
  Down = true
else
  Down = false
endif
if wiimote.Left
  Left = true
else
  Left = false
endif
if wiimote.Right
  Right = true
else
  Right = false
endif

//Mouse Buttons
Mouse.RightButton = Wiimote.A
Mouse.LeftButton = Wiimote.B
Mouse.MiddleButton = Wiimote.Home

//Plus and Minus handle Volume
if wiimote.plus then
  volumeup = true
  wait 60 ms
  volumeup = false
endif
if wiimote.minus then
  volumedown = true
  wait 60 ms
  volumedown = false
endif

// added by deceased (these weren't originally mapped)
(Alt + F4) = wiimote.One
(Alt + Tab) = wiimote.Two

//LEDs look somewhat like KITT's grill from Knight Rider
if 0 = 0 then
  if var.kitt = 0 then
    wiimote.Leds = 1
  endif
  if var.kitt = 1 then
    wiimote.Leds = 3
  endif
  if var.kitt = 2 then
    wiimote.Leds = 6
  endif
  if var.kitt = 3 then
    wiimote.Leds = 12
  endif
  if var.kitt = 4 then
    wiimote.Leds = 8
  endif
  if var.kitt = 5 then
    wiimote.Leds = 12
  endif
  if var.kitt = 6 then
    wiimote.Leds = 6
  endif
  if var.kitt = 7 then
    wiimote.Leds = 3
  endif
  wait var.KITTspeed
  var.kitt = (var.kitt + 1) % 8
endif

//If the mouse reaches the end, rumble for 200 milliseconds
if var.rumble and (mouse.x = 0 or mouse.x = 1 or mouse.y = 0 or mouse.y = 1) then
  if var.rmbl = false
    wiimote.Rumble = 1
    wait 200 ms
    wiimote.Rumble = 0
  endif
  var.rmbl = true
else
  var.rmbl = false
endif

var.accx = wiimote.RawForceX + var.xtrim
var.accy = wiimote.RawForceY + var.ytrim
var.accz = wiimote.RawForceZ + var.ztrim

if wiimote.dot1vis and wiimote.dot2vis then

  if var.accy > -7 then
    var.orientation = 0
  elseif var.accy > -45 then
    if var.accx < 0 then
      var.orientation = 3
    else
      var.orientation = 1
    endif
  else
    var.orientation = 2
  endif

  if var.leftpoint = 0 then
    if var.orientation = 0 then
      if wiimote.dot1x < wiimote.dot2x then
        var.leftpoint = 1
      else
        var.leftpoint = 2
      endif
    endif
    if var.orientation = 1 then
      if wiimote.dot1y > wiimote.dot2y then
        var.leftpoint = 1
      else
        var.leftpoint = 2
      endif
    endif
    if var.orientation = 2 then
      if wiimote.dot1x > wiimote.dot2x then
        var.leftpoint = 1
      else
        var.leftpoint = 2
      endif
    endif
    if var.orientation = 3 then
      if wiimote.dot1y < wiimote.dot2y then
        var.leftpoint = 1
      else
        var.leftpoint = 2
      endif
    endif
  endif

  if var.leftpoint = 1 then
    var.fix1x = wiimote.dot1x
    var.fix1y = wiimote.dot1y
    var.fix2x = wiimote.dot2x
    var.fix2y = wiimote.dot2y
  else
    var.fix1x = wiimote.dot2x
    var.fix1y = wiimote.dot2y
    var.fix2x = wiimote.dot1x
    var.fix2y = wiimote.dot1y
  endif

  var.dx = var.fix2x - var.fix1x
  var.dy = var.fix2y - var.fix1y
  var.cx = (var.fix1x+var.fix2x)/1024.0 - 1
  var.cy = (var.fix1y+var.fix2y)/1024.0 - .75

  var.d = sqrt(var.dx*var.dx+var.dy*var.dy)

  var.dx = var.dx / var.d
  var.dy = var.dy / var.d

  var.ox = -var.dy*var.cy-var.dx*var.cx;
  var.oy = -var.dx*var.cy+var.dy*var.cx;

  var.ax = (var.ox * screen.desktopwidth) + (screen.desktopwidth / 2)
  var.ay = (-var.oy * screen.desktopwidth) + (screen.desktopheight / 2)




  var.dx = var.ax - mouse.cursorposx
  var.dy = var.ay - mouse.cursorposy

  var.d = sqrt((var.dx*var.dx)+(var.dy*var.dy))

  var.a = 180 / (200 + var.d * var.d * var.d * .001)

  var.finalx = mouse.cursorposx * var.a + var.ax * (1 - var.a)
  var.finaly = mouse.cursorposy * var.a + var.ay * (1 - var.a)


  mouse.cursorposx = var.finalx
  mouse.cursorposy = var.finaly

else

  var.leftpoint = 0

endif

debug = var.accx + " " + var.accy + " " + var.accz
// COMPILED CODE, PLEASE DELETE BEFORE COMPILING!

_________________
-deceased-

Wiili - a gnu revolution
Back to top
View user's profile Send private message
STKD



Joined: 12 Dec 2006
Posts: 16

Digg It
PostPosted: Tue Dec 12, 2006 3:45 pm    Post subject:

Reasonably intuitive script for controlling Winamp...

Code:
//Winamp Wiimote Test aka Wiinamp Control Ultra II Turbo Edition

//Controls set to Wiimote buttons

Ctrl+z = Wiimote.Up        //Start of playlist       (D-pad up)
Ctrl+b = Wiimote.Down      //End of playlist       (D-pad down)
Left = Wiimote.Left        //Back 5 seconds       (D-pad left)
Right = Wiimote.Right      //Jump 5 seconds       (D-pad right)
x = Wiimote.A              //Play          (Main "A" button on Wiimote)
Shift+v = Wiimote.B        //Stop          (Song fades out,"B" button on Wiimote)
b = Wiimote.One            //Next track       ("1" button on Wiimote)
z = Wiimote.Two            //Previous track       ("2" button on Wiimote)
v = Wiimote.Home           //Stop          (Stop, "Home" button on Wiimote)
Down = Wiimote.Minus       //Volume Down       ("-" button on Wiimote)
Up = Wiimote.Plus          //Volume Up          ("+" button on Wiimote)

//No power in the 'Verse can stop me
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    WiiLi.org Forum Index -> GlovePie All times are GMT
Goto page 1, 2, 3 ... 45, 46, 47  Next
Page 1 of 47

 
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