Background speech [SOLVED]

Started by Mouth for war, Tue 02/08/2005 20:24:56

Previous topic - Next topic

Mouth for war

oh of course.

Overlay* speech;
#sectionstart room_a  // DO NOT EDIT OR REMOVE THIS LINE
function room_a() {  // script for Room: Repeatedly execute
if (speech != null) { 
if (!speech.Valid) {   
string text;
int rand = Random(6);
if (rand == 0) StrCopy(text, "Oww...");
else if (rand == 1) StrCopy(text, "My head hurts...");
else if (rand == 2) StrCopy(text, "I shouldn't have drank that last beer...");
else if (rand == 3) StrCopy(text, "I feel like I'm going to puke...");
else if (rand == 4) StrCopy(text, "Where am I?...");
else if (rand == 5) StrCopy(text, "Hic...");
else if (rand == 6) StrCopy(text, "Who are you?...");
speech = cOaf.SayBackground(text);
    }
}
else {
  string text;
  int rand = Random(6);
  if (rand == 0) StrCopy(text, "Oww...");
  else if (rand == 1) StrCopy(text, "My head hurts...");
  else if (rand == 2) StrCopy(text, "I shouldn't have drank that last beer...");
  else if (rand == 3) StrCopy(text, "I feel like I'm going to puke...");
  else if (rand == 4) StrCopy(text, "Where am I?..."); 
  else if (rand == 5) StrCopy(text, "Hic...");
  else if (rand == 6) StrCopy(text, "Who are you?...");
speech = cOaf.SayBackground(text);  }
}
#sectionend room_a  // DO NOT EDIT OR REMOVE THIS LINE

mass genocide is the most exhausting activity one can engage in, next to soccer

monkey0506

Just to clarify on the indentation, the else statement only gets run if speech is null...not if it's Valid.  You should use comment tags to make sure that your indentation is not messed up.  Unless of course that is the same indentation that you used, in which case you should indent better because the way you have it indented it looks like the else statement is run if speech is Valid, not null.

SMF spam blocked by CleanTalk