Access amount of time played variable?

Place to get help with not working mods / modding interface.
Post Reply
User avatar
metzyn
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Tue Mar 19, 2013 10:49 pm
Contact:

Access amount of time played variable?

Post by metzyn »

Is there a way I can get access to the variables that store the amount of time played? I want to take that time and format it in a way that will display the amount of in-game time a player has experienced, such as how many days, months, and years have gone by.
Factorio Modder
Solar Expansion

User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: Access amount of time played variable?

Post by FreeER »

perhaps game.tick? I do not know if there is a formated version available or not
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me :)
Or drop into #factorio on irc.esper.net

User avatar
metzyn
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Tue Mar 19, 2013 10:49 pm
Contact:

Re: Access amount of time played variable?

Post by metzyn »

Its not game.tick for what I am looking. After you save a game or when you are about to load one, you can see how much time you've spent in that level. My most recent displays over 27 hours. Is there a way I can get access to that variable, perhaps via "glob" dot something?

EDIT:
You are correct! "game.tick" is actually what I need.
Factorio Modder
Solar Expansion

User avatar
metzyn
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Tue Mar 19, 2013 10:49 pm
Contact:

Re: Access amount of time played variable?

Post by metzyn »

Is my math correct in that 25,000 ticks per in-game day?

EDIT:
Nope... but I'm super close. Its slightly less than 25,000 ticks. Hey, Factorio devs! What is the exact amount of ticks to an in-game day?
Factorio Modder
Solar Expansion

drs9999
Filter Inserter
Filter Inserter
Posts: 831
Joined: Wed Mar 06, 2013 11:16 pm
Contact:

Re: Access amount of time played variable?

Post by drs9999 »

25k ticks/day is correct:
https://forums.factorio.com/forum/vie ... f=18&t=738

BUT if you are playing on an older pc, like me you will not reach the 60tick/sec, so if you try to convert the total ticks into hours, minutes, seconds the calculation probably messed up because of this...

User avatar
metzyn
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Tue Mar 19, 2013 10:49 pm
Contact:

Re: Access amount of time played variable?

Post by metzyn »

Shame on me for not doing the research to find the ticks/day. Thank you for linking the resource. Right now I have the days, months, years all tied to the game tick. I noticed it was slightly off after a full 24 in-game hours. Not using an older PC... I assume the game shoots for 60/sec and probably bounces between 58-60, which would account for the slight difference.
Factorio Modder
Solar Expansion

Post Reply

Return to “Modding help”