Thread Tools Display Modes
04/13/14, 05:20 AM   #1
Tyx
 
Tyx's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 23
Question GameTime function

Hello,
I want to write a little AddOn to show the ingame time.
This isn't exactly a lua problem but I couldn't find a better sub forum than this one - sry for that.

It is more an API problem. I couldn't find a function which gives me back the current ingame time.
Is there a function like this in the API? I tried many (but maybe overlooked some):

Shows:
how long you are playing:
GetFrameTimeMilliseconds() = GetGameTimeMilliseconds() ~ GetTimeString()

is self explainatory
GetSecondsSinceMidnight()

Don't know exactly what it does... delta is usually a difference between two things but... no idea between which times^^
GetFrameDeltaTimeSeconds()

I think this is for the alliance wars how long the campaign last
GetGameTimeRemaining()

Hope you can help me

I think this addon will be pretty usefull for vamp and ww hunts - it would be nice to know which moon phase it is right now but this will probably not be an api function.
  Reply With Quote
04/13/14, 05:34 AM   #2
Stormknight
 
Stormknight's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 128
I spent a while previously looking for functions that return ingame time or weather and there's nothing in the documentation on the wiki. There may be functions buried within the ZO API, but I don't have access to documentation on that.

Frame delta seconds is the number of milliseconds since the previous frame rendered.
  Reply With Quote
04/13/14, 07:49 AM   #3
skyraker
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 154
As far as I know, there is not a way to tell what the in-game time is right now.

EDIT: Guess I was wrong about GetGameTimeRemaining. It is still there.

Last edited by skyraker : 04/13/14 at 07:54 AM.
  Reply With Quote
04/13/14, 11:31 AM   #4
Tyx
 
Tyx's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 23
GetGameTimeRemaining is for Alliance War only, or isn't it? If I test the function outside PvP (didn't test it inside until now) it shows only a 0.

Maybe we can emulate a weather function if we now how long a day lasts.

Does anybody know?

The FAQ says it is ~5h but i don't really think that this is true because it wouldn't make much sense that a day is not a divider of 24.
Some player state that a day lasts 8h, I try to test this right now.
  Reply With Quote
04/13/14, 01:36 PM   #5
Nogaruk
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 15
Edit: I think I miss read what you were asking. You're looking for the tamriel world time?

if so, I didn't see you mention
GetGameTimeMilliseconds() - Returns: integer gameTimeInMilliseconds

There are a few relative globals and functions as well as Formatting for time and clock time. Probably isn't a difference, but might be worth exploring. I'm not sure we have access to the games world time, though.

I don't recall anywhere in the game that they show game time. It seems as if everything they do is based on real world time. The only thing I can even think of that is game time related is the day/night cycle. So your best bet might actually be to use the midnight function, figure out how long an in-game day takes, and adjust for it yourself.

These may be real world related
GetTimeString() - Returns: string currentTimeString
GetFormattedTime() - Returns: integer formattedTime
EVENT_SHOW_TIME (bool state)
SI_STR_TIME_DESC_DAYS_HOURS_MINUTES_AND_SECONDS
TIME_FORMAT_STYLE_RELATIVE_TIMESTAMP - Not sure what relative is to in this case

Last edited by Nogaruk : 04/13/14 at 02:00 PM.
  Reply With Quote
04/13/14, 02:40 PM   #6
Tyx
 
Tyx's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 23
Yes I am looking for a way to emulate (with the 8h model) or get the current (ingame) time in Tamriel.

GetGameTime...() returns the time you spend in the game this session.

I would test the EVENT but I have no idea how to use that^^
Can we start events too? I thought until now we can only do something if an event occurs.

The SI_STR... gives back "203"
and the other TIME_FORMAT... will give back "10".

I think the API really doesn't contain a function to ask for the time.
Which is sad because Vamps need to know the time (ok they can look to the sky^^) for best use of their abilities.

EDIT forgot the other two^^
GetTimeString() = hh:mm:ss
GetFormattedTime() = hhmmss
  Reply With Quote
04/13/14, 03:01 PM   #7
skyraker
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 154
EVENT_SHOW_TIME is definitely not in the new API.
  Reply With Quote
04/13/14, 03:03 PM   #8
Flamage
 
Flamage's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 60
Does this help?

local localTimeSinceMidnight = GetSecondsSinceMidnight()
local text = ZO_FormatTime(localTimeSinceMidnight, TIME_FORMAT_STYLE_CLOCK_TIME, TIME_FORMAT_PRECISION_TWELVE_HOUR)
  Reply With Quote
04/13/14, 03:30 PM   #9
Stormknight
 
Stormknight's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 128
Originally Posted by Flamage View Post
Does this help?

local localTimeSinceMidnight = GetSecondsSinceMidnight()
local text = ZO_FormatTime(localTimeSinceMidnight, TIME_FORMAT_STYLE_CLOCK_TIME, TIME_FORMAT_PRECISION_TWELVE_HOUR)
That's real world time since midnight.
  Reply With Quote
04/13/14, 04:06 PM   #10
Flamage
 
Flamage's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 60
Originally Posted by Stormknight View Post
That's real world time since midnight.
Oh, in-game, as in, Tamriel time. Sorry
  Reply With Quote
04/13/14, 06:20 PM   #11
Tyx
 
Tyx's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 23
So I finished my little test.

Left is my time (GMT+1) right the ~ game time
18:45-19:00 sunrise ~ 6-7:00
22:45-23:00 sunset ~18-19:00
0:30 ~ 5:00
0:45 sunrise/dawn ~5-6:00
1:00 ~ 9:00
1:30 ~ 10:00
1:45 ~ 10:30
2:00 ~ 11:00

It will be difficult to make a clock out of this^^
But I think we can see from this data
that a night is 2h long (22:45-0:45)
and the day is 4h long (18:45-22:45).

If we say
the night is from 20-4:00 we have 8h real time in 2h game time
which makes the 4h game time left: 16h real time.

I will test this tomorrow (later today) again to check my data.
  Reply With Quote
04/14/14, 04:41 AM   #12
fatmanboozer
Join Date: Apr 2014
Posts: 5
Interested Moon Cycle Mod

I would be interested in the progress of this especially if some one could make a mod to monitor the moon cylce
  Reply With Quote
04/14/14, 05:32 AM   #13
Stormknight
 
Stormknight's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 128
I was just thinking that there's functionality in the game for things to happen based on whether it's night or day (vampires being the obvious example), so there *might* be something buried away in the ZO API that isn't documented on the Wiki here.

I'm thinking about one of the ZO_ functions or events.

I know better than to ask if there's an update on that stuff being generally released, but ..... could someone with access to it check?

edit: Has Anyone checked what "ZO_WorldMapCornerTime" does?

Last edited by Stormknight : 04/14/14 at 07:33 AM.
  Reply With Quote
04/14/14, 08:07 AM   #14
Tyx
 
Tyx's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 23
I didn't test it but I think it has something to do with the time (OS Time) which is at the top left corner if you open your map.

EDIT1: I created a little AddOn on base of a DB where you can put a example time to calc the in-game time from there.
Like I see the sun setting and use the command /cl sunset to save the time.
Because we know that a day is 6h long (2h night 4h day) - I hope this is right^^ - it will now set the midnight 1h, the sunrise 2h and noon 4h later (and all of that 4x because 6*4 = 24 )

But it has one big problem if the day-night cycle isn't 6h long xD
And an other small one because I get an Error right after the login.
Lua Code:
  1. local mid_h = settings.gameTime["midnight"]["h"] --[[ <-- ERROR ATTEMPED
  2.             user:/AddOns/Clock/Clock.lua:135: attempt to index a nil value stack traceback:
  3.             user:/AddOns/Clock/Clock.lua:135: in function 'GetInGameTime'
  4.             user:/AddOns/Clock/Clock.lua:199: in function 'PrintClock'
  5.             18135679543117558641:3: in function '(main chunk)' ]]

Lua Code:
  1. -------------------------------------------
  2. --                Start
  3. -------------------------------------------
  4. local function Clock_OnLoaded(eventCode, addOnName)
  5.     if(addOnName ~= "Clock") then
  6.         return
  7.     end
  8.     settings = ZO_SavedVars:NewAccountWide("Clock_Settings", 0.1, "settings", defaults)
  9.     -- Commands
  10.     -- Register
  11.     -- Unregister
  12. end
  13. ------------------
  14. --   Init
  15. ------------------
  16. local function Clock_Init()
  17.     EVENT_MANAGER:RegisterForEvent("Clock", EVENT_ADD_ON_LOADED, Clock_OnLoaded)
  18. end
  19.  
  20. Clock_Init()

I use the xml OnUpdate function to call my function PrintClock(). I think it is called before the settings are loaded/saved and so it only gets a nil value...

EDIT2: I fixed it (and a lot more) by giving the local settings not the = nil value but the defaults (with the database). So the first few times hte OnUpdate asks for a value it gets the default values back until the user values are loaded.

BTW: http://www.esoui.com/downloads/info2...ndartTime.html my AddOn is online

Last edited by Tyx : 04/14/14 at 04:57 PM.
  Reply With Quote
04/14/14, 08:31 PM   #15
EviliusDucain
Join Date: Apr 2014
Posts: 4
So.. i have a lot of time on my hands.. and during that tons of time i decided to take screen shots at the moon in ESO.

Yesterday i managed to see night time twice. i played from one night time to the other.

i first saw night at 16:45 My local time. then played on till the next night which started at 22:30.

its not exact times i've stated because the screen shots where not taken in at the same stage of night fully. so the time between first night and next night is about 5 hours and 30-45 mins. Night did however last two hours so i suppose 2 hours is to be taken from from the inbetween making it 3 hours and 30-45 mins

I'm going to try and do the same thing tomorrow if not interruptions happens

EDIT: I'm really interrested in this addon and really want it to work proper and for it to be exact. As said i have a lot of time on my hands so i'd be happy to help by dedicating some of my time for the benefit of this addon

EDIT2: okay i'm no math genius. tbh i'm terrible at math BUT. i do have 3 screenshots from 14-04-2014 all around night start. and they are very close to the respected time of 05:00am 16:45pm and 22:30 pm i slept inbetween the 05:00am and 16:45 so i pressume there's been a 2 hour night inbetween that. also it was not night at any of the times i logged on it became night and then i took the screenshots.

Last edited by EviliusDucain : 04/14/14 at 08:47 PM. Reason: arrrgh braaain
  Reply With Quote
04/14/14, 09:58 PM   #16
xevoran
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1
already exists

Tamriel Time
http://www.esoui.com/downloads/info2...Time.html#info

Last edited by xevoran : 04/14/14 at 09:59 PM. Reason: added info
  Reply With Quote
04/15/14, 01:36 AM   #17
EviliusDucain
Join Date: Apr 2014
Posts: 4
Originally Posted by xevoran View Post
it doesn't work correctly tho. tested it. last time it said it was 01:30 pm when it was the darkest point at night
  Reply With Quote
04/15/14, 02:46 AM   #18
Tyx
 
Tyx's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 23
@xevoran yeah that addon looks great - didn't noticed it before, is it new? But like Evilius said it: the time - he use a 4.8h system - is strange.

@Evilius thanks for your work. I think it is easier to find out how long noon is away from the next noon, because it is easier to look at the sun than to find the darkest hour of the night
These are the times I collected yesterday:
left CET and right TST (Tamriel Standard Time )
14:30 12-13h
15:00 14-15h
15:30 16-17h
16:00 18-19h
17:00 ? night
18:00 4-5h dawn
19:00 7h
19:30 9h
20:00 11h
20:30 12-13h
22:00 18-19h sunset
00:00 4-5h dawn

Between the two noons was a 6h wait. And, like you noticed too, the night was 2h long.
I truly hope you are wrong with your 5:30-45h day because it will complicate things^^ But I will test it today

EDIT: I think I have to change my code deeper than I thought. The whole system is based on the 6h system and bugged a lot when I make it a variable... this will take me one day or two.
My plan is to let the user (you) chose to set the time duration (and night) of one day themself or use the default one.
Until we have an exact time (definitely between 5:30 and 6:00h) or an API function this has to do
EDIT2: Damn 6h is it not for sure. The accumulated time delay (the 15min more per "day") have made the sun to set, with the default settings, to 18h (instead of 20h)^^

Last edited by Tyx : 04/15/14 at 07:40 AM.
  Reply With Quote
04/15/14, 03:24 AM   #19
EviliusDucain
Join Date: Apr 2014
Posts: 4
i was just on a moment ago and night started at 9:30 approimately. the times i've given so far is what i belive is the transition moment from where it goes from day to night not the darkest of midnight the moon shots i took was taken at different times during the night but i was online before it transitioned into night each time. i do think my times are mostly correct +/- 10 min off target at most. i suspect i'll see the next night time around 15:15 my time or atleast very close to it. This last night ended at 11:30 so if the other times are correct the day time will last 3h 45m approximately

i'll be sure to get the next nights time regardless.

also i live in gmt +1 so be sure to take that into account when looking at my times

EDIT:also just wanted to point out. its been the same moon all 4 in-game nights now =P

EDIT2: So night happend at 16:00 ... a whole 45 mins later then expected making the day last 4h 30min this time i am not totally sure as i arrived during night at 10:30 or so but night ended at 11:30

EDIT3: At this point i'm starting to get a feeling it would be easier to make an addon that states if its vamp spawn night or werewolf spawn night. people are saying there's 8 days between respawns. and that the beasties will spawn every night time during this day. i got turned saturday at 01:?? am by a ww and 8 days from that makes it sunday the 20th. However since the server is in NA their day would start for us at around saturday the 19th 06:00am If this appears to be true. perhaps its easier to make an addon that goes from there. It would also make people stop having to camp every ingame night in order to hit the right one

Last edited by EviliusDucain : 04/15/14 at 09:23 AM.
  Reply With Quote
04/15/14, 09:31 AM   #20
NWDD
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 3
Hi(TamrielTime author speaking), good thing I found this
I'm looking for noons as a way to find day/night cycle.

Addon won't get time right until day/night cycle is found, every other calculation is already done.
I originaly thought it was a 6h cycle based on preemptive calculations of time.
Then someone linked me the statement of Zenimax Online that says "Each Day/Night cycle lasts for a bit less than 5h" and set it to 4.8, because It integer seconds made sense at the time (3600/4.8 = 5)

After that I've been working on getting the exact time of a cycle by getting noons (sun is at exact south at arround 12:00). Unfortunately It rains every ***** noon. So I had to use shadows.

I'm certain there was a noon 15/04/2014 at 6:33 am (irl, UTC) and another one arround 04/15/14 - 11:47-53 UTC.

I was waiting for this next cycle but we got a surprise maintenance

About vamps, we got a 10-day-no-spawn right now
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » GameTime function


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off