Solarus-Games English Forum

Community => General discussion => Topic started by: Dokk on June 30, 2018, 11:23:47 AM

Title: Some small problem with sound & code
Post by: Dokk 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:

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?
Title: Re: Some small problem with sound & code
Post by: Christopho 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
Title: Re: Some small problem with sound & code
Post by: Dokk on June 30, 2018, 01:11:23 PM
Christopho, yes, it works! I'm noob. Thank you so much :D