Sewer Grate Information

Grotfang

Developer
Hey guys,

In the hobopolis sewers, I am trying to find a way to retrieve the number of grates that have been opened.

I understand that:

Code:
string parse_logs = visit_url( "clan_raidlogs.php" );

Will produce a string of the dungeon logs. The lines I am looking for are all in the fashion:

Code:
<name> opened <number> sewer grate(s)

Therefore I tried the following code:

Code:
string parsed_grates = visit_url( "clan_raidlogs.php" );
	string [int] parsed_lines;
	int count = 0;
	while( contains_text( parsed_grates , "sewer grate" ) )
	{
		parsed_lines[count] = substring( parsed_grates , index_of( parsed_grates , "sewer grate" ) , index_of( parsed_grates , "sewer grate" ) );
		replace_string( parsed_grates , parsed_lines[count] , "" );
		count = count + 1;
	}

I had thought this would create a map of all the lines for sewer grates. However, all it did was froze mafia.

In retrospect, I don't think that even if this did work as expected it would produce the results I wanted, as it wouldn't catch the numbers of how many grates were opened (I'm not overly worried about who opened how many).

Can anyone give me any pointers?

Cheers,

Ben
 

Grotfang

Developer
Cheers.

DoctorRotelle actually gave me a solution to the problem.

This post/thread can probably be deleted now...
 

Bale

Minion
Could you post his response here? I'd love to see if his answer would teach me anything new, though I'd probably just adapt Alihifar's squeezing solution from get_bladders() in slime.ash

Try looking at get_grates() in slime.ash.
You meant get_bladders() right? I love that little function. I've thought about adapting it to summarize a hobopolis log.
 

Alhifar

Member
Err... right. I was actually thinking get_grates() in my hobopolis scripts, but I realized I never finished or released them >.>
 

Grotfang

Developer
Could you post his response here? I'd love to see if his answer would teach me anything new, though I'd probably just adapt Alihifar's squeezing solution from get_bladders() in slime.ash

Of course

Code:
int grates_open()
{	
	int count = 0;
	int open_grates = 0;
	string parsed_grates = visit_url( "clan_raidlogs.php" );
	string p = substring(parsed_grates , index_of( parsed_grates, "sewer grate" ));

	string leftover(string s)
	{
		p = substring(s, index_of( s, "sewer grate" ));
		p = substring(p, index_of(p, "("));
		int i = to_int(substring( p, 0, index_of( p , " turn" ) ));
		count = count + i;
		return p;
	}


	while( contains_text( p, "sewer grate" ) )
	{
		leftover(p);
	}

	print("grates: " + count);
	open_grates = count;
	return open_grates;
	
}
 
Top