How to check server/local time?
How to check server/local time?
Did a search, but didn't find anything really relevant. I want to run specific waypoints or parts of waypoints only at specific times of the day. Is there a function that I can use to check what the time is -- either server or local? Thanks.
Re: How to check server/local time?
I use os.date with a "*t" argument.
http://www.lua.org/manual/5.1/manual.html#pdf-os.date
It returns a table with hour, minute etc values.
Example, to do something after 2:30 pm.
http://www.lua.org/manual/5.1/manual.html#pdf-os.date
It returns a table with hour, minute etc values.
Example, to do something after 2:30 pm.
Code: Select all
local date = os.date("*t")
if date.hour > 14 and date.min > 30 then
.... do something
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
Re: How to check server/local time?
To check for between 11am and 11pm, would I setup something like?rock5 wrote:I use os.date with a "*t" argument.
http://www.lua.org/manual/5.1/manual.html#pdf-os.date
It returns a table with hour, minute etc values.
Example, to do something after 2:30 pm.Code: Select all
local date = os.date("*t") if date.hour > 14 and date.min > 30 then .... do something
Code: Select all
local date = os.date("*t")
if date.hour > 11 and 23 > date.hour then
.... do something
Re: How to check server/local time?
"> 11" is 12 or more. If you want to start at 11 it should be ">= 11" or "> 10". Otherwise the rest is good.
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
Who is online
Users browsing this forum: Ahrefs [Bot] and 0 guests