Page 1 of 1

Get OS Time

Posted: Tue Dec 04, 2012 3:29 am
by Budzer
I think I have seen it somewhere, but couldn't find.

Is there a way to execute some path on certain hour. For example my char is doing waypoint file a1 and after reaching waypoint 4 in that file it checks time. If it is past 0:00 and before 0:05 it loads waypoint file a2.

Thanks ahead.

Re: Get OS Time

Posted: Tue Dec 04, 2012 4:22 am
by rock5
"os.date("*t")" returns a table with current time values. eg.

Code: Select all

table.print(os.date("*t"))
table: 01EEC9B8
hour:   20
min:    16
wday:   3
day:    4
month:  12
year:   2012
sec:    59
yday:   339
isdst:  true
So you could do something like

Code: Select all

local time = os.date("*t")
if time.min >= 0 and 5 >= time.min then
    loadProfile("a2")
end
Of course if you want it to wait there until that time then you would put it into a loop.

Re: Get OS Time

Posted: Tue Dec 04, 2012 8:59 am
by Budzer
Thanks a lot ;)