Author Topic: stop_dialog  (Read 115 times)

ponderitus

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
stop_dialog
« 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
Code: [Select]
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")

llamazing

  • Full Member
  • ***
  • Posts: 168
    • View Profile
Re: stop_dialog
« Reply #1 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.

ponderitus

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Re: stop_dialog
« Reply #2 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"?

ponderitus

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Re: stop_dialog
« Reply #3 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

Code: [Select]
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

ponderitus

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Re: stop_dialog
« Reply #4 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

Max

  • Full Member
  • ***
  • Posts: 201
    • View Profile
Re: stop_dialog
« Reply #5 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.

ponderitus

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Re: stop_dialog
« Reply #6 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