Website TW-DB.info - English support

MFRavenhawk

Well-Known Member
Interesting responses, but I had the problem on Arizona even before the event started. Haven't had an issue yet on Houston, but I haven't collected the sabre yet, either.
 

DeletedUser24736

i got the same deal on fairbanks, but at the site, the calculator doesn't work either, just says json error.
 

DeletedUser35277

All I get are spinning guns on clothcalc. Emailed them 3 days ago. No response.
 

Harsha..

Well-Known Member
got the same issue as the others here. even though the script is really old, it's incredibly useful and would love it to work once again.
 

lebareslep

New Member
Clothcalc's server side, for some reason, really does not enjoy the Patriot's weapons, Pearl weapons or the three American Army weapons. You can "patch" it by, around line 7850 (if editing in Greasemonkey), changing:

Code:
f += '<input style="display:none" type="text" name="items" value=\'' + JSON.stringify(t).replace(/'/g, "\\'") + "' />";

into
Code:
var itemsJson = JSON.stringify(t).replace(/'/g, "\\'");
var naughtyItemIds = [51530000,51531000,51532000,51539000,51540000,51541000,51550000,51551000,51552000];
for(var j = 0; j < naughtyItemIds.length; j++) {
    itemsJson = itemsJson.replace(',"' + naughtyItemIds[j] + '"', '');
}
f += '<input style="display:none" type="text" name="items" value=\'' + itemsJson + "' />";

Mind you, this does mean the script no longer takes these 9 items into consideration.

I'm really wondering what's happening on the server side though. What spell did Innogames put on these items that make poor Clothcalc go haywire?
 
Last edited:

Junkz

Well-Known Member
Clothcalc's server side, for some reason, really does not enjoy the Patriot's weapons or the three American Army weapons. You can "patch" it by, around line 7850 (if editing in Greasemonkey), changing:

Code:
f += '<input style="display:none" type="text" name="items" value=\'' + JSON.stringify(t).replace(/'/g, "\\'") + "' />";

into
Code:
var itemsJson = JSON.stringify(t).replace(/'/g, "\\'");
var naughtyItemIds = [51530000,51531000,51532000,51550000,51551000,51552000];
for(var j = 0; j < naughtyItemIds.length; j++) {
    itemsJson = itemsJson.replace(',"' + naughtyItemIds[j] + '"', '');
}
f += '<input style="display:none" type="text" name="items" value=\'' + itemsJson + "' />";

Mind you, this does mean the script no longer takes these 6 items into consideration.

I'm really wondering what's happening on the server side though. What spell did Innogames put on these items that make poor Clothcalc go haywire?


Thanks for the temporary solution :)
 

DeletedUser38181

Clothcalc's server side, for some reason, really does not enjoy the Patriot's weapons or the three American Army weapons. You can "patch" it by, around line 7850 (if editing in Greasemonkey), changing:

Code:
f += '<input style="display:none" type="text" name="items" value=\'' + JSON.stringify(t).replace(/'/g, "\\'") + "' />";

into
Code:
var itemsJson = JSON.stringify(t).replace(/'/g, "\\'");
var naughtyItemIds = [51530000,51531000,51532000,51550000,51551000,51552000];
for(var j = 0; j < naughtyItemIds.length; j++) {
    itemsJson = itemsJson.replace(',"' + naughtyItemIds[j] + '"', '');
}
f += '<input style="display:none" type="text" name="items" value=\'' + itemsJson + "' />";

Mind you, this does mean the script no longer takes these 6 items into consideration.

I'm really wondering what's happening on the server side though. What spell did Innogames put on these items that make poor Clothcalc go haywire?

thanks for the solution, add pearly weapons to that list also..
 

Snr Sarg

Well-Known Member
Clothcalc's server side, for some reason, really does not enjoy the Patriot's weapons or the three American Army weapons. You can "patch" it by, around line 7850 (if editing in Greasemonkey), changing:

Code:
f += '<input style="display:none" type="text" name="items" value=\'' + JSON.stringify(t).replace(/'/g, "\\'") + "' />";

into
Code:
var itemsJson = JSON.stringify(t).replace(/'/g, "\\'");
var naughtyItemIds = [51530000,51531000,51532000,51550000,51551000,51552000];
for(var j = 0; j < naughtyItemIds.length; j++) {
    itemsJson = itemsJson.replace(',"' + naughtyItemIds[j] + '"', '');
}
f += '<input style="display:none" type="text" name="items" value=\'' + itemsJson + "' />";

Mind you, this does mean the script no longer takes these 6 items into consideration.

I'm really wondering what's happening on the server side though. What spell did Innogames put on these items that make poor Clothcalc go haywire?

Any chance of a dummy's guide how to install this change, I had a look but could only see lines 1-16 and could not find the line that needs replacing
 

lebareslep

New Member
thanks for the solution, add pearly weapons to that list also..
Done

Any chance of a dummy's guide how to install this change, I had a look but could only see lines 1-16 and could not find the line that needs replacing
If you just copy the entire contents of the script into some text editor, you can ctrl+f to find the line to be replaced. And then just paste the new code in there. Indentation and newlines are optional in JavaScript. Alternatively, you can copy the script's contents and use some kind of JavaScript prettifier to make it readable before editing it. Eventually you'll just have to paste back the script into Greasemonkey and hit ctrl+s to save it.
 

Laural

Well-Known Member
I guess I'll just have to live without. :( I am not comfortable with changing the script, as the code confuses :p Maybe the server end will get updated at some point.

I do admire you guys who can 'patch and work around' :)
 

lebareslep

New Member
I guess I'll just have to live without. :( I am not comfortable with changing the script, as the code confuses :p Maybe the server end will get updated at some point.

I do admire you guys who can 'patch and work around' :)
There is no reason to be hesitant to change the code. The worst thing you can do (assuming a modicum of common sense - I can't help you if you throw your pc off your desk) is make the script non-functional. In which case you can remove it and reinstall it, which takes a few clicks.
 
Top