Author Topic: Children of Solarus Dialog Script, How Does it Work?  (Read 79 times)

gmanplays@gmail.com

  • Newbie
  • *
  • Posts: 15
    • View Profile
Children of Solarus Dialog Script, How Does it Work?
« on: March 15, 2019, 09:58:33 pm »
Hey again,

I've been playing around with the dialog scripts from Children of Solarus, in particular debug_dialog, dialog_box, and language_manager (I think that's right..?). However, upon inspection I can't figure out how to index the dialog ids I need to in order to start the loop, which I think is the function that'll let me rattle off multiple dialog boxes without generating the "dialog already active" exception. Maybe I've skimmed over some comment that gives instructions on that matter, but upon close inspection I don't think I have. I've also referenced back to the original tutorials, but those didn't help because all of the dialog boxes shown there are separated by input, whereas I just need to show two consecutive dialog boxes. Here's a link to each of those scripts, I was hoping I could reference the experience of someone who's already figured it out though.

dialog_box.lua: https://github.com/solarus-games/children-of-solarus/blob/dev/data/scripts/menus/dialog_box.lua
debug_dialog.lua: https://github.com/solarus-games/children-of-solarus/blob/dev/data/scripts/debug_dialogs.lua
language_manager.lua: https://github.com/solarus-games/children-of-solarus/blob/dev/data/scripts/language_manager.lua

Hope I don't waste anybody's time. Thanks much for reading.

Max

  • Full Member
  • ***
  • Posts: 201
    • View Profile
Re: Children of Solarus Dialog Script, How Does it Work?
« Reply #1 on: March 17, 2019, 03:00:14 pm »
You're not wasting anybody's time : )

So you just want to show two consecutive dialogs? Why not just show the second one in the first one's callback?

gmanplays@gmail.com

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Children of Solarus Dialog Script, How Does it Work?
« Reply #2 on: March 18, 2019, 10:27:59 pm »
Wait, you can do that? I totally didn't think of that. I should probably start being more creative with the API reference info, huh? Anyways, thank you much.

--EDIT: It appears that when I put the second start_dialog command in the callback, it just skips the first dialog. Odd.
« Last Edit: March 18, 2019, 10:34:38 pm by gmanplays@gmail.com »

llamazing

  • Full Member
  • ***
  • Posts: 168
    • View Profile
Re: Children of Solarus Dialog Script, How Does it Work?
« Reply #3 on: March 19, 2019, 12:49:04 am »
If all you want to do is show two dialogs back-to-back then all you have to do is use the "next" property of the dialog entry. For example:
Code: (lua) [Select]
dialog{
  id = "first_dialog",
  next = "second_dialog",
  text = [[
show this dialog first.
]]}

dialog{
  id = "second_dialog",
  text = [[
Then show this dialog.
]]}

Then all you have to do is start the first dialog and the second one automatically gets shown after. Note that there is also a "next2" property for when the player selects from between 2 choices, where next2 is the dialog to display next when the second choice is selected.