Leaderboard Check

fronobulax

Developer
Staff member
Not sure what the right place for this is either.

One of the things I do daily that is not, as far as I know, automated or otherwise supported by mafia is to check the various leaderboards and see if I am on any of them. Changing that is something that might be moving off of the back burner.

My first idea was to embed the check within mafia. The new code would check and write something like "Fronobulax appears in the Weird Leaderboard page." in the Events/Announcements window. Aside from the fact that I'm not quite comfortable with the portion of the mafia codebase I would have to use, when the obvious enhancement requests are made - look for my friends, contacts or my clannies - the feature has the potential to require a user interface or take a lot of time during log in. Neither of those are especially desirable.

An alternative that I am getting more comfortable with would be a script. I think the general approach would be to visit each page that has leaderboards, search for names, and then report. The names could be in a text or parameter file that would be initially populated with just the player's name. The user would edit the file if other names should be checked. The gotcha would be in the string search. Inevitably whatever I implement first will either choke because there is a player name like FronobulaxMulti or because player names can have whitespace or other characters that are often used as delimiters.

Thoughts? Suggestions? Alternatives? Pointers to where it has already been done?

Thanks.
 

jasonharper

Developer
Player names on the leaderboards are always in boldface, so searching for "<b>" + playerName + "</b>" should be unambiguous.
 

Grotfang

Developer
Only semi-tested. I figured ids were unambiguous.
 

Attachments

  • leaderboard..ash
    2 KB · Views: 25
Last edited:

fronobulax

Developer
Staff member
Wow. I guess that answers my question about a reasonable way to do things. Thank you very much. I will run and test when I'm not behind nanny software.
 

lostcalpolydude

Developer
Staff member
Only semi-tested. I figured ids were unambiguous.

If someone's id is 1988, this will match 19885.
Code:
if( contains_text( board[int].page , "href=\"showplayer.php?who=" + my_id().to_string() ) )
should be
Code:
if( contains_text( board[int].page , "href=\"showplayer.php?who=" + my_id().to_string() + "\"" ) )
and
Code:
else if( contains_text( board[int] , "showclan.php?whichclan=" + clanId.to_string() ) )
should be
Code:
if( contains_text( board[int] , "showclan.php?whichclan=" + clanId.to_string() + "\"") )
I made it just an if instead of else if because people probably want to see both things there.
 

Grotfang

Developer
Cheers. That was a pretty hastily done script, to be honest. As for the if vs else - no board has clans and individuals on it at the moment. Hence me thinking it was ok.
 

fronobulax

Developer
Staff member
The original kind of worked. It found me on a Familiar kills leaderboard I had no idea I was on and so never tried to track. However it missed me on a collection. That was because the link is to displaycollection and not showplayer. I have attached what is working for me. Cleaning it up, making it pretty and tweaking so it will look for players of my choice is on my todo list but not until my obsession with the display case cools down. Thanks.
 

Attachments

  • leaderboard..ash
    2 KB · Views: 26
Top