map stats

Talk about Severance Blade of Darkness modifications and maps here. No tips or tech support questions please, use the forum above. Note that the game is rated 18 so some content may be unsuitable for younger readers.

Moderators: prospero, Ade

User avatar
cieply
Dragon
Posts: 330
Joined: Wed Jun 26, 2013 3:43 pm

map stats

Postby cieply » Wed Jun 26, 2013 3:49 pm

## map stats mod
I wanted to make some simple map stats at the end, and what I did was to add this code to the very end function of the map
eventually i found this @ $BOD/Scripts/GoToMapsVar.py

--- @ $BOD/Scripts/GoToMapsVar.py

Code: Select all

def EndOfLevel(): ##i1: stats F_stats = open("map_stats.txt","wt") F_stats.write('############################################################\n') F_stats.write('# map statistics\n') import time # needed for time.asctime F_stats.write('# File created %s \n'%(time.asctime(time.gmtime(time.time())),)) F_stats.write('############################################################\n\n') import GameText # needed for GameText.MapDescriptor() F_stats.write('map: %s\n'%(GameText.MapDescriptor(Bladex.GetCurrentMap()))) time_map_finished = Bladex.GetTime() time_mf_h = int((time_map_finished/3600)) time_mf_m = int((time_map_finished-time_mf_h*3600)/60) time_mf_s = int((time_map_finished-time_mf_h*3600-time_mf_m*60)) F_stats.write('time (h:mm:ss): %0d:%2d:%2d\n'%(time_mf_h, time_mf_m, time_mf_s)) F_stats.write('time (game sec.): (%f)\n'%(time_map_finished)) #F_stats.write( ('map time (game sec.): ' + str(time_map_finished) + '\n') ) F_stats.write('\n#\n# Good Bye! (Enjoy The Silence)\n#\n') F_stats.close()

--- (...) rest of EndOfLevel(): body

this creates file ``map_stats.txt'' in map directory with stats like this:
--- map_stats.txt
############################################################
# map statistics
# File created Wed Jun 26 08:02:25 2013
############################################################

map: The Temple of Ianna
time (h:mm:ss): 0:14:49
time (game sec.): (889.187500)

#
# Good Bye! (Enjoy The Silence)
#
--- EOF map_stats.txt

now, a questions are:

1. I wanted to make it simpler and put into map_stats.py but when called ``execfile("map_stats.py")'' in def EndOfLevel(): map hangs
same with any attempt to create a module, import and call it. what I did wrong?
2. how to do that in more elegant way by making a module, then ``import map_stats'' in a code and call a function let's say ``save_map_stats()'' so it works
+ 3. is there a way to do that for every EndOfMap event so stats are generated for every map at the end of it automatically without interfere in every map code
4. is that possible to display stats at the very end of map (after end cut scene) with something like Actions.ReportMsg (stats)
lets say I want to use this:

Code: Select all

stats = ('map time (h:mm:ss): %0d:%2d:%2d\n'%(time_mf_h, time_mf_m, time_mf_s)) Actions.ReportMsg (stats)
how to stop it in this state for some amount of time and/or until keyboard pressed or something like that
obvoiusly not this way:

Code: Select all

while Bladex.GetTime() < time_map_finished + 5.0 : stop = 0
I tried but it doesn't work, only ^ saving to a file


it would be even greater if it was with bigger font, like main menu font and was waiting for mouse click or keyboard input to cancel displaying stats and finish map

5. with the above (@ $BOD/Scripts/GoToMapsVar.py) solution is a small roblem - it doesn't work with Abyss map (Chaos_M17); looks like it doesn't go into ``GranFinalDelNivel()''
probably interference with map code will be needed anyway
6. where can I find information like number of enemies killed and total, distance travelled (probably can't this one)
7. I've just finished a map in 9 minutes straightaway and statistics says it took me 18, is the time got from ``Bladex.GetTime()'' in seconds? doesn't look like.
another example: Tomb_Back: short run with stopwatch: 0:01:18, and in game time: 0: 1:39 (99.171875)[s]
Palace_Back: with stopwatch: 0:00:12, and in game time: 0: 1:33 (93.218750)[s]
l'aria fresca,
vino puro, ...

Return to “Severance BoD: Modding Community”

Who is online

Users browsing this forum: No registered users and 17 guests

cron