Author Topic: Wrong dialog being displayed on .Start()  (Read 1065 times)

Wrong dialog being displayed on .Start()
« on: 21 Jan 2016, 15:22 »
I have recently opened a project that was started in AGS 3.3.3 in version 3.3.4 and discovered that one of the dialogs is now consistently being replaced with a different one when I try to .Start() it. The one that it gets replaced by happens to be the dialog with ID 0. I tried going back to AGS 3.3.3 but the problem persists, so maybe it is just a coincidence that I noticed this now.

There are other dialogs in the game that do not seem to be affected. I tried creating a new dialog, but the new one had the same problem.

I did have a custom dialog rendering routine, but I tried disabling it and that didn't fix it. I also tried putting this in dialog_options_get_dimensions:

Code: Adventure Game Studio
  1. Display("%d", info.DialogToRender.ID);

...and confirmed that the ID of the dialog is 0, not the ID that it should be.

I also tried dialog[<x>].Start() instead of dDialog<x>.Start(), but that didn't fix it.

Has anyone had a similar problem? And any suggestions for what might fix it?

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: Wrong dialog being displayed on .Start()
« Reply #1 on: 21 Jan 2016, 15:45 »
So, let me clarify this. You have Dialogs named like dDialog0, dDialog1, dDialog2, etc, and when you call, for example dDialog5.Start(), dDialog0's lines and options play instead?

Couple of questions: how many dialogs you have in total, and do you use subfolders in the dialogs list? I recall we had number of issues with folders before (although I think they were fixed)

Re: Wrong dialog being displayed on .Start()
« Reply #2 on: 21 Jan 2016, 16:03 »
So, let me clarify this. You have Dialogs named like dDialog0, dDialog1, dDialog2, etc, and when you call, for example dDialog5.Start(), dDialog0's lines and options play instead?
Essentially, yes - the actual ID was 7, and I did give it a custom script-name instead of keeping the default, if that makes any difference.

Couple of questions: how many dialogs you have in total, and do you use subfolders in the dialogs list? I recall we had number of issues with folders before (although I think they were fixed)
55 in total, and yes - the dialog in question is 2 folders deep.
« Last Edit: 21 Jan 2016, 16:05 by Denzil Quixode »

Re: Wrong dialog being displayed on .Start()
« Reply #3 on: 21 Jan 2016, 21:13 »
I tried moving every dialog out to the root of Dialogs, and deleting all the (empty) subfolders - curiously, this fixed the dialog I was having problems with, but the same problem is now happening with other dialogs that (I think) were okay before.

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: Wrong dialog being displayed on .Start()
« Reply #4 on: 22 Jan 2016, 13:01 »
Would it be acceptable for you to send me your project? I would like to look at what's going on under debugger.

Re: Wrong dialog being displayed on .Start()
« Reply #5 on: 22 Jan 2016, 16:44 »
Ok, I worked out what it was (laugh) Predictably, the root cause was a stupid mistake on my part, and it's a pretty unlikely situation - but it's a case where AGS should probably try to give an error message if possible.

You can reproduce it by creating a new game with 4 dialogs.

dDialog0:
Quote
@S
  Display("Hello from Dialog 0!");
stop

dDialog1:
Quote
@S
  /* I'm a comment, but something is wrong... /*
  Display("Hello from Dialog 1!");
stop

dDialog2:
Quote
@S
  Display("Hello from Dialog 2!");
stop

dDialog3:
Quote
@S
  /* I'm a comment */
  Display("Hello from Dialog 3!");
stop

This will compile with no problems. Calling dDialog2.Start() will instead begin dDialog0.

Essentially, dDialog2 has been entirely /* commented out */ thanks to the unclosed comment started in dDialog1 that carries through to the comment in dDialog3.

The syntax highlighting in the editor also manages to miss that the comment was unclosed - the line after it was highlighted as normal - so I didn't spot this until I was really hunting through all the dialogs.

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: Wrong dialog being displayed on .Start()
« Reply #6 on: 22 Jan 2016, 16:59 »
Oh. That's probably because dialog script has different syntax highlighting.
Also, when dialogs are compiled they are actually all merged into one huge script.

Re: Wrong dialog being displayed on .Start()
« Reply #7 on: 22 Jan 2016, 17:09 »
Thanks for working it out Taxler. Crimson- right, that all makes a lot of sense, it's a perfect storm of bad luck more than anything else.