Small OOP timer module

Been needing a timer module, and found this thread of a feature request for such a thing to be implemented properly.

Since I couldn’t find anyone posting anything else about it, I wanted to try to make a neat module for it myself - I’m kind of new to OOP like this but I figured I could give it a go.

Methods:
image
Example use case:
image

Tell me what you think!

24 Likes

Yum. Time to abandon wait for good. I’ve also been needing a timer module, especially for the cancel feature.

Thank you very much for sharing. I’ll see myself implementing this a lot.

1 Like

Nice release, one thing I would say to implement is a pause function. Might be helpful to those that want to be able to pause the time due to a variable able to pause, and then resume after variable is removed.

2 Likes

Was going to add a pause function initially but decided not to so I could work on other things for now. I’ll probably add an Extend function too, but I don’t want to start bloating the API too much.

Could we receive a link to the faster variant alongside your custom BindableEvent?

1 Like

Could you send me the script so I could see how it works? I’m still fairly new to OOP, so I’d love to learn how yours is faster. It’s fine if you want to keep it private, though.

3 Likes

Yeah, it’s on my Twitter.

2 Likes

Thanks. I’ll try to change my module to be more efficient while maintaining the object-like usage of it.

1 Like

Yours is real OOP. Mine is fake OOP.

I’m not sure what he used for his event, but here’s something rudimentary I made awhile ago that I didnt end up using much.
Not sure what you could want it for, but it’s fired by calling the event object.
I believe I used it for a trajectory system I made, had an impact method.

Anyways, I’d recommend rewriting the arguments part.
eventclass

Edit:
This was also meant to be used with other object oriented stuff. For example
trajectory

Small update; added a Count event to this module. Useful for when you want an event to fire every x seconds. Right now it just returns the real elapsed time since the start (in that event) but I’ll make it return the ideal elapsed time (ignoring the annoying decimal numbers tick() produces).

1 Like