Page 1 of 1

Second mouse click

PostPosted: Fri Apr 06, 2007 8:40 pm
by Caaz Games
Does anyone know whats wrong with this code?
Mouse Button Down > Script Editor
Code: Select all
ChangeAnimation("Event Actor", "StartD", FORWARD);
AllReadyUp = 1;
if(AllReadyUp)
{
    ChangeAnimation("Event Actor", "StartU", FORWARD);
    AllReadyUp = 0;
}
I need it to change the animation when i click on it, and when i click on it again it will change back. but it doesn't work, no error messege shows up but the second mouse click doesn't work. What am i doing wrong?

Re: Second mouse click

PostPosted: Fri Apr 06, 2007 8:54 pm
by Sgt. Sparky
__CAAZ__ wrote:Does anyone know whats wrong with this code?
Mouse Button Down > Script Editor
Code: Select all
ChangeAnimation("Event Actor", "StartD", FORWARD);
AllReadyUp = 1;
if(AllReadyUp)
{
    ChangeAnimation("Event Actor", "StartU", FORWARD);
    AllReadyUp = 0;
}
I need it to change the animation when i click on it, and when i click on it again it will change back. but it doesn't work, no error messege shows up but the second mouse click doesn't work. What am i doing wrong?

make it this
Code: Select all
if(AllReadyUp == 1)
{
    ChangeAnimation("Event Actor", "StartU", FORWARD);
    AllReadyUp = 0;
{
ChangeAnimation("Event Actor", "StartD", FORWARD);
AllReadyUp = 1;

:D
hope that helps,
you had it if AllReadyUP,
you did not define what you wanted it to be. :)

Re: Second mouse click

PostPosted: Fri Apr 06, 2007 9:04 pm
by makslane
Code: Select all
if(AllReadyUp)
{
    //Second click
    ChangeAnimation("Event Actor", "StartU", FORWARD);
    AllReadyUp = 0;
}
else
{
   //First click
   ChangeAnimation("Event Actor", "StartD", FORWARD);
   AllReadyUp = 1;
}

PostPosted: Fri Apr 06, 2007 9:50 pm
by Sgt. Sparky
you could just put the if it is 0 on the bottom and if it is 1 on the top(see my code) :D

PostPosted: Fri Apr 06, 2007 11:04 pm
by Kodo
Caaz, you had..
Code: Select all
AllReadyUp = 1;
if(AllReadyUp == 1)
{

So AllReadyUp is always 1 when you test it, which makes the IF statement completely redundant!!