So in my current project I am still using the dt
Code: Select all
function macro.main(dt)
gaptime = gaptime - dt
walktime = walktime - dt
if gaptime < 0 and walktime < 0 then
Didn't really find any examples of timestamp usage but there seems to be a few ways of going about it.
You could add the seconds to now time and then use Timestamp:isPast to see if the time is after what you are looking for.
You could add the seconds to now time and then use Timestamp:diffInSeconds in comparison to now time.
You could set now time to a variable and then use Timestamp:diffInSeconds to compare to now and see if the time you wanted has passed.
I am thinking for what I want the first option will work as it only has 1 variable to keep track of, you just set the time + the number of seconds added to it and then check if that time isPast or not.
Any advice on the way you intended it for use?
This is so different to just doing a yrest in the code, so much more to think about but at the end of the day it is a better way to do things.