Community > Your scripts

Delayed Closing of a Dialog Box

(1/1)

Splyth:
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:
Im a bit drunk but are you after something like


--- Code: ---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)
--- End code ---

-- 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:
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:
I think I got it
Thanks!

Navigation

[0] Message Index

Go to full version