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

0 Members and 1 Guest are viewing this topic.

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: 75
    • 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!