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

Post Reply
Vooku
Posts: 70
Joined: Sun Aug 21, 2016 2:42 pm

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

Post by Vooku » Mon Oct 22, 2018 1:51 am

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!

User avatar
Belgarath
Posts: 230
Joined: Fri Jul 26, 2013 7:19 am
Discord: macjabeth#2283

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

Post by Belgarath » Thu Nov 08, 2018 3:19 am

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')]])

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests