How can I end a dialog when a new scene starts? [Solved]

Heathen

  • Posts: 6
Hello,

I'm quite new to Stencyl so I hope my question is not super stupid. :/

So, I'm working on a game where the first seen looks like a social media page and I added dialog to it. It's a rather long message that keeps going. The dialog is supposed to me more like a thing in the background. You can't interact, skip or choose anything etc.

When you press a button on the screen the scene switches to another one (while the dialog is potentially still going). I also added a dialog there, that also is just supposed to appear and nothing more.

The problem is, that the text from the first scene is appearing on the second scene along with its sounds. :/

Is there a way to end the dialog when the scene changes ?
I would be very grateful if you could help me.

« Last Edit: June 16, 2017, 05:35:17 am by Heathen »

Erikas Taroza

  • Posts: 4
Use <end> I think

Heathen

  • Posts: 6
But <end> ends the dialog at a specific point.

I could but <end> at the end of the dialog. But you can go to the next scene without the dialog having finished.

I wanted the message to just keep going in the background and you can decide when you want to press the button to enter a new scene. So the point when the dialog should end is not fixed at the end of it but it should end when the scene changes.

I was wondering if there was a way  to do that...

Justin

  • *
  • Posts: 4007
You can use this code.

Code: [Select]
for(dialogBox in dialog.core.Dialog.dialogBoxes)
{
    dialogBox.endMessage();
}

For Live Support: Join our discord channel and ping me @justin.

Heathen

  • Posts: 6
Thank you so much for replying!

...But where do I put that code? I have only worked with blocks so far.
Do I create a Scene Behaviour and add the code there somewhere?

I'm sorry for my lack of knowledge. :(

Justin

  • *
  • Posts: 4007
You can put it inside a code block in design mode. Put it wherever you need to to close dialog boxes at the appropriate time.

For Live Support: Join our discord channel and ping me @justin.

Heathen

  • Posts: 6
Thank you! Now it's working :D