Author Topic: Delayed Closing of a Dialog Box  (Read 726 times)

Splyth

  • Newbie
  • *
  • Posts: 8
    • View Profile
Delayed Closing of a Dialog Box
« on: May 17, 2019, 11:32:18 pm »
The situation:
Currently when a player selects an answer to a question the dialog box instantly closes:

What I want:
I'd like to delay closing the dialog box for half a second or so. I really I should be able to configure however much time I want.

Why is this needed:
I'd like to do things like play a sound or change the cursor to a new image. (e.g. display a thumbs up or play a small animation)

Anyone have any thoughts on how to tackle this?

ponderitus

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Delayed Closing of a Dialog Box
« Reply #1 on: May 18, 2019, 03:27:39 am »
Im a bit drunk but are you after something like

Code: [Select]
if answer == 1 then -- Yes
sol.timer.start(map, 500, function() -- (1000 = 1 second)
sol.audio.play_sound("Blah_blah")
end)
else -- no
sol.timer.start(map, 100000000000, function()
end)

-- this might not be accurate, also dont use this as you'd be waiting 100,000,000 seconds for it to close on a no situation....again, drunk.

Splyth

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Delayed Closing of a Dialog Box
« Reply #2 on: May 18, 2019, 11:42:01 pm »
I was drinking last night too so no worries.  I'm swamped today but I think I'll have a few hours tomorrow.

I think the thing I was missing was  placing the timer on the game object. I'll try it and get back to you.

Thanks!

Splyth

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Delayed Closing of a Dialog Box
« Reply #3 on: May 19, 2019, 04:59:19 pm »
I think I got it
Thanks!