record fullness{ item it; int full; }; record inebriety{ item it; int drunk; }; void main() { string[int] sess = session_logs( my_name() , 30 ); string[int] lines; int[item] foods; int[item] boozes; int[item] all_foods; int[item] all_booze; fullness[int] full; inebriety[int] drunk; file_to_map( "fullness.txt" , all_foods ); file_to_map( "inebriety.txt" , all_booze ); int x; foreach it,f in all_foods { x = count( full ); full[x].it = it; full[x].full = f; } foreach it,d in all_booze { x = count( drunk ); drunk[x].it = it; drunk[x].drunk = d; } sort full by value.full; sort drunk by value.drunk; matcher m_food = create_matcher( "eat (\\d+) (.*)" , "" ); matcher m_booze = create_matcher( "drink (\\d+) (.*)" , "" ); foreach key in sess { lines = split_string( sess[key] ); foreach key2,line in lines { m_food.reset( line ); m_booze.reset( line ); if( m_food.find() ) foods[m_food.group( 2 ).to_item()] = foods[m_food.group( 2 ).to_item()] + m_food.group( 1 ).to_int(); else if( m_booze.find() ) boozes[m_booze.group( 2 ).to_item()] = boozes[m_booze.group( 2 ).to_item()] + m_booze.group( 1 ).to_int(); } } //cli_execute( "mirror pvphistory.txt" ); writeln( "
You have eaten/drank:

" ); writeln( "Foods
" ); writeln( "" ); foreach food in foods { writeln( "" ); } writeln( "
NumberFood
" + foods[food] + "" + food + "
" ); writeln( "
Booze
" ); writeln( "" ); foreach booze in boozes { writeln( "" ); } writeln( "
NumberBooze
" + boozes[booze] + "" + booze + "
" ); //cli_execute( "mirror" ); //cli_execute( "mirror stillneed.txt" ); writeln( "
You still need:

" ); writeln( "Foods:
" ); writeln( "" ); foreach i in full { if( !( foods contains full[i].it ) && full[i].it != $item[none] ) writeln( "" ); } writeln( "
FoodFullness
" + full[i].it + "" + full[i].full + "
" ); writeln( "
Boozes:
" ); writeln( "" ); foreach i in drunk { if( !( boozes contains drunk[i].it ) && drunk[i].it != $item[none] ) writeln( "" ); } writeln( "
BoozeDrunkenness
" + drunk[i].it + "" + drunk[i].drunk + "
" ); //cli_execute( "mirror" ); }