Jump to content

Photo

Trying to get multiple ifs working


  • Please log in to reply
3 replies to this topic

#1 Plissken

Plissken

    What's with these homies dissing our girls?

  • Members

Posted 30 July 2008 - 12:36 AM

CODE
ffc script Menus{
    void run(int options){
        int y = 16;        
        this->Y = y;
            if(options == 2);
                while(this->Y < 32){
                    if(Link->InputDown){
                        this->Y += 16;}
                    Waitframes(30);
                    }
                if(options == 3);
                    while(this->Y < 48){
                        if(Link->InputDown){
                            this->Y += 16;}
                        Waitframes(30);
                        }                    
            Waitframe();
        }            
}


Ok, you see where it says: if(options == X); ?
I want that to be if D0 equals 2 than the while loop underneath if(options == 2); to be carried out. Same goes for if D0 equals 3 and the if(options == 3);

But I can't get anything but the bottom one to work, if D0 equals 2 than it still does the while loop underneath if(options == 3);

I know I'm most likely just forgetting or misplacing some brackets or something so if anybody could help me out on this that'd be awesome. Oh and yes Gleeok I'm trying to make a sorta menu script for shops and stuff like your main menu in Gika...gah your arcade game.

I'm still in the newbie sorta era of scripting so if you see anything that could easily be done better please tell me. I'm trying to get an FFC to move down 16 pixels every time you press down but stop at a certain place depending on your information in D0. (The number of options this specific menu will have)

#2 LinktheMaster

LinktheMaster

    Hey Listen, Kid

  • Members
  • Real Name:Matt
  • Location:United States

Posted 30 July 2008 - 07:23 AM

You don't put semi-colons after if-statements. That's basically saying "if this is true... do nothing!" I was thinking ZQuest gave an error for this, but I guess not. icon_razz.gif

#3 lucas92

lucas92

    Defender

  • Members

Posted 30 July 2008 - 07:36 AM

CODE
ffc script Menus
{
    void run(int options)
{
        int y = 16;        
        this->Y = y;
            if(options == 2);
{
                while(this->Y < 32)
{
                    if(Link->InputDown)
{
                        this->Y += 16;
}
                    Waitframes(30);
                    
}
                if(options == 3);
{
                    while(this->Y < 48)
{
                        if(Link->InputDown)
{
                            this->Y += 16;
}
                        Waitframes(30);
}                    
            Waitframe();
}            

}

}

}


It would work like this. The opening braces and closing braces must have the same number to make work the script logically.

And waitframes doesn't work like this, if you want it to wait 30 frames (for example) you must declare a variable (i for example) then do a for loop
(i=0;i=30;i++), then include the waitframes in the for loop.

It would be like that:


CODE
int i;

//copy and past the code below wherever you want to wait 30 frames


for (i=0;i=30;i++)
{
Waitframe();
}

Edited by lucas92, 30 July 2008 - 07:46 AM.


#4 Plissken

Plissken

    What's with these homies dissing our girls?

  • Members

Posted 30 July 2008 - 07:51 AM

Found a better solution at AGN, and yes waitframes does work like that. That part wasn't my problem it worked fine. I'm might be having a little trouble with the InputUp stuff that I'm now trying to do, but I'm gonna fiddle around with it somemore and see what I can get.


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users