Icon_Bar

Posted by Digitalzyn on Fri 10 Apr 2020 05:30 AM — 3 posts, 15,623 views.

#0
Hello, I have been using MUSHclient for years now and absolutely love it. I recently have installed the Icon_bar plugin and have got it working great. The only thing I can't figure out for the life of me is how to make it do something once the timer is complete. For example: if a two minute timer reaches 0. I would like to send a ColourNote to let me know the timer is up. I have tried doing this myself and keep coming up with errors. Any help would be appreciated. Thank you


Edit: I found a work around by making a second timer to fire at the same time as the timer by adding the execute command.
 

  {
  icon = "Crab.png",
  tooltip = "Crabbing",
  Execute = AddTimer("reelin", 0, 2, 00, "        ****    Get the Crabs from the Traps!!    ****", timer_flag.Enabled + timer_flag.OneShot + timer_flag.TimerNote, ""),
  cooldown = 120,  
  sound = "ding.wav"
  
  
  }, -- end of button 2


Doing this seems a bit excessive. If there is an easier way I'd appreciate some help. Thanks!
Amended on Fri 10 Apr 2020 05:53 AM by Digitalzyn
Australia Forum Administrator #1

I’ve put the plugin onto GitHub and amended it to have a “done” function which is called when the time is up. Download from https://raw.githubusercontent.com/nickgammon/plugins/master/Icon_Bar.xml

As shown in the comments you can add a function call to the bar like this:

  done = function (n) print ("Healing done!") end   -- what to do when done

The function can be inline (like above) or a function elsewhere in your code. The function is passed the number of the icon bar which has reached its cooldown time.

#2
Now THAT is awesome. Thank you Nick. Keep up the great work!