Issues with Dialog

Started by vardex, Sun 26/12/2010 03:01:44

Previous topic - Next topic

vardex

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:
Code: ags
function dialog_request(int dr); {
          dDialog1.Start()
          if (dr==5) {
          cCoop.AddInventory(iBridgeKey);
          StopDialog();   
          }  



The error I am receiving:
Code: ags
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.

lilinuyasha

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.
I can Fluently speak Braille. I obtained a swiss army knife...From the Turkish Navy. My hands feel like rich brown suede. My blood smells like cologne. I AM Trey Love, The most Interesting Man in the World.

vardex


lilinuyasha

Code: ags
 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.
I can Fluently speak Braille. I obtained a swiss army knife...From the Turkish Navy. My hands feel like rich brown suede. My blood smells like cologne. I AM Trey Love, The most Interesting Man in the World.

vardex

Nope, still getting the same error. New script:
Code: ags
function dialog_request(int dr); {
          Dialog.Start()
          if (dr==5) {
          cCoop.AddInventory(iBridgekey);
          StopDialog();   
          }   
}

lilinuyasha

take out the semicolon in your first line of code.
I can Fluently speak Braille. I obtained a swiss army knife...From the Turkish Navy. My hands feel like rich brown suede. My blood smells like cologne. I AM Trey Love, The most Interesting Man in the World.

vardex

It didn't work. I'm still receiving the same error.

lilinuyasha

#7
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.
I can Fluently speak Braille. I obtained a swiss army knife...From the Turkish Navy. My hands feel like rich brown suede. My blood smells like cologne. I AM Trey Love, The most Interesting Man in the World.

vardex

Well, my main problem is that I can't get the dialog to close after I select "Goodbye".

lilinuyasha

did you check the dialogue script? does it say "stop" instead of "return"?
I can Fluently speak Braille. I obtained a swiss army knife...From the Turkish Navy. My hands feel like rich brown suede. My blood smells like cologne. I AM Trey Love, The most Interesting Man in the World.

vardex

THANK YOU! I didn't think it was that simple! You deserve a pizza trophy.

lilinuyasha

 ;D happy to help. but...don't be offended if i wind up eating the trophy.
I can Fluently speak Braille. I obtained a swiss army knife...From the Turkish Navy. My hands feel like rich brown suede. My blood smells like cologne. I AM Trey Love, The most Interesting Man in the World.

SMF spam blocked by CleanTalk