Feature - Implemented ash function: time() || welcome back

StDoodle

Minion
Ok, I realize the folks in Hardcore Nation are a strange group. But we have a very long-standing tradition of bricking each other pre-tent, post-ascension. Once upon a time, (I think, but could be wrong) mafia posted your "Welcome Back" message in /clan automatically. However, that hasn't been happening for a while.

Now, I've scripted it, but there's one major limitation in doing so with the same format; getting the current time is a PITA. My own personal script visits an external URL to grab the time, but anything I can think of that would be publishable would either require manually setting up your timezone or writing a massive script to translate the time zone on one's account page into an actual zone I could check elsewhere.

Now, my end goal is simply to be able to post the "Welcome Back" message, so if anyone can think of a shortcut for that (which doesn't involve ignoring the time), that would be awesome for me. But it would be easy enough to script if I could just access the time from ash, so if anything new is going to be added, this would probably help the largest number of people.

Thanks for your consideration!
 

StDoodle

Minion
Theraze, I'm looking for something that won't just work for me (I have that), but something my clannies could use as well. However, I don't recall if your gametime_to_int() gives an actual time; didn't it just give time to rollover? So people would still need to tell mafia how to translate that into "real" time? /me is confused again...
 

Theraze

Active member
Sorry, put an example above. It actually pulls the milliseconds after rollover, so you can either use that in a reversed way (post 13, I think, in the link above) to do time until rollover, or use as above to calculate time after rollover in a standard forward fashion.

It wasn't implemented because not enough people wanted it, if memory serves. If you can show that there's a market for the patch to be included, it might happen. Alternatively, if time() || welcome back was removed on accident, that could just get turned back on...
 

StDoodle

Minion
In order to reparse server time to local time (used by the "Welcome Back" message), one needs to know your offset from server time. If there's a way to sanely get that, this would be fine. If not, it would leave me in the same position I am now. :(
 

Theraze

Active member
Yeah... fraid that's something you'd have to calculate yourself. No timezone saved to preferences, and the only TimeZone bit in the commands involves figuring out when rollover happens for deciding on how much to pull for session logs...
 

Bale

Minion
Tell you what, if you script this to create the proper welcome back message, I'll be glad to add it to newLifew with a check to see if current clan is HCN before automatically sending it to clan chat.
 

StDoodle

Minion
No, that's why it's funny. :)

But just to be clear, I would never abuse my power that way. (I'd abuse it other ways...?)
 

fronobulax

Developer
Staff member
Meanwhile, back at the feature request...

What exactly do you want? The proposed time() function returns a string in what format? Is it just a time or would a complete date and time string that you could extract from be more useful? AM/PM or 24 hour clock?

What clock should be used? Local computer or KoL server? What time zone should the result be reported in?

Asking the computer running mafia what time is it and returning the formatted result is pretty trivial because the tough questions have whatever the local computer uses as the default answer. The time from the KoL servers in their time zone is a little less trivial but feasible. Anything else is probably more trouble than it is worth to me to implement.
 

StDoodle

Minion
I'm fine with any of those solutions. Since we already have today_to_string(), including the date isn't necessary. Either system time, or a parsing of KoL time w/ KoL account time offset would be fine; I'd imagine system time would be simpler. Having KoL time (relevant to rollover) and the offset would probably be ideal, as that would also be quite useful for a few data-sharing applications, but not a big enough issue to justify any significant amount of extra work. As far as format, again, I'm not overly concerned; parsing one to another is trivial, so whatever is easiest is ok with me.
 

fronobulax

Developer
Staff member
r8942

Sort of. get_TG() returns the local time (according to the computer running KoLmafia) in HH:mm:ss z format. I spent far too much time unsuccessfully trying to get the time in Arizona instead of local and this was a good place to give up. If anyone feels motivated to update the wiki I would appreciate it.

If this is not useful, let me know and I can revert.
 

Theraze

Active member
So... would you like it to work in Arizona time, or was that just a ponderance? If nothing else, could potentially allow it to accept the timezone requested...

And for curiosity, what does TG stand for? TimeGame?
 

StDoodle

Minion
Local time (according to user's computer is fine) was my 1st priority / desire, so if anything beyond that is proving a pain, no worries / I'm happy. I have to agree with Theraze, though, that get_TG() is a rather odd sounding function name...

Wait, z is GMT offset right? If so, absolutely no need for anything more! Thank you!
 
Top