| View previous topic :: View next topic |
| Author |
Message |
The Tjalian

Joined: 14 Dec 2006 Posts: 31 Location: England
Digg It |
Posted: Wed Dec 20, 2006 9:24 pm Post subject: One stupidly small question |
|
|
I can't believe I'm asking this, being a programmer and all, but how do you create variables using GlovePIE? It's just I need to make one for this script I'm using but I don't even know how to bloody declare one
Many thanks in advance. _________________
 |
|
| Back to top |
|
 |
reik85
Joined: 14 Dec 2006 Posts: 18 Location: OKC, OK
Digg It |
Posted: Wed Dec 20, 2006 9:48 pm Post subject: |
|
|
Just add a good ol' "var." , add the name and what it is equal to. For example: var.xOffset = -7
Tis that simple. I do believe it's not case sensitive. There's a whole thread of scripts in the WiiMote and Nunchuk section of the forums. |
|
| Back to top |
|
 |
deceased Site Admin

Joined: 11 Dec 2006 Posts: 287 Location: Aurora, ON
Digg It |
Posted: Wed Dec 20, 2006 10:57 pm Post subject: |
|
|
Also, you don't need to declare the variables. They are created the first time they're used and set to false (0) by default.
However, if you want to make declarations use this
| Code: |
if not var.declared then
var.declared = true
// initiate all the variables you want here
var.x = 1
var.y = 20
endif |
_________________ -deceased-
Wiili - a gnu revolution |
|
| Back to top |
|
 |
The Tjalian

Joined: 14 Dec 2006 Posts: 31 Location: England
Digg It |
Posted: Wed Dec 20, 2006 11:34 pm Post subject: |
|
|
Oh, it's not that I specifically want to declare variables, I just thought that was the way things were done
One more Q, when doing an if statement, is it asking is a button is pressed or a button is held? _________________
 |
|
| Back to top |
|
 |
deceased Site Admin

Joined: 11 Dec 2006 Posts: 287 Location: Aurora, ON
Digg It |
Posted: Thu Dec 21, 2006 12:05 am Post subject: |
|
|
Press, but it's easier to map a button like this
So, every time you hit A on the Wiimote, it's like X is being pressed on the keyboard.
Or you can write...
| Code: |
if wiimote.A then
X = true
wait 10 ms
X = false
endif |
This should make it like you're pressing A on the Wiimote over and over. (I think, can't test it, but you can .) _________________ -deceased-
Wiili - a gnu revolution |
|
| Back to top |
|
 |
The Tjalian

Joined: 14 Dec 2006 Posts: 31 Location: England
Digg It |
Posted: Thu Dec 21, 2006 12:35 am Post subject: |
|
|
Oh no, I actually WANT it to act like it's being pressed, not held XD
If it was being held, it'd totally ruin my plans  _________________
 |
|
| Back to top |
|
 |
deceased Site Admin

Joined: 11 Dec 2006 Posts: 287 Location: Aurora, ON
Digg It |
Posted: Thu Dec 21, 2006 12:39 am Post subject: |
|
|
Still, try out the code above and see what works for you. _________________ -deceased-
Wiili - a gnu revolution |
|
| Back to top |
|
 |
|