stop_dialog

Started by ponderitus, March 07, 2019, 09:28:28 PM

Previous topic - Next topic
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")

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.

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"?

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

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

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.

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