View morgue file after dying.


Ask fellow adventurers how to stay alive in the deep, dark, dangerous dungeon below, or share your own accumulated wisdom.

Shoals Surfer

Posts: 267

Joined: Friday, 26th April 2013, 17:05

Post Monday, 27th January 2014, 10:24

View morgue file after dying.

Is there way to view your morgue file as soon as you die, or do you have to close the game and go find the individual file. (if there is no way, i'd love to see an option to see latest morgue file.)

And yes i know you can check your morgue files individually, but i'd prefer there to be ability to look up latest quickly and in client. Not a big thing be it would still be an nice option.

Blades Runner

Posts: 546

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

Post Monday, 27th January 2014, 11:10

Re: View morgue file after dying.

Not in-client, but you can do this with inotifywait on Linux.

  Code:
#!/bin/sh
#Save this as something like 'crawlwatch' and chmod +x it.
# then use it to run crawl instead of typing 'crawl-tiles'.
# Hit Ctrl+C to exit the loop.

VIEWER="geany --read-only"
# if you don't have wmctrl installed, this will produce a harmless error
# (and not attempt to raise the window)
RAISE="wmctrl -a geany"

crawl-tiles&
while true; do
   #Watch the morgue directory
   FNAME=$(inotifywait -e CREATE ~/.crawl/morgue/ | sed 's/ CREATE //g')
   # If it looks like a morgue, view it.
   if echo "$FNAME" | grep -E "morgue-[^/]+\.txt"; then
      $VIEWER "$FNAME"
      $RAISE
   fi
done


Tested, works. On Arch Linux, substitute .crawl/ -> .stone-soup/

Shoals Surfer

Posts: 267

Joined: Friday, 26th April 2013, 17:05

Post Monday, 27th January 2014, 11:32

Re: View morgue file after dying.

savageorange wrote:Not in-client, but you can do this with inotifywait on Linux.

  Code:
#!/bin/sh
#Save this as something like 'crawlwatch' and chmod +x it.
# then use it to run crawl instead of typing 'crawl-tiles'.
# Hit Ctrl+C to exit the loop.

VIEWER="geany --read-only"
# if you don't have wmctrl installed, this will produce a harmless error
# (and not attempt to raise the window)
RAISE="wmctrl -a geany"

crawl-tiles&
while true; do
   #Watch the morgue directory
   FNAME=$(inotifywait -e CREATE ~/.crawl/morgue/ | sed 's/ CREATE //g')
   # If it looks like a morgue, view it.
   if echo "$FNAME" | grep -E "morgue-[^/]+\.txt"; then
      $VIEWER "$FNAME"
      $RAISE
   fi
done


Tested, works. On Arch Linux, substitute .crawl/ -> .stone-soup/


Thank you, but I use windows (I know shame on me.)

Blades Runner

Posts: 546

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

Post Monday, 27th January 2014, 14:08

Re: View morgue file after dying.

There are similar tools available for Windows, but I don't know anything much about them.

Ziggurat Zagger

Posts: 6454

Joined: Tuesday, 30th October 2012, 19:06

Post Monday, 27th January 2014, 15:43

Re: View morgue file after dying.

This pretty much works:

  Code:
@echo off
"crawl.exe"
for /F %%i in ('dir /B /O:-D "morgue\morgue*.txt"') do (
    call :open "%%i"
    exit /B 0
)
:open
    start "dummy" "morgue\%~1"
exit /B 0

Drop that into a batch (whatever.bat) file in your crawl directory and run it to open crawl. It should open the most recent morgue file when crawl closes. You may have to adjust the crawl morgue directory (If it's not a subfolder of wherever crawl is installed) and this calls 'crawl.exe' which on my system is the console version of crawl.
Spoiler: show
This high quality signature has been hidden for your protection. To unlock it's secret, send 3 easy payments of $9.99 to me, by way of your nearest theta band or ley line. Complete your transmission by midnight tonight for a special free gift!

For this message the author Siegurt has received thanks:
siprus

Blades Runner

Posts: 546

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

Post Monday, 27th January 2014, 22:53

Re: View morgue file after dying.

Siegurt wrote:This pretty much works:

  Code:
@echo off
"crawl.exe"
for /F %%i in ('dir /B /O:-D "morgue\morgue*.txt"') do (
    call :open "%%i"
    exit /B 0
)
:open
    start "dummy" "morgue\%~1"
exit /B 0

Drop that into a batch (whatever.bat) file in your crawl directory and run it to open crawl. It should open the most recent morgue file when crawl closes. You may have to adjust the crawl morgue directory (If it's not a subfolder of wherever crawl is installed) and this calls 'crawl.exe' which on my system is the console version of crawl.


Could be improved by storing the latest modification time found in the morgue directory, then opening each of the files that are newer than that (avoiding the 'I didn't really care about that character, I wanted the other one that died this session' problem)

Yet another approach, if you have Python installed, is this:

  Code:
#!/usr/bin/python
#
# The above is required for identification, even on Windows, IIRC.
#
# Ctrl+C or Ctrl+D to exit.
#
import sys, os, time
import glob
from subprocess import call

last_files=set(glob.glob('morgue\\morgue*.txt'))
while 1:
    these_files = set(glob.glob('morgue\\morgue*.txt'))
    diff = these_files.difference(last_files)
    if diff:
         for d in diff:
             call(['start','dummy',d])
         last_files=these_files
    time.sleep(15)   # 15s between scans.



Which is admittedly inefficient with its repeated rescans, but will detect and open each new morgue as-it-happens, rather than at the end of each session.

Shoals Surfer

Posts: 267

Joined: Friday, 26th April 2013, 17:05

Post Tuesday, 28th January 2014, 23:37

Re: View morgue file after dying.

Thank you for your trouble. This will be useful.

Return to Dungeon Crawling Advice

Who is online

Users browsing this forum: No registered users and 119 guests

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