Need help with "If" and "Else"

Started by Yo Mama!, Tue 03/06/2003 03:09:28

Previous topic - Next topic

Yo Mama!

What would the code be for more than one "IF" in a code? I want it to display a message if the player has 0, a seperate one for 50, and a seperate one for all the ones in between them. Here is what I had, but it didn't work:
if (game.score ==0) DisplaySpeech (CHARID , "Message for 0");
if (game.score ==50) DisplaySpeech (CHARID , "Message for 50");
else {DisplayMessage (19); Wait (10); GiveScore (-1);}  
What should it be?

Gilbert

if (game.score ==0) DisplaySpeech (CHARID , "Message for 0");
else if (game.score ==50) DisplaySpeech (CHARID , "Message for 50");
else {DisplayMessage (19); Wait (10); GiveScore (-1);}

Yo Mama!


Squinky

What about the whole "while" thing. I never have been able to figure that out...

scotch

While just repeats a block of code until a condition is not true, like

i=0
while(i<100) { Does some stuff; i++}

that would do some stuff 100 times.

or you could make it wait while a character is animation with

while(character[ego].animating){Wait(1);}

SMF spam blocked by CleanTalk