LibTimer

This project is abandoned.

Whether this project is out of date or its author marked it as abandoned, this project is no longer maintained.

If you wish to take this project over, please report it and state your intentions.

This Project was abandoned at 11. October 2008 because of somebody doing a 1:1 similar project copy. Because I went through this in WoW already (Chronous & Timex) I do not wan't that mod authors use different libs doing exactly the same. At the end it is the end user suffering in bloated memory with dupe functions. Because I do not want this I abandon this Project. So I hope zarious values that. Congratulations you blown up my motivation.

A library for Timed events / crons to give a very easy Posibility to add timed Events to a Addon.

If you are a End-User
This addon is a function library. This means that it doesn't have any UI on it's own, but rather provides functionality for other addons. If you are an addon user and not an addon developer all you need to do is to copy this Addon to your Addon Directory, there are no Slashcommands. You can see if the Addon is active if you read something like "=> libTimer loaded and initialized succesfully" after your Char. enter the World.

If you are a Developer

Usage
1st You need to include it as Dependency in your .mod file

<Dependencies>
    <Dependency name="LibTimer" />
</Dependencies>

2nd you can call the Library functions within your Mod:

To Add a Event:
LibTimer.AddTask(<name>,<seconds>,function() <command> end,<repeat>)
name = Name of the task shouldn't contain whitespaces or special Chars. It is important that each Task name is only used once!
seconds = time in seconds
command = Function to call e.g. "MyMod.MyFunc()"
reppeat = bool, false or true. If True event will repeat, if fals event triggers onetime
e.g.: LibTimer.AddTask("MyTask1",10,function() testfunction() end,true)

To Delete a Event:
LibTimer.DelTask(<name>)

Examples
Triggering the Function "MyFunc()" once in 5 minutes:
<<code>>function MyMod.MyFunc() print("MyFunc called") end

LibTimer.AddTask("MyTask",300,function() MyMod.MyFunc() end,false)<</code>>
This will fire your Function MyFunc in 5 minutes and delete the task afterwards.

If you change the repeat (last command) to true it will be repeated every
5 minutes until you manually call a LibTimer.DelTask("MyTask")

Clock Functionality
As a usefull tool I added a Table which contains the current Time, you can use this for your mods to display the current "Real World Time" in Game. It grabs the current Time out of the chat and refresh the Table "LibTimer.time". Content:

LibTimer.time {
 full = "Full Time in format hh:mm:ss",
 h = "hours as number h",
 m = "hours as number m",
 s = "hours as number s"
}

Example: To print the current time just do a print(LibTimer.time["full"]), to get only the current hour print(LibTimer.time["h"])

This is still in development, I'm open for suggestions.

You must login to post a comment. Don't have an account? Register to get one!

  • 1 comment
  • Avatar of Kanedacorp Kanedacorp Wed, 17 Sep 2008 22:01:44

    Damn this is useful!!!

    I've been trying to get a timed event working all day!! Thanks solariz :D

    If you could put in a command to pause operation of my script for X seconds that would make my coding simpler ;)

  • 1 comment

Facts

Date created
11 Sep 2008
Category
Last update
22 Sep 2008
Development stage
Abandoned
License
GNU Lesser General Public License version 3 (LGPLv3)
Reverse relationships
1
Recent files

Authors