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 

Hard Limits on writing GlovePie Scripts?!

 
Post new topic   Reply to topic    WiiLi.org Forum Index -> GlovePie
View previous topic :: View next topic  
Author Message
masterameel



Joined: 01 Sep 2008
Posts: 2

Digg It
PostPosted: Mon Sep 01, 2008 1:25 pm    Post subject: Hard Limits on writing GlovePie Scripts?!

Hi. I was trying to code something so that when hit 1/2 buttons, program for wiimote would change.

For instance, you want to play winamp with wiimote, then u want to play some fps, or afterwards get some good vibes.

You want to do all taht without loading a new script.

I basically copied codes from this thread, so credit goes to the original coders.

Basically I put them together, but i found some hard limits on programming in GlovePie.

First, it seems that wiimote keeps looping signals, or at least there's no proper way to stop GlovePie from processing the codes over and over again. It kinda screw up easy work and turn it into a nightmare.

Also, I can't really writeup a global variable that is changeable. The variables can only be changed, for instance while a button is pressed (have to keep holding the button). Otherwise, the variable goes back to default value it has..

Anyway, even though disappointed, I wrote some code for what i intended with some ways of getting around the problems above - not good ways, very bad actually, but it works for my purposes.


Here's the code.

Can ANYONE please tell me THAT I AM WRONG and there is a simpler way of doing the stuff below that is not dodgy:




Code:

// Type your program here, or click the GUI tab to autogenerate it!

if wiimote.1 then

if wiimote.led1= 0 && wiimote.led2= 0
wiimote.Rumble =1
wait 400ms
wiimote.rumble= 0
wiimote.led1=1

elseif wiimote.led1= 1 && wiimote.led2= 0
wiimote.Rumble =1
wait 400ms
wiimote.rumble= 0
wiimote.led2=1
wiimote.led1=0

endif
endif


if wiimote.2 then

if wiimote.led1= 0 && wiimote.led2= 1
wiimote.Rumble =1
wait 400ms
wiimote.rumble= 0
wiimote.led2=0
wiimote.led1=1

elseif wiimote.led1= 1 && wiimote.led2= 0
wiimote.Rumble =1
wait 400ms
wiimote.rumble= 0
wiimote.led1=0


endif
endif




// Type your program here, or click the GUI tab to autogenerate it!

if wiimote.led1= 0 && wiimote.led2= 0

ctrl+alt+pagedown = wiimote.right
ctrl+alt+pageup = wiimote.left
ctrl+alt+up = wiimote.Plus
ctrl+alt+down = wiimote.minus
ctrl+alt+home = wiimote.A
ctrl+alt+insert = wiimote.B
ctrl+alt+right = wiimote.Up
ctrl+alt+left = wiimote.down

endif


if wiimote.led1= 1 && wiimote.led2= 0
/* 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 = 2.25
var.yOffset = -1.5
var.zOffset = 4.5


// 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 = 7
var.zCutoff = 7


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)


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

// 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


// 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

endif



if wiimote.led2= 1 && wiimote.led1= 0

if wiimote.Up then wiimote.rumble = true
If wiimote.down then wiimote.rumble= false

endif
[/code]
Back to top
View user's profile Send private message
Wreyth



Joined: 03 Nov 2007
Posts: 91

Digg It
PostPosted: Thu Nov 20, 2008 10:22 am    Post subject:

ok first off to do a global complete change you need to do something similar to this.

Code:

  if var.Mode = false && wiimote.Home
   wait 300 ms
   var.Mode = true



else if var.Mode = true && wiimote.Home
     wait 300 ms
   var.Mode = false

    endif
debug = "var = " + var.Mode


try that out notice in the debug window every time you hit it Home on the Wiimote it changes the mode between true and false.

now take that same code and try something like this.
Code:


if var.Mode = false && wiimote.Home
   wait 300 ms
   var.Mode = true



else if var.Mode = true && wiimote.Home
   wait 300 ms
   var.Mode = false

    endif


if var.Mode = true
   a = Wiimote.A

   endif

if var.Mode = false
   b = Wiimote.A

   endif

debug = "var = " + var.Mode


now start the script and open up your notepad notice when you hit Wiimote.A it puts either a or b in depending on the mode and you can switch between modes by hitting home. play with it you can write 2 completely different sets of command and scripts using something like this.

hope that clears some things up and helps you out
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
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