QuickQ: visit_url("clan_hall.php");

StDoodle

Minion
Does anyone know what the results are of the above function for someone who's clanless? Since characters are never auto-deleted anymore, I'm hesitant to make a new one just to check that.

I'm wondering if it throws an error, returns "", or redirects to "town_clan.php" (or something else entirely). Anyone with a clanless character who would be willing to copypasta the results as a reply I would be most grateful to.
 
You can leave your current clan without joining a new one by going to the Members page and using the button at the bottom. To answer the question, it sends you to the clan recruiter page.
 
Thanks for pointing out the "Leave Clan" option; somehow I'd never noticed it.

However, I'm getting a void result from visit_url("clan_hall.php") & visit_url("town_clan.php") with a clanless character... not sure what I can do with that... but I'll check it out.
 
Oh, my method was outside of mafia, tested with the hot stuffing method. If the results are different, that's both strange and probably not helpful.
 
Oh, my method was outside of mafia, tested with the hot stuffing method. If the results are different, that's both strange and probably not helpful.

I think the redirects only happen when doing something in KoL proper (even hot-stuffing style); I'm pretty sure mafia ignores them.

But no biggie; just need to use a function with a testable return value that is set up to only return a certain value if nothing else returns, and make sure everything else WILL return, unless a string ends up VOID.

Now if I could just figure out how to handle quotes inside of a matcher... :P
 
Add a \ in front of the quote (so ' \" '). At least, it -should- work. I think.

Yeah, I thought so, but I'm wondering if I need multiple escapes to deal with ash string + matcher or what...

All I know is I'm trying to the name of a character's current clan with this:
Code:
string current_clan() {
	matcher mat =
		create_matcher(
			"<b>Clan Hall</b></td></tr><tr><td style=\"border: 1px solid blue; padding: 5px;\">" + 
			"<center><table><tbody><tr><td><center><b>(.+?)</b>",
			visit_url("clan_hall.php"));
	if (find(mat)) { return group(mat,1); }
	return "";
}

but I'm not having any luck...
 
Last edited:
Couldn't you prune your matcher to just "<center><b>(.+?)</b>"? As far as I can tell, that should work, and it'd bypass any silly escape issues.
 
Oh LOLZ. Apparently, the problem is that <tbody> doesn't actually exist in the version grabbed by visit_url... not sure where it creeps in, but THAT'S what was killing the matcher, not any special characters. Doh!
 
You could also grab the clan name from showplayer.php (public charsheet) without worrying about whether or not the character is in a clan.
 
This link is very helpful when building matchers:
http://www.fileformat.info/tool/regex.htm

FYI
For getting the clan name (taking directly out of my function library MrEdge73's Support Script -- Functions (Beta).ash):
Code:
//gets name of clan
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
string get_clan()
{
    string hall = visit_url( "clan_hall.php" );
    matcher m_clan = create_matcher( "<td><center><b>([^<]+)</b><br>" , hall );
    if( m_clan.find() )
    {
        return m_clan.group( 1 );
    }
    return "none";
}
 
Last edited:
Back
Top