Q: How to unregister all timers?

Discuss, ask for help, share ideas, give suggestions, read tutorials, and tell us about bugs you have found with MicroMacro in here.

Do not post RoM-Bot stuff here. There is a subforum for that.
Forum rules
This is a sub-forum for things specific to MicroMacro.

This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
Post Reply
Message
Author
kkulesza
Posts: 150
Joined: Fri May 27, 2011 9:00 pm
Location: Poland

Q: How to unregister all timers?

#1 Post by kkulesza » Mon Jul 30, 2012 6:43 am

Is there a way to unregister all timers, even if i don't know their names and how many was registered?

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Q: How to unregister all timers?

#2 Post by lisa » Mon Jul 30, 2012 8:51 am

The timers are stored in a table but the table is local to lib/lib.lua, I wouldn't suguest making it global.

Easiest way I see of doing it would be to add your own function to lib.lua doing what ever it is you want to do.
it could be as simple as

Code: Select all

function timerlist()
	return timerList
end
then call it somewhere in a userfunction I guess

Code: Select all

local tlist = {}
tlist = timerlist()
table would look like this

Code: Select all

Command> local tlist = {} tlist = timerlist() table.print(tlist)
table: 01384540
GMdetection:    table: 04FA6748
        time:   5000
        func:   function: 0144B820
        args:   table: 04FA6770
timedSetWindowName:     table: 0404B870
        time:   1000
        func:   function: 013EFD20
        args:   table: 0404B9D8
                1:      Charname
The other way would be to find what timers are called and as they are being called to add the names to a global table which you can then later do a unregistertimer on them all if needed.

Default bot uses just 2 timers

Code: Select all

registerTimer("timedSetWindowName", secondsToTimer(1), timedSetWindowName, load_profile_name);
which is for updating the things ont he window, up top.

Code: Select all

registerTimer("timedAttack", secondsToTimer(2), timedAttack);
which is also unregistered, so this wouldn't be a latent timer.

So any other timers would have been added by non default code.
flying//wallclimbing//gmdetect//mountspeed
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

kkulesza
Posts: 150
Joined: Fri May 27, 2011 9:00 pm
Location: Poland

Re: Q: How to unregister all timers?

#3 Post by kkulesza » Mon Jul 30, 2012 9:45 am

Thx for answer.
I've forgot about other timers that i didn't register in my scripts.
It would be better to leave them alone.
I think i'll make make own function that will register timers and add their names to global list.

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests