Code:
// Match stats - Main
// DO NOT EDIT THIS FILE
0
1
Code:
// Get match number
if( (half == 1) && (main_in2mapmatch != 1) )
{
if( file_size(stats_file_main, 1) > 2 ) // If there are matches in the stats file
{
read_file(stats_file_main, file_size(stats_file_main, 1) - 1, match_num_str, 31, match_num_len)
stats_match_number = str_to_num(match_num_str) + 1
}
else
{
stats_match_number = 0
write_file(stats_file_main, "// Match stats - Main")
write_file(stats_file_main, "// DO NOT EDIT THIS FILE")
write_file(stats_file_main, "")
}
num_to_str( stats_match_number, match_num_str, 31 )
write_file(stats_file_main, match_num_str)
}
else
{
read_file(stats_file_main, file_size(stats_file_main, 1) - 1, match_num_str, 31, match_num_len)
stats_match_number = str_to_num(match_num_str)
}
The code above is supposed to read the last line of a file (the last match's id) from a file and increment the id for this match. Or if there are no matches in the file, then make the match number = 0.
The problem: Right now 'stats_match_number' will not increment past 1...
Any help would be appreciated...Thanks!
*EDIT* Nevermind O

...Figured out that write_file writes and extra newline/linefeed to the file, so the file line should be: "file_size(stats_file_main, 1) - 2", instead of: "file_size(stats_file_main, 1) - 1"
__________________