Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: masseymoviegames on Wed 02/06/2010 20:46:46

Title: Too many nested if/else statements? (SOLVED)
Post by: masseymoviegames on Wed 02/06/2010 20:46:46
I need some help, but I don't know if there's any way to fix this problem.

I just placed my 75th script request into the dialog_request section, and it's telling me that I've used too many if/else statements when I try to save it.

This is a fairly major issue because I haven't even half-finished the overall game I'm making yet and could really use some advice if there is a way to increase the amount of statements I could use.

Thanks!
Title: Re: Too many nested if/else statements?
Post by: Vince Twelve on Wed 02/06/2010 21:06:00
You can split it into two (or more) functions.

function dialog_request2(int parameter){
  if(parameter==76){
    ...
  }
  else ...
}

function dialog_request(int parameter){
  if(parameter==1){
    ...
  }

  ...

  else if(parameter==75){
    ...
  }
  else{
    dialog_request2(parameter);
  }
}

will get you on your way.

However versions 3.1 (I think) and above allow scripts right in the dialogs which will save you a lot of headaches.
Title: Re: Too many nested if/else statements?
Post by: masseymoviegames on Wed 02/06/2010 22:18:00
 :D
Thanks a lot!
And by the way, the game's actually being built as a whole game, then released in parts.
I'll hopefully have Part 1 out within the next few weeks.
I'm aiming for next Sunday. For the rest of the parts to be released over the summer.

Thanks again!
:)
Title: Re: Too many nested if/else statements? (SOLVED)
Post by: Vince Twelve on Wed 02/06/2010 22:28:50
Good luck!  ;)
Title: Re: Too many nested if/else statements? (SOLVED)
Post by: Pumaman on Tue 08/06/2010 21:26:57
Quote from: Vince Twelve on Wed 02/06/2010 21:06:00
However versions 3.1 (I think) and above allow scripts right in the dialogs which will save you a lot of headaches.

Yes, this is important. Don't use dialog_request, it is ugly and obsolete. Just put the scripts in your dialog scripts which makes them much easier to follow.