Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×

[Sheet Workers] Need help when using GreaterThan/LessThan/GreaterOrEqual/LessOrEqual

1466659584

Edited 1466659603
No matter what I do, my script will not work when trying to use the aforementioned comparisons. on("change:Power", function() {     getAttrs(["Power", "PowerRank", "PowerMod"], function(values) {         var modifier = Math.floor(parseInt(values.Power) / 100);         var letter = "I";         if(parseInt(values.Power) < 100) {letter = "I"};         if(parseInt(values.Power) >= 100 && parseInt(values.Power) < 200) {letter = "H"};         if(parseInt(values.Power) >= 200 && parseInt(values.Power) < 300) {letter = "G"};         if(parseInt(values.Power) >= 300 && parseInt(values.Power) < 400) {letter = "F"};         if(parseInt(values.Power) >= 400 && parseInt(values.Power) < 500) {letter = "E"};         if(parseInt(values.Power) >= 500 && parseInt(values.Power) < 600) {letter = "D"};         if(parseInt(values.Power) >= 600 && parseInt(values.Power) < 700) {letter = "C"};         if(parseInt(values.Power) >= 700 && parseInt(values.Power) < 800) {letter = "B"};         if(parseInt(values.Power) >= 800 && parseInt(values.Power) < 900) {letter = "A"};         if(parseInt(values.Power) >= 900) {letter = "S"};         setAttrs({             PowerMod: modifier;             PowerRank: letter;         });     }); });
1466687317
chris b.
Pro
Sheet Author
API Scripter
when i pasted it into jslint there was a weird invisible character on your first line with "on" That might have been a side effect of cutting and pasting But the  issue is your call to setAttrs, you have semicolons where you need a comma: setAttrs({ PowerMod: modifier, PowerRank: letter });
Aha! Thank you kind sir.
While the code should work with Chris's fix, I'd suggest that you replace the multiple if statements with else if statements, as you then wouldn't need to check the lower bounds. Probably not a big issue, but just a suggestion.