Hello there;
I just got Blades of Avernum, and after playing the scenarios that come with the game, I'm starting in on my own.
I just had a question; has anyone put the script call documentation in a friendly online browsable format like PHP has for their language? (go http://www.php.net and click documentation). If not, then I'll probably set up documentation like that and make it publically accessible. It's just a lot easier than rifling through the massive pile of printouts I have now.
Anyway, I made a script to keep track of the time of day. This script may be entirely stupid, there may be a way to do this already, but this is what I've come up with. I've basically assumed Avernum has a 20 hour day (5000 ticks in a day, didn't break into 24 evenly). The game starts at dawn, 5 o'clock, and it gets dark at 20 o'clock (dusk is around 19 o'clock). Night is a LOT shorter than day.
It preserves the hour from save to save, and takes 5 stuff done flags. Because I was dealing with numbers over 255, I had to break 2 of the variables out into 2 seperate stuff done flags appiece.
(in scenario script)
Code:
variables;short oldtime,newtime,daycount,hour;...beginstate START_SCEN_STATE;// Initialize time counter set_flag(0,2,1); set_flag(0,4,1);...// This state is called every tick wherever the party is in the scenario.// I use it to track time. Avernum appears to have a 20 hour day that// starts at 5 and nightfalls around 20.//// Requires flag 0,0 (time), 0,1 (oldtime msb) and 0,2 (oldtime lsb)// 0,3 (daycount msb), 0,4 (daycount lsb)beginstate START_STATE; oldtime = ( get_flag(0,1) * 250 ) + get_flag(0,2); daycount = ( get_flag(0,3) * 250 ) + get_flag(0,4); newtime = get_current_tick(); daycount = daycount + tick_difference(oldtime,newtime); set_flag(0,1,( newtime / 250 ) ); set_flag(0,2,( newtime % 250 ) ); if ( daycount >= 5000) { daycount = daycount - 5000; } hour = ( daycount / 250 ) + 5; if ( hour > 20 ) { hour = hour - 20; } set_flag(0,0,hour); set_flag(0,3,( daycount / 250 ) ); set_flag(0,4,( daycount % 250 ) ); print_big_str("Current time: ",hour,".");break;