Go Back   Angband Forums > Angband > Vanilla

Thread Tools Display Modes
Old May 26, 2022, 13:21   #1
Join Date: Dec 2020
Posts: 4
Gelina is on a distinguished road
View all of high score table?

Is it possible to view the full 100 entries of the Angband high score table? I'm using v4.2.0 and I can only see the top 5 plus another page or two of 5. I'd really like to scroll up/down the entire list in-game, or perhaps a script to dump all 100 entries from scores.raw out to a text file?

Looking at function show_scores() in src/ui-score.c the code to do it is all there, but not used?

Gelina is offline   Reply With Quote
Old May 26, 2022, 19:42   #2
Join Date: Dec 2020
Posts: 4
Gelina is on a distinguished road
Here is a quick Python script I knocked up that outputs a CSV file, in case anyone else finds it useful:

#!/usr/bin/env python3

# Dump Angband high scores file 'scores/scores.raw' file in CSV format
# Python3 script by Gelina, 26/May/2022

import os
import sys
import struct

  scores = sys.argv[1]
except IndexError:
  print("Usage: " + os.path.basename(__file__) + " <scores.raw>")

# from score.h
# Semi-Portable High Score List Entry (128 bytes)
# null terminated strings, with numbers right justified & space padded
struct_fmt = '8s10s10s10s10s16s8s3s3s4s4s4s4s32s'
struct_len = struct.calcsize(struct_fmt)
struct_unpack = struct.Struct(struct_fmt).unpack_from

# from gamedata/p_race.txt
races = ["Human", "Half-Elf", "Elf", "Hobbit", "Gnome", "Dwarf", "Half-Orc", 
  "Half-Troll", "Dunadan", "High-Elf", "Kobold"]

# from gamedata/class.txt
classes = ["Warrior", "Mage", "Druid", "Priest", "Necromancer", "Paladin", 
  "Rogue", "Ranger", "Blackguard"]

  with open(scores,"rb") as f:
    print("Position,Score,Gold,Turns Taken,Time stamp,\"Player Name\","
      "Player UID,Player Race,Player Class,Player Level,Dungeon Level,"
      "Player Max,Dungeon Max,\"Method of death\",Turns/Player Level")
    start = 1
    while True:
      if not high_score: break
      s = list(struct_unpack(high_score))
      for i in range(len(s)):
        s[i] = s[i].strip(b'\0 ').decode()
      aged = int(s[3])
      when = s[4]
      if (when[0] == '@' and len(when) == 9): 
        when = '-'.join([when[1:5], when[5:7], when[7:9]])
      r = races[int(s[7])]
      c = classes[int(s[8])]
      cdun = int(s[10])
      mlev = int(s[11])
      killed = ' '.join(["Killed by", s[13], 
        "on dungeon level "+str(cdun) if (cdun) else "in the town"])
      print(start, int(s[1]), int(s[2]), aged, when, '"'+s[5]+'"', int(s[6]), 
        r, c, int(s[9]), cdun, mlev, int(s[12]), '"'+killed+'"', 
        round(aged / mlev), sep=',')
      start += 1
except IOError:
     print('Error While Opening the file!')
I've added a Turns per Player Level column to give me an idea of how fast my characters are diving.
Gelina is offline   Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Angband variants table tangar Variants 26 November 27, 2022 20:26
Weapon stats table? feveredmonk Vanilla 6 December 1, 2021 01:28
SAngband: New high score 17579 xorzac Variants 0 September 25, 2016 08:53
Sil: melee to-hit chance table BlueFish Sil 25 August 22, 2013 11:07
Score not registered? Swede2378 Vanilla 1 June 13, 2010 21:02

All times are GMT +1. The time now is 19:47.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.