Author Topic: Some small problem with sound & code  (Read 4108 times)

0 Members and 1 Guest are viewing this topic.

Dokk
  • Newbie
  • *
  • Posts: 7
  • Game developer & musician
    • View Profile
Some small problem with sound & code
« on: June 30, 2018, 11:23:47 AM »
Hello. I have a problem with voice in my quest. In this code speech comes together with dialog:

Code: [Select]
function board_1:on_interaction()
game:start_dialog("board.hello")
sol.audio.play_sound("ok")
end

But I need to start "ok" speech only after "board.hello" dialog will end. What I must to do with this code?
I'm making first russian quest on SE

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
Re: Some small problem with sound & code
« Reply #1 on: June 30, 2018, 12:58:11 PM »
game:start_dialog() takes an optional second parameter of type function, that will be called when the dialog finishes. In other words:
Code: (lua) [Select]
function board_1:on_interaction()
  game:start_dialog("board.hello", function()
    sol.audio.play_sound("ok")
  end)
end

Dokk
  • Newbie
  • *
  • Posts: 7
  • Game developer & musician
    • View Profile
Re: Some small problem with sound & code
« Reply #2 on: June 30, 2018, 01:11:23 PM »
Christopho, yes, it works! I'm noob. Thank you so much :D
« Last Edit: June 30, 2018, 09:54:12 PM by Dokk »
I'm making first russian quest on SE