masterameel
Joined: 01 Sep 2008 Posts: 2
Digg It |
Posted: 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] |
|