Jibble

Author Topic: [SOLVED] Why won't this dialog script compile?  (Read 626 times)

Monsieur OUXX

  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
[SOLVED] Why won't this dialog script compile?
« on: 24 Jun 2013, 19:37 »
It's probably obvious but I don't understand why this script (appearing in a dialog) throws the error : "Dialog 7(84): Script commands can only be used in the area between a @ entry point and the closing return/stop statement"

Code: Adventure Game Studio
  1.  
  2. @5  // Listen carefully, all of you...
  3. Indy: The subject will be...
  4.  
  5.   //did we already resolve this?
  6.   if (DialogsLogic.GetVar(eDialog_FoundProperSubject))  {
  7. Indy: ...wood carving...
  8. Indy: ...artwork...
  9. Indy: ...constantinople...
  10. Indy: ...Mehmet IIs reign.
  11. goto-dialog 10 //dStudent2_HowAbout3. That will compute the outcome  
  12. return
  13.   }  /////////// THAT LINE THROWS THE ERROR /////////////////////
  14.   else
  15.   {
  16. goto-dialog 9 //dStudent2_HowAbout2
  17. return
  18.   }
  19.  
  20. return
  21.  
  22.  


Because of that error, I get another error "Dialog 8(1): Error (line 1): Nested functions not supported (you may have forgotten a closing brace)" in the dialog immediately after. But I suppose it's only a side-effect.

If I remove the bit I quoted just above, then the code compiles fine.
« Last Edit: 24 Jun 2013, 21:02 by Monsieur OUXX »
 

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
Re: Why won't this dialog script compile?
« Reply #1 on: 24 Jun 2013, 20:09 »
The "return" statements you have after "goto-dialog" are redundant and should be removed. However, the "goto-dialog" statements count as a "return/stop statement", so you can't have any script command (including braces) on the line following that command. So, without having tested it myself, could you use the normal scripting command Dialog.Start instead of calling goto-dialog? Would it have the same result, and create the same branching (e.g., would goto-previous still work?)?

Monsieur OUXX

  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
Re: Why won't this dialog script compile?
« Reply #2 on: 24 Jun 2013, 20:17 »
The "return" statements you have after "goto-dialog" are redundant and should be removed.

Yes, I know, I added them in a desperate attempt to trick the compiler.

However, the "goto-dialog" statements count as a "return/stop statement", so you can't have any script command (including braces) on the line following that command.
Ok. But I need to launch either one dialog or the other depending on the boolean test.


could you use the normal scripting command Dialog.Start
Let me try that. The compiler is accepting it but I need to test in-game that it doesn't make it explode.
 

Monsieur OUXX

  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
Re: Why won't this dialog script compile?
« Reply #3 on: 24 Jun 2013, 21:01 »
It's working! Thanks.