| View previous topic :: View next topic |
| Author |
Message |
Stu L Tissimus
Joined: 19 Dec 2006 Posts: 12
Digg It |
Posted: Tue Dec 19, 2006 3:33 am Post subject: Very stupid GlovePie scripting problem. |
|
|
(There should really be a GP scripts forum, dontcha think?)
Anyway, I've been playing around with the program and bumped into a stupid problem that I can't for the life of me figure out. I'm trying to make a script for the N64 Zelda games with a Twilight Princess-esque setup for the C buttons (clicking the direction sets it to B, doesn't actually use it). Problem is, things that I put in if statements only happen while the if statement's condition is fulfilled; otherwise they revert to normal. For instance, see this:
| Code: | if (wiimote.Down)
NUMPAD4 = wiimote.Left
NUMPAD6 = wiimote.Right
NUMPAD2 = wiimote.B
//debug = "Inside if statement. NUMPAD2 is " + NUMPAD2
endif
debug = "Outside if statement. NUMPAD2 is " + NUMPAD2
|
Now, NUMPAD2 will only be true if I'm still holding Down. If I use B without it, nothing happens. Any ideas? |
|
| Back to top |
|
 |
squeakypants
Joined: 09 Nov 2006 Posts: 99
Digg It |
Posted: Tue Dec 19, 2006 3:41 am Post subject: |
|
|
When you can't use the "=" format and you need to use a conditional, you have to use the pressed function.
| Code: | if (pressed(wiimote.Down) = true) {
NUMPAD4 = wiimote.Left;
NUMPAD6 = wiimote.Right;
NUMPAD2 = wiimote.B;
//debug = "Inside if statement. NUMPAD2 is " + NUMPAD2
}
debug = "Outside if statement. NUMPAD2 is " + NUMPAD2; |
|
|
| Back to top |
|
 |
swimgod
Joined: 30 Nov 2006 Posts: 34
Digg It |
Posted: Tue Dec 19, 2006 4:42 am Post subject: Re: Very stupid GlovePie scripting problem. |
|
|
| Code: | if (wiimote.Down)
NUMPAD4 = wiimote.Left
NUMPAD6 = wiimote.Right
NUMPAD2 = wiimote.B
//debug = "Inside if statement. NUMPAD2 is " + NUMPAD2
endif
debug = "Outside if statement. NUMPAD2 is " + NUMPAD2
|
the only thing wrong with this script is the fact that you are not using a
'switch'
| Code: |
if (wiimote.Down)
if(var.mode == "down")then
var.mode = "normal";
else
var.mode = "down";
endif
wait 100ms;
endif
if(var.mode == "down")then
NUMPAD4 = wiimote.Left
NUMPAD6 = wiimote.Right
NUMPAD2 = wiimote.B
//debug = "Inside if statement. NUMPAD2 is " + NUMPAD2
endif
debug = var.mode + NUMPAD2
|
hope this helps
(if your wondering why there is a wait, it is because if you press down it will press it more then once so the wait makes a click flip it only once  |
|
| Back to top |
|
 |
Mienaikage
Joined: 13 Dec 2006 Posts: 54 Location: London, UK
Digg It |
Posted: Tue Dec 19, 2006 5:35 am Post subject: Re: Very stupid GlovePie scripting problem. |
|
|
| Stu L Tissimus wrote: | | (There should really be a GP scripts forum, dontcha think?) |
We do have a Wii Scripts section on the board. |
|
| Back to top |
|
 |
CarlKenner Site Admin
Joined: 29 Nov 2006 Posts: 614
Digg It |
Posted: Tue Dec 19, 2006 10:29 am Post subject: |
|
|
Your message is very hard to understand.
I'm guessing what you want is to set a variable, like this:
| Code: | if not var.initialized then
var.initialized = true
// initialize state
var.state = 0
end if
if pressed(Wiimote.Down) then var.state = 1
if pressed(Wiimote.Up) then var.state = 2
if var.state = 1 then
NUMPAD4 = wiimote.Left
NUMPAD6 = wiimote.Right
NUMPAD2 = wiimote.B
end if
if var.state = 2 then
NUMPAD4 = wiimote.Left
NUMPAD6 = wiimote.Right
NUMPAD8 = wiimote.B
end if
debug = NUMPAD2 +', '+ NUMPAD8
|
|
|
| Back to top |
|
 |
|