So, I have GreaseMonkey Script that does some operations with integers and then sets value via GM_setValue.
Code:
var A = parseInt(StringA);
var B = parseInt(StringB);
var C = parseInt(StringC);
var answer = parseInt(Math.floor(Math.max((A/B),1)*C));
GM_setValue("answer",answer);
Now this works perfectly fine in Chrome, but somehow fails in Firefox, giving
Error: Unsupported type for GM_setValue. Supported types are: string, bool, and 32 bit integers.
The value A, B and C are properly being exported, even the value of answer is calculated as expected. Checked it with alert dialogue-boxes.
Only problem is, it is not setting value via GM_setValue. Earlier I wasn’t doing parseInt on var answer as type of Math.floor already should return the integer, but just doing it anyway. (In both cases answer is correct, but giving errors.)
I fail to understand what’s going wrong here. Any helps is greatly appreciated.
Edit: Not sure how it matters, but here’s the sample output via alert("A: "+A+"\nB: "+B+"\nC: "+C+"\n\nAnswer: "+answer);
A: 41751
B: 20513
C: 190164861567
Answer: 387050803650
Try to add
radixvalue to your parseInt function:Update:
Your value is too big for GM scripts to store. The max 32-bit supported number in mozilla
2147483647see here.To store your value try to convert it to string for example:
or using
toString()method: