My favorites | Sign in
Project Home Wiki Issues Source
New issue   Search
  Advanced search   Search tips   Subscriptions
Issue 88: Another Idea (Auto Friend adder)
3 people starred this issue and may be notified of changes. Back to list
Status:  WontFix
Closed:  Aug 2009

Sign in to add a comment
Project Member Reported by, Apr 28, 2009
I have been using the MAfiawars quick invite, and Facebook invites
scripts.. however they suffer from a serious flaw. 

The script goes to the application page on facebook that lists all your
friends that use the application. This page is very unreliable. sometimes
when I go to it, it shows 5 friends use mafia wars, sometime 46, sometimes
141, sometimes 310.... in reality I have about 600 on my newest profile.  

The script itself works, it's the Zynga, Facebook connection that's bad.
What if we added this feature:

1) switch to your "all Friends" list.
2) Cycle through, collect all the User ID's
3) Go to the mafia wars invite page and check the list of people to be
invited (if they are in the list they have not yet joined your mafia)
4) Convert the names in the list to the UID and invite them all with the
5) Repeat on demand or every x hours.

Hitting the quick link for a friend that does not play Mafia wars, or that
did not give the app permission will simply not add them. 

Apr 28, 2009
Project Member #1
(No comment was entered for this change.)
Status: New
Apr 28, 2009
Project Member #2
I like the idea for it to be automated. :D  Try out "Facebook Add Me! for games" It
does what you are asking but you have to click update and add all friends, its not
completely automated.

I use "Facebook Invites" on the mafia wars add me discussions, have it put people in
a mafia wars friends list.  Then I use the Add Me! script on that list, and then
after everyone is added I use the "FacebookDeletes" script and clean the list. :)
Works rather well.
Apr 29, 2009
Project Member #3
I also use a combination of scripts.  I think that the scripts that work outside of
the games work very well.  Extremely well for some of them.  However, in mafia wars
they fall apart.  For example, I like the facebook invites however, I don't want to
have it look through my extensive friends list to try to figure out who to add.  That
is very useful if I am trying to use the regular invite system (but who does that

The mafiawarsinvites script comes closest to all of them.  It doesn't care about
non-mafia wars.  It just goes to the MW screen, finds all the people in the checkbox
and does a status invite for all of them.  Anyone that has MW will automatically be
added.  The problem with that script is that it never stops!

We could add a simple function that would go to the invites screen grab the id's then
send status invites out.  It could do this when there is nothing else going on...  

Managing friends etc outside of MW is out of scope if you ask me...
Apr 29, 2009
I like your idea on this Steve, err I mean jstgtpaid.  I too like the
mafiawarsinvites script but, as you said, it will loop forever and ever...especially
if you have friends that don't use mafia wars.  I have noticed that it seems to take
two or three runs through the script before it actually adds your friends though? 
Anyway, that would be a cool addition to have...once or twice an hour, or something
like that.
May 1, 2009
Project Member #5
I dont think you collect the friend ids from the MW invite screen.. can you?

I think you either need to get the ID from the MW Mafia member screen.. (which is
useless because all those people are already in your mafia) Or from your facebook
friends list, then cross reference the name listed with the userID.

Am I wrong about that?

I think It should work like the Facebook invites / facebook games Quick invite combo... 
Hit up your facebook friends list, make a list of all userIDs / name combos.
Go to mafia wars invite page, look in the invite box.
Mark your friends that dont show in there as added already.
Send invites with the quick link.
Mark those users as added.
Track people marked as added that still appear in the MW invite list as (non-users)
Dont retry the non-users.
Provide the option to reset the non-users manually once in a while, just in case your
friends added mafia wars after that or an invite failed... you can reset and cycle
them again.  
May 1, 2009
mafiawarsinvite script must get the ID's from the MW invite screen.  If you add new
FB friends, and go to
with mafiawarsinvite script active, it will add all friends with MW application to
your mafia.

If we ever getted a tabbed settings menu, this could be one of the tabs, with a spot
similar to the don't attack section we currently have where we could put in the ID's
of any friends that don't use the MW app to keep it from trying to add them every time.
May 1, 2009
Project Member #7
Yeah, the id's are in the MW invite screen.  We could do the same thing as MWinvites
but not do the looping stuff.

May 3, 2009
Was thinking...instead of having a spot to enter FB ID's for friends that don't use
the MW app, couldn't we use the 'blacklist' logic that we already have for fighting?
 If you ever talked your non-addicted friends playing MW, you could clear the list in
about:config to add them?
May 17, 2009
Has this topic ever been revisited?  Every time I try to add this to the autoplayer
it still loops forever, and my attempts to make it go to the invite html at specified
intervals has been futile...
May 20, 2009
Project Member #10
I guess it is not high on the list with everything else we have on here.  Not to
mention many other outside tools do this very well.  Maybe we will see this sometime
though, would be cool to have.
Jun 13, 2009
Project Member #11
 Issue 258  has been merged into this issue.
Jul 29, 2009
Project Member #13 Add all no longer works, but it was exactly what I wanted.
does anyone have another tool that works that well?

Can we build a working version into this script. 
The problem with the script is that the Add url they were using changed.

I would guess most of the work is done here... We just need a button to show on that

void (function () {

{{INCLUDE xmlhttp.js}}

var recruit_url =
var add_url =

var mw_url =
var fb_url = '';
var friends_added = 0;
var friends = null;
var first = true;
var wait = 1;

var content = document.getElementById('app10979261223_content_row');
var heartrate_div = document.createElement("div");
heartrate_div.innerHTML = '<table class="messages"><tr><td colspan="2"
style="text-align: right"><a href="" style="margin-left:
auto"><img src="" width="208px"
height="25px" /></a></td></tr><tr><td width="20%">Friends added:</td><td
id="friends_added"></td></tr><tr><td>To try:</td><td
id="heartrate_status"></td></tr><tr><td valign="top">Log:</td><td
content.insertBefore(heartrate_div, content.firstChild);

function msg(log) {
document.getElementById('friends_added').innerHTML = friends_added;
document.getElementById('friends_left').innerHTML = friends.length;
var l = document.getElementById('heartrate_log');
l.innerHTML = log + '<br />' + l.innerHTML;
// console.log(log);

function status(s) {
document.getElementById('heartrate_status').innerHTML = s;

function fblink() {
return '<a href="' + fb_url + friends[0].id + '">' + friends[0].name + '</a>';

function mwlink(s) {
return '<a href="' + mw_url + friends[0].id + '">' + s + '</a>';

function request_next() {
function f () {
status('Adding ' + fblink() + '...');
request(add_url + friends[0].id);
if (friends.length > 0) {
if (first) {
first = false;
f ();
} else {
status('Waiting for ' + wait + ' seconds...');
setTimeout(f, wait * 1000);
} else {
status('All done');

function state_change() {
if (xmlHTTP.readyState == 4) { // 4 = "loaded"
if (xmlHTTP.status == 200) { // 200 = OK
// s = xmlHTTP.responseText;
/* In the days of old, we could get these messages...
if (m = /You have added (.+) to your mafia/.exec(s)) {
msg('Added ' + mwlink(m[1]) + ' AKA ' + fblink() + '.');
} else if (m = /You are already part of (.+)\'s mafia/.exec(s)) {
msg('Already added ' + mwlink(m[1]) + ' AKA ' + fblink() + '.');
} else */

// if (/app10979261223_content_row/.test(s) || /window\.location\.replace/.test(s)) {
msg('Tried adding ' + fblink() + ' (' + mwlink('MW') + ')');
/* } else {
retry('Unknown response');

retries = 0;
friends = friends.slice(1);
} else {
retry('Problem retrieving data');

function begin() {
var xpath = "//div[@class='unselected_list']//label[@class='clearfix']";
var results = document.evaluate(xpath, document, null,
var i = 0;
friends = [];
while ((res = results.snapshotItem(i)) != null) {
friends[friends.length] = {'id': res.firstChild.value, 'name': res.lastChild.innerHTML};
// console.log('ID: ' + res.firstChild.value);
// console.log('Name: ' + res.lastChild.innerHTML);
if (i == 0) {
status('Run this bookmarklet from <a href="' + recruit_url + '">the recruit page</a>.');
} else {
msg('Found ' + i + ' friends not yet in your mafia');
wait = prompt('Enter delay between requests in seconds.', 10);
// msg('Got friend list');

xmlHTTP = get_xmlHTTP();
if (!xmlHTTP) {
alert("Your browser does not support XMLHTTP.");

//status('Getting friend list');


} ());
Aug 23, 2009
Project Member #14
(No comment was entered for this change.)
Status: WontFix
Sign in to add a comment

Powered by Google Project Hosting