Converting Playing Time to ingame Date and Time

The place to discuss scripting and game modifications for X²: The Threat.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

Gerhald
Posts: 5
Joined: Wed, 6. Nov 02, 20:31

Converting Playing Time to ingame Date and Time

Post by Gerhald »

Hello,

Can someone explain how to convert the script's 'get playing time' function, that returns the number of seconds someone has played the game, can be converted to the ingame date and time that is e.g. displayed in the message logs and player information section (764-07-01 00.00 format)

Or explain how the days, months and years are calculated by parsing the playing time?

Greetings
Gesture
jlehtone
Posts: 22552
Joined: Sat, 23. Apr 05, 21:42
x4

Post by jlehtone »

Not sure, but I guess that one simply follows:
60s=1min
[Edit :oops:]60min=1d
60min=1h
24h=1d
30d=1m
12m=1y

and adds to the date from the start of game. Takes some simple number crunching.

X3 has a Script Editor command that does the formatting, but X2 apparently not.
Last edited by jlehtone on Thu, 18. Nov 10, 22:11, edited 1 time in total.
User avatar
Chris Gi
Posts: 960
Joined: Wed, 20. Sep 06, 09:57
x3tc

Post by Chris Gi »

jlehtone is right - here's the exact formula:

$temp = $PlayingTime/86400 + 275220
$Year = $temp/360
$Month = ($temp/30) % 12 + 1
$Day = $temp % 30 + 1
$Hours = ($PlayingTime / 3600) % 24
$Minutes = ($PlayingTime / 60) % 60
--------------------------------

[ external image ]
User avatar
Shadow dream
Posts: 1840
Joined: Thu, 1. Mar 07, 11:39
x3tc

Post by Shadow dream »

jlehtone wrote: 60min=1d
:gruebel:
I'm not so sure if he is right ;)

Shadow
Wahre Gentlemen behalten sogar umzingelt von Löwen ihren Leitsatz: Ladies first.
Wann lernt die Gesellschaft endlich, dass Geld erst die Probleme macht, die wir haben?
[ external image ]
Topic - Gallery - Forum - Freiheit
jlehtone
Posts: 22552
Joined: Sat, 23. Apr 05, 21:42
x4

Post by jlehtone »

:oops: No wonder I seem to run out of time all the time ...
Gerhald
Posts: 5
Joined: Wed, 6. Nov 02, 20:31

Thanks

Post by Gerhald »

Thanks for the quick reply! 8)

Return to “X²: The Threat - Scripts and Modding”