FBMW++

By Pea Cracker Last update Feb 24, 2009 — Installed 39,028 times.

MW update crippled the script (solution)

in
Subscribe to MW update crippled the script (solution) 16 posts, 12 voices



Pea Cracker Script's Author

Basically the script can't read / update the stats anymore, so then it won't know when to heal (health), what job to do (energy), when to deposit money (cash), etc.

I will release a full script later today. For those who can manage to edit one line of the script, find the lines:

str = str.replace(/,/g,'');
var re = /(Cash|Health|Energy|Stamina|Exp|Level): ?\$?([0-9]+)\/?([0-9]+)?/;

and change it to:
str = str.replace(/,|<\/?[^>]+(>|$)/g,'');
var re = /(Cash|Health|Energy|Stamina|Exp|Level):.*?\$?([0-9]+)\/?([0-9]+)?/;

 
msm02eshift User

Pea Cracker...thanks for looking into this. I did this fix and now all it does is a continuous loop where it will Acquire Illegal Weapons although I don't have enough energy. And then if I turn that off to None it will go to the bank and in a continuous loop try to deposit $8743457343. Then if I turn off deposits to the bank it will go to Resting mode. Is this happening to anyone else?

 
cheffox User

Same problem. Script tries to execute actions that there is not enough energy to do, and is convinced that I have 8+ billion in cash.

 
davidzeb User

Yep, I just changed the code as indicated above. Cash is showing as $8,743,457,343. I wish I had that much. If I pick a job for Helper+ to do, it tries to do it every 5 seconds. Seems like it thinks there is more energy than is actually available.

 
bruttium User

Maybe try:

var re = /(Cash|Health|Energy|Stamina|Exp|Level):\s*(?:.span id=.*>)?\$?([0-9]+)(?:<\/span>)?\/?([0-9]+)?/;

I was just hacking around with my old version of the script, and this might help you. Post back if it helps or not.

 
msm02eshift User

bruttium...thanks for the help but unfortunately that did nothing. I don't know a thing about coding so I can't even attempt to figure this out.

Edit: In this post http://userscripts.org/topics/18417 has TheDruidsKeeper posted this (which needs a little fix from page 2 of same post):

Fix for Header
This is my quick fix for the header since they changed it during the night.
I dont have time to fix it the way I would like, but this will work just fine in the mean time.

Look for this line:

var re = /(Cash|Health|Energy|Stamina|Exp|Level): ?\$?([0-9]+)\/?([0-9]+)?/;

That's the code that is mostly invalid now..
So follow the code down until you see this:

default:
alert("Unknown field: " + str);
}
}

And put this after it:

this.cash = parseInt(document.getElementById("app8743457343_cur_cash").innerHTML.replace(/,/g, "").replace("$", ""));
this.health = parseInt(document.getElementById("app8743457343_cur_health").innerHTML.replace(/,/g, "").replace("$", ""));
var mystring = document.getElementById("app8743457343_cur_health").parentNode.innerHTML;
this.max_health = parseInt(mystring.substring(mystring.lastIndexOf("/")));
this.stamina = parseInt(document.getElementById("app8743457343_cur_recovery").innerHTML.replace(/,/g, "").replace("$", ""));
mystring = document.getElementById("app8743457343_cur_recovery").parentNode.innerHTML;
this.max_stamina = parseInt(mystring.substring(mystring.lastIndexOf("/")));
this.energy = parseInt(document.getElementById("app8743457343_cur_energy").innerHTML.replace(/,/g, "").replace("$", ""));
mystring = document.getElementById("app8743457343_cur_energy").parentNode.innerHTML;
this.max_energy = parseInt(mystring.substring(mystring.lastIndexOf("/")));

And on page 2 of same post Brian T. O'N... posted this:

This fixes Druid's first attempt. Put it in the same place he listed, but it should be:

this.cash = parseInt(document.getElementById("app8743457343_cur_cash").innerHTML.replace(/,/g, "").replace("$", ""));
this.health = parseInt(document.getElementById("app8743457343_cur_health").innerHTML.replace(/,/g, "").replace("$", ""));
var mystring = document.getElementById("app8743457343_cur_health").parentNode.innerHTML;
var re2 = /\/([0-9]+)/;
var foo = mystring.match(re2);
this.max_health = parseInt(foo[1]);
this.stamina = parseInt(document.getElementById("app8743457343_cur_recovery").innerHTML.replace(/,/g,"").replace("$", ""));
mystring = document.getElementById("app8743457343_cur_recovery").parentNode.innerHTML;
foo = mystring.match(re2);
this.max_stamina = parseInt(foo[1]);
this.energy = parseInt(document.getElementById("app8743457343_cur_energy").innerHTML.replace(/,/g, "").replace("$", ""));
mystring = document.getElementById("app8743457343_cur_energy").parentNode.innerHTML;
foo = mystring.match(re2);
this.max_energy = parseInt(foo[1]);

Basically it was not getting the maxes, this fixes that. This should re-enable auto-healing. It's currently working for me...

Hope this helps and i'm not a dick for posting other people's codes eventhough I gave them credit.

 
dimmyr User

Ok, it looks like TheDruidsKeeper fix is working for me. Follow the instructions below:

Find:

var re = /(Cash|Health|Energy|Stamina|Exp|Level): ?\$?([0-9]+)\/?([0-9]+)?/;

Follow the code down until you see this:

default:
alert("Unknown field: " + str);
}
}

And put this after it: (Brian T's corrections)

this.cash = parseInt(document.getElementById("app8743457343_cur_cash").innerHTML.replace(/,/g, "").replace("$", ""));
this.health = parseInt(document.getElementById("app8743457343_cur_health").innerHTML.replace(/,/g, "").replace("$", ""));
var mystring = document.getElementById("app8743457343_cur_health").parentNode.innerHTML;
var re2 = /\/([0-9]+)/;
var foo = mystring.match(re2);
this.max_health = parseInt(foo[1]);
this.stamina = parseInt(document.getElementById("app8743457343_cur_recovery").innerHTML.replace(/,/g,"").replace("$", ""));
mystring = document.getElementById("app8743457343_cur_recovery").parentNode.innerHTML;
foo = mystring.match(re2);
this.max_stamina = parseInt(foo[1]);
this.energy = parseInt(document.getElementById("app8743457343_cur_energy").innerHTML.replace(/,/g, "").replace("$", ""));
mystring = document.getElementById("app8743457343_cur_energy").parentNode.innerHTML;
foo = mystring.match(re2);
this.max_energy = parseInt(foo[1]);

 
Kemm User

msm02eshift, the header fix works fine for me. I didn't try the others unless i stumble onto another problem. thanks a lot!!

 
Pea Cracker Script's Author

Sorry it was 2 lines not 1 line. Please refer back to the top post.

Basically, MW added a bunch of HTML tags, the first line gets rid of them.
Then, MW replaced the space after the colon behind every stat (such as "Exp: ") with a bunch of tabs, which is different from what our scrips were anticipating. The second line accepts this new format by taking whatever is in between the colon and the next piece of needed info.

Well, it's really your pick, 2 lines, or a whole mess of lines.

 
Pea Cracker Script's Author

I've updated the two lines and replaced three lines in my previously released script. So that you all can just install the updated version now. Please report any problems, thanks.

 
Shane Sullivan User

Thanks for the update Mate

 
xYike User

Well done Pea Cracker!

 
msm02eshift User

Thanks!

 
John Doe111 Scriptwright

Working like a charm thanks as always Pea!

 
Jammer User

Hi, could somebody just copy/paste post the newest version here. lol So many personalities suggesting this and that, it's confusing on what to change. Thanks!

 
Keleas User

Jammer, just re-install this script. It's updated with the fix now.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel