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

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: 1131
    • 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
  1. function board_1:on_interaction()
  2.   game:start_dialog("board.hello", function()
  3.     sol.audio.play_sound("ok")
  4.   end)
  5. end
  6.  

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