![]() |
#1 |
Rookie
Join Date: Dec 2020
Posts: 4
![]() |
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? Thanks |
![]() |
![]() |
![]() |
#2 |
Rookie
Join Date: Dec 2020
Posts: 4
![]() |
Here is a quick Python script I knocked up that outputs a CSV file, in case anyone else finds it useful:
Code:
#!/usr/bin/env python3 # dumpscores.py # 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 try: scores = sys.argv[1] except IndexError: print("Usage: " + os.path.basename(__file__) + " <scores.raw>") sys.exit(1) # 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"] try: 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: high_score=f.read(struct_len) 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 f.close() except IOError: print('Error While Opening the file!') |
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Weapon stats table? | feveredmonk | Vanilla | 6 | December 1, 2021 00:28 |
Angband variants table | tangar | Variants | 18 | March 12, 2021 19:55 |
SAngband: New high score 17579 | xorzac | Variants | 0 | September 25, 2016 07:53 |
Sil: melee to-hit chance table | BlueFish | Sil | 25 | August 22, 2013 10:07 |
Score not registered? | Swede2378 | Vanilla | 1 | June 13, 2010 20:02 |