Page 1 of 1

How would I add a simple timer based on a trigger?

Posted: Mon Oct 22, 2018 1:51 am
by Vooku
In the mud I play there is a cooldown period before you can use melee / ranged powers when swapping from one to the other. How would I add this? I'm guessing it's pretty simple, I just can't get it to work.

The triggering text would be some thing like "You wield blahblahblah axe|sword|longsword|dagger|waraxe." (for swapping to melee) and something like "You wield blahblahblah bow|longbow|warbow." (for swapping to ranged).

Just simple text number that I could place in a good location (lower left) would be great. Thanks much!

Re: How would I add a simple timer based on a trigger?

Posted: Thu Nov 08, 2018 3:19 am
by Belgarath
I'm not great with UI, but a simpler approach would be to use tempTimer and echo the go-ahead to the screen, like so:
Code: [show] | [select all] lua
local cooldown = 5 -- in seconds
if swapTimer then killTimer(swapTimer) end
swapTimer = tempTimer(cooldown, [[cecho('<green>Cooldown finished!\n')]])