Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: vardex on Sun 26/12/2010 03:01:44

Title: Issues with Dialog
Post by: vardex on Sun 26/12/2010 03:01:44
I'm having a bit of trouble with dialog. It seemed to run fine, the only problem being that I couldn't get it to quit. I tried reformatting my script, as per the example given in the engine's help file, but something appears the matter. My script: function dialog_request(int dr); {
          dDialog1.Start()
          if (dr==5) {
          cCoop.AddInventory(iBridgeKey);
          StopDialog();   
          } 



The error I am receiving: GlobalScript.asc(523): Error (line 523): Nested functions not supported (you may have forgotten a closing brace)


Basically, what I'm trying to do is run the dialog, and when the stereotypical "Goodbye" is selected, give the player an item and exit the dialog GUI.
Title: Re: Issues with Dialog
Post by: lilinuyasha on Sun 26/12/2010 03:37:31
Maybe you just clipped off part of the code but it looks like you are, indeed, forgetting a brace. i only count 3, you need one more.
Title: Re: Issues with Dialog
Post by: vardex on Sun 26/12/2010 03:42:35
Uh... Where?
Title: Re: Issues with Dialog
Post by: lilinuyasha on Sun 26/12/2010 03:47:41
function dialog_request(int dr); {
          dDialog1.Start()
          if (dr==5) {
          cCoop.AddInventory(iBridgeKey);
          StopDialog();   
          } 



right after the last brace. add one more after your final brace and see if that fixes it. your first brace, "(int dr); {" at this point, should connect to the brace at the end of "StopDialogue();". however, that last brace connects to "(dr==5)". just add another one. trust me.
Title: Re: Issues with Dialog
Post by: vardex on Sun 26/12/2010 03:51:59
Nope, still getting the same error. New script: function dialog_request(int dr); {
          Dialog.Start()
          if (dr==5) {
          cCoop.AddInventory(iBridgekey);
          StopDialog();   
          }   
}
Title: Re: Issues with Dialog
Post by: lilinuyasha on Sun 26/12/2010 03:55:50
take out the semicolon in your first line of code.
Title: Re: Issues with Dialog
Post by: vardex on Sun 26/12/2010 04:02:16
It didn't work. I'm still receiving the same error.
Title: Re: Issues with Dialog
Post by: lilinuyasha on Sun 26/12/2010 04:10:32
the only other thing i could guess is your dialogue properties. is the name of your dialogue, "dialogue" or is it something else? you might need to specify a dialogue.

but for all you're trying to do with it, you might as well run the dialogue, and then have a separate function in either the room script, or the dialogue script, to give you the key. if the dialogue is not conditional on your choice of accepting the key or not, you might as well take the easy way out with this.
Title: Re: Issues with Dialog
Post by: vardex on Sun 26/12/2010 04:18:42
Well, my main problem is that I can't get the dialog to close after I select "Goodbye".
Title: Re: Issues with Dialog
Post by: lilinuyasha on Sun 26/12/2010 04:19:49
did you check the dialogue script? does it say "stop" instead of "return"?
Title: Re: Issues with Dialog
Post by: vardex on Sun 26/12/2010 04:34:18
THANK YOU! I didn't think it was that simple! You deserve a pizza trophy. (http://fc04.deviantart.net/fs11/i/2006/242/e/3/Trophy_for_You_by_gdflgum.jpg)
Title: Re: Issues with Dialog
Post by: lilinuyasha on Sun 26/12/2010 04:42:18
 ;D happy to help. but...don't be offended if i wind up eating the trophy.