> Is there a command I can use in AGS to go to a specific point in the script?

Started by , Fri 16/07/2004 15:27:22

Previous topic - Next topic

The Pseudo Otaku

Sry if this is a stupid question...
I've made a gui that functions like a command prompt on a computer and have made a menu with numbered options (like say dos or unix.) I need a way to go back to the start of my code for the main menu though when you get done with a sub menu. If your familiar with RPGM2k there was a command called "label" and "GoTo" that let you skip to a specified part of the script. Does AGS have anything like this? I thought about defining each mission scenario as a function so I could just restart it each time but I don't think that would really work well later on since I want things to be a little more complex.

>here's a section of my code...
// Mission 1
   ListBoxAdd (0,2, "_\\Welcome to XX-7iv maitanance terminal.//_");
   ListBoxAdd (0,2, "Please make a selection.)";
   ListBoxAdd (0,2, "Ã,  1. Diagnostic");
   ListBoxAdd (0,2, "Ã,  2. Parameters");
   ListBoxAdd (0,2, "Ã,  3. Operation");
ParseText (command)
// diagnostic
   if (Said ("1, 1.")) {
   SetTextBox (0,0, "");
   ListBoxAdd (0,2, "_____________\\Diagnostic//_____________");
   ListBoxAdd (0,2, "Press any key to exit.");
   .
   .
   .
   else { ListBoxAdd (0,2, "SATCAL servo and gear boxÃ,  Ã,  Ã,  Ã,  Ã, ONLINE");}
   ParseText (command)
   if (Said ("anything")) { GUIOff (TERMINAL); ListBoxClear (0,2); SetDefaultCursor ();}
}
//> Instead of exiting the GUI though I'd rather
//cycle back to the start of the code (at //mission 1) but I'm not sure how
//to place "labels" in the script nor how to give a command to make the script go to one...
//
// This is an example of the type of thing i'm wanting to do...
//
// label 1
// DisplayMessage ("Will you eat the garbage?");
// if (choice == yes) { DisplayMessage ("That's disgusting!"); GoTo (label 1);}
// if (choice == no) { DisplayMessage ("Well...");}
// ...
//
// See, that way it cycles back to the question whenever choice == yes

>sry this post is so long, also if like the post before me was on the same topicÃ,  : )Ã,  thanks for any help.

Radiant

I think your easiest bet would be something like this:

Code: ags

int mode = 1;
while (mode > 0) {
  if (mode == 1) {
    // mission 1
  } else if (mode == 2) {
    // diagnostic
  } else {
   . . .
  }
}


The Pseudo Otaku

 : )  > Hey Thanks, That was really quick! I'll try it that way. I was going to use a variable to determine which mission would run in the script, I guess it would be just as easy to use it for that as well.

SMF spam blocked by CleanTalk