Frictional Games Forum (read-only)

Full Version: [PoC] Live Clock
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I haven't released a PoC map in a while, but this is an idea that's been rattling around in my mind for long enough that I just had to get it down.

[Image: fac06aa830.gif]

It started way back when I was working on compiling the hps_api script reference on the wiki and I noticed the cDate object as well as the cSystem_GetDate function. I figured that if HPL3 has a function for getting the system date, then it would be fairly trivial to create a kind of clock mod. But that function was also buried fairly deep in hps_api that I'd guess most people wouldn't even know that it exists. So yeah.

A note about its triviality, though. When you have a cDate object, it has fields for all the stuff you would want, from years to seconds and everything in between. The problem, however, is that the values of these fields are a bit nonsensical. Now I'm pretty sure that they are in some kind of standardized format and there's some kind of simple conversion from raw system time to human-readable format, but I found an easier way. There's another function called cLux_GetStringWFromDate that does the conversion automatically. The downside is that you get the information in one long string which you then have to manually split up and parse into numbers, but that's not that big of a deal at all, so I consider the trade-off to be worth it.

As usual, you can grab it on Steam Workshop.