Solarus-Games English Forum

Solarus => Development => Topic started by: ponderitus on March 07, 2019, 09:28:28 PM

Title: stop_dialog
Post by: ponderitus on March 07, 2019, 09:28:28 PM
hey, how do you get a dialog box to close itself rather than having to have an action pressed? is this possible? Id only want to use this in "cutscenes" and such, not in regular interactions with npc's

eg
game:start_dialog("this_needs_interupting", function()
  sol.timer.start(map, 1000, function()
  game:stop_dialog()
  end)
end)


according to the documentation this is possible but i cant seem to make it work, would it also need a different function if the dialog was more than 3 lines? (not a problem to make things 3 lines if dialogs can be "auto closed")
Title: Re: stop_dialog
Post by: llamazing on March 08, 2019, 02:34:26 AM
I think the problem here is the context of your timer. When a dialog is active, the game is paused, and therefore your timer (which has a map context) would be paused too until you close the dialog.
Title: Re: stop_dialog
Post by: ponderitus on March 08, 2019, 10:13:32 AM
yeah i understand that that i just wrote that as an example of what i wanted to happen, is there a way to unpause the game whilst in the dialog? do you mean changing the timer to "game" instead of "map"?
Title: Re: stop_dialog
Post by: ponderitus on March 08, 2019, 10:45:15 AM
ok, so i think i get it now, i was calling a function inside the dialog which meant the timer wasn't being activated, also that i was calling the timer in context of the map not the game, so it should work like this? by calling the timer alongside the dialog

game:start_dialog("this_needs_interupting")
sol.timer.start(game, 1000, function()
game:stop_dialog()
end)


is this right? It works...lol. Is there a way to call the next lines of a dialog in this way?

most of the dialog i'd like to work in this way only has 3 lines anyway (or can be changed) so its not a huge problem, just trying to learn
Title: Re: stop_dialog
Post by: ponderitus on March 08, 2019, 11:31:26 AM
to add to this, how do you change the style of the dialog box to "empty"? do you put it as a property inside the "languages > en" or is it defined inside the map?

the dialog_box.lua says there's either a "box" or "empty" style and "box" is the default
Title: Re: stop_dialog
Post by: Max on March 08, 2019, 05:34:51 PM
I'm vaguely familiar with the dialog box script, I thought that maybe this was a variable you set in the script? Like how you set "top/bottom/auto" for positioning.
Title: Re: stop_dialog
Post by: ponderitus on March 08, 2019, 07:25:50 PM
i dont know, i havent got to setting positioning yet thats a problem for later, ive tried putting it in my script a few ways but havent been successful yet