Can I stop a script so that it won't continue? (SOLVED)

Started by Merte, Sun 06/09/2009 13:07:33

Previous topic - Next topic

Merte

I'm looking for a command that simply breaks out of the current script, so that it won't continue on from that point. Is there a command that will do this?
I've posted my script here:


function region1_WalksOnto()
{
if (TalkedGuard2 == 0){
  cEgyptGuard2.Say("Hey!");
  cLeif.Walk(284, 114, eBlock, eWalkableAreas);
  cLeif.FaceCharacter(cEgyptGuard2, eBlock);
  cEgyptGuard2.Say("You can't enter the royal palace."); 
  cLeif.Say("Why not?");
  cEgyptGuard2.Say("Because you're not important.");
  cEgyptGuard2.Say("Only important people can enter her Majesty's royal palace. That's the rule.");
  cLeif.Say("Who's important then?");
  cEgyptGuard2.Say("Oh... you know... the usual:");
  cEgyptGuard2.Say("Aristocrats; wealthy traders; diplomats; couriers, regents of foreign lands and, of course, licenced preachers of any major or minor religion.");
  cLeif.Say("Preachers?");
  cEgyptGuard2.Say("*Sigh!*");
  cEgyptGuard2.Say("Yes.");
  cEgyptGuard2.Say("Her Majisty is, regrettably, indecently open-minded concerning spiritual matters.");
  Wait(20);
  cEgyptGuard2.Say("Now... get lost!.");
  cLeif.Walk(196, 135, eBlock, eWalkableAreas);
  cLeif.Say("I've got to get into the palace.");
  cLeif.Say("It's my only chance of gettin back that shard.");
  TalkedGuard2 = 1;
  --- BREAK OUT HERE!!! ---
  }
if (TalkedGuard2 == 1){
  cEgyptGuard2.Say("Hey!");
  cLeif.Walk(284, 114, eBlock, eWalkableAreas);
  cLeif.FaceCharacter(cEgyptGuard2, eBlock);
  cEgyptGuard2.Say("I told you! You can't enter the palace!.");}
}


Can anyone help?

Visit me at naggynerd.com

Scorpiorus

Yep, you could just put "return;" in there, but a more practical approach would be to use the "else if" method, to skip the 2nd block of code when the function runs first time:


if      (TalkedGuard2 == 0) {

}
else if (TalkedGuard2 == 1) {

}


SMF spam blocked by CleanTalk