total time played


If it doesn't fit anywhere else, it belongs here. Also, come here if you just need to get hammered.

Temple Termagant

Posts: 7

Joined: Friday, 18th April 2014, 14:30

Post Saturday, 5th July 2014, 12:55

total time played

Is there a way to know how much time you've played crawl? I can't seem to find it anywhere.
I don't really feel like going through every morgue file and adding all those play times together because there are a lot of files there.
Could anyone with just a little bit of programming skills code a tiny little program that would calculate your time playing crawl? That would be much appreciated :)
And how do I propose to the developers that they should add this feature in?
User avatar

Blades Runner

Posts: 538

Joined: Saturday, 15th February 2014, 03:22

Location: NYC

Post Saturday, 5th July 2014, 15:29

Re: total time played

Honestly I don't see why you would want an exact number. It isn't hard to estimate. Without adding up the times you can figure an approximate average amount of time on any given game and multiply that by the number of games approximately you have played. Shouldnt take long to do looking at the hall of fame screen in the client.

Zot Zealot

Posts: 1031

Joined: Friday, 26th April 2013, 19:52

Location: AZ, USA

Post Saturday, 5th July 2014, 18:23

Re: total time played

If you play online, you can look it up easily using Sequell: !lg {name} x=sum(dur)

If you play offline, then you have no rights and deserve nothing. :P

dck

Vestibule Violator

Posts: 1653

Joined: Tuesday, 30th July 2013, 11:29

Post Saturday, 5th July 2014, 18:39

Re: total time played

(you also don't count)
User avatar

Shoals Surfer

Posts: 301

Joined: Friday, 8th November 2013, 16:19

Location: Tel'aran'rhiod

Post Saturday, 5th July 2014, 19:56

Re: total time played

You guys are pretty harsh on the offline plebs...

Just navigate into your morgue folder and execute this command:
  Code:
echo - | awk -v "S=$(for i in $(grep -h -m 1 -o -E "[0-9]{2}:[0-9]{2}:[0-9]{2}" morgue-*.txt); do date +'%s' -d "1970-01-01 $i"; done | paste -sd+ | bc)" '{printf "%dh:%dm:%ds",S/(3600),S%3600/60,S%60}'

This only works if you don't have games which took longer than one day.

For this message the author Tedronai has received thanks: 3
duvessa, neil, Roflmaster

Temple Termagant

Posts: 7

Joined: Friday, 18th April 2014, 14:30

Post Saturday, 12th July 2014, 02:15

Re: total time played

Thanks, but, how does one execute a command?
Also, what's wrong with being offline? You don't have to deal with overpowered ghosts of other players :P

Ziggurat Zagger

Posts: 5382

Joined: Friday, 25th November 2011, 07:36

Post Saturday, 12th July 2014, 02:50

Re: total time played

If you aren't familiar with a command like that, you're likely on windows, and wouldn't be able to execute it in the first place.*

It should be entered on the command line, uses various common system utilities like echo, grep, etc which are on linux systems. Macs could probably run it since they're based on BSD, which is similar, but it may require some editing. I have a lot of respect for someone who can come up with complex queries like that for "fun", as I have never been quite that familiar with those utilities. I've done some basic usage, but nothing that involved.

It also goes to show that you can do just about anything in 'one' line on linux :)

*You can install linux environments on windows, but again, I'll assume that isn't the case for you.

Disclaimer: None of this post is meant to sound condescending. There's a lot of "holier than thou" linux is better than windows people out there, but I'm lazy and just want to play video games, I'm not one of them.

Blades Runner

Posts: 546

Joined: Saturday, 7th May 2011, 02:43

Post Saturday, 12th July 2014, 07:27

Re: total time played

@ Tasonir: Too lazy to be elitist, eh? For shame ;)

@ Tedronai: Liked the idea, didn't like the implementation. Here's a Python version I made, which is more easily understandable and also is verified to support playtimes longer than a day. Same idea as yours, run it in the morgues directory and get a total time. The Python version is probably Windows compatible, but I haven't actually tested it on Windows.

For this message the author savageorange has received thanks:
Roflmaster

Temple Termagant

Posts: 7

Joined: Friday, 18th April 2014, 14:30

Post Saturday, 12th July 2014, 09:35

Re: total time played

Yay, a python version that i can actually run! It works in Windows, so thanks a lot.
My playtime is around 65h so I guess I'm still a noob :P
User avatar

Shoals Surfer

Posts: 301

Joined: Friday, 8th November 2013, 16:19

Location: Tel'aran'rhiod

Post Saturday, 12th July 2014, 10:26

Re: total time played

tasonir wrote:It also goes to show that you can do just about anything in 'one' line on linux :)

Anything!
  Code:
vim -c "norm VGJZZ" filename


tasonir wrote:*You can install linux environments on windows, but again, I'll assume that isn't the case for you.

I would go mad without having cygwin available at work.

savageorange wrote:@ Tedronai: Liked the idea, didn't like the implementation.

I can only encourage getting familiar with this standard tool-chain. You can just put out stuff like that on-the-fly and have no need to write actual programs for such trivial queries. Also you can very easily adapt to different queries. If I now want to have the total time played of the games where I encountered Sigmund on the first three dungeon levels I just replace
  Code:
morgue-*.txt

with
  Code:
$(grep -l "D:[2-3].*Noticed Sigmund" morgue-*.txt)

and I am done.

Blades Runner

Posts: 546

Joined: Saturday, 7th May 2011, 02:43

Post Saturday, 12th July 2014, 10:50

Re: total time played

Tedronai wrote:
savageorange wrote:@ Tedronai: Liked the idea, didn't like the implementation.

I can only encourage getting familiar with this standard tool-chain.

Being familiar with the standard toolchain and the construction of one liners from hell is exactly why I'm horrified.

One liners are good for one offs. The rest of the time, they are Sigmund.

Return to Crazy Yiuf's Corner

Who is online

Users browsing this forum: No registered users and 22 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.