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 

Very stupid GlovePie scripting problem.

 
Post new topic   Reply to topic    WiiLi.org Forum Index -> Wii Remote and Nunchuck
View previous topic :: View next topic  
Author Message
Stu L Tissimus



Joined: 19 Dec 2006
Posts: 12

Digg It
PostPosted: 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
View user's profile Send private message
squeakypants



Joined: 09 Nov 2006
Posts: 99

Digg It
PostPosted: 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
View user's profile Send private message AIM Address MSN Messenger
swimgod



Joined: 30 Nov 2006
Posts: 34

Digg It
PostPosted: 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 Smile
(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 Smile
Back to top
View user's profile Send private message
Mienaikage



Joined: 13 Dec 2006
Posts: 54
Location: London, UK

Digg It
PostPosted: 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
View user's profile Send private message Visit poster's website
CarlKenner
Site Admin


Joined: 29 Nov 2006
Posts: 614

Digg It
PostPosted: 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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    WiiLi.org Forum Index -> Wii Remote and Nunchuck 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