Solarus-Games English Forum

Community => Your scripts => Topic started by: Splyth on May 17, 2019, 11:32:18 PM

Title: Delayed Closing of a Dialog Box
Post by: Splyth 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?
Title: Re: Delayed Closing of a Dialog Box
Post by: ponderitus on May 18, 2019, 03:27:39 AM
Im a bit drunk but are you after something like

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.
Title: Re: Delayed Closing of a Dialog Box
Post by: Splyth 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!
Title: Re: Delayed Closing of a Dialog Box
Post by: Splyth on May 19, 2019, 04:59:19 PM
I think I got it
Thanks!