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 .
×
Create a free account

I broke my sheet workers

I've been having a lot of fun making a Traveller: The New Era sheet, and even started adding some sheet workers. Unfortunately at some point I've broken them all - including the ones that I've simply lifted from the Twillight 2000 sheet I'm basing mine on. Any ideas? This is the script part, it is placed at the very top of the html: (And as for my coding-skills - this is the very first thing I've actually written, and large parts of it are simply adopted from the TW:2000 sheet. If something is strange you can safely assume that I don't know what I'm doing.) <script type="text/worker">     //homeworldedu     on("change:techlevel", function() {         getAttrs(["techlevel", "edumod"                 ], function(pvalue) {             console.log("************ start capacities caclulation ************");             var techlevel =  parseInt(pvalue.techlevel);             var cashbasevalue =parseInt(pvalue.edumod) ;     if (techlevel < 4) {         edumod = "-2";     } else if (techlevel < 9) {         edumod = "0";     } else if (techlevel < 14) {         edumod = "1";     } else {         edumod = "2";     }             setAttrs({edumod});         });     });     //cashbasevalue     on("change:techlevel", function() {         getAttrs(["techlevel", "cashbase"                 ], function(pvalue) {             console.log("************ start capacities caclulation ************");             var techlevel =  parseInt(pvalue.techlevel);             var cashbasevalue =parseInt(pvalue.cashbase) ;             if (techlevel < 4) {         cashbasevalue = "10";     } else if (techlevel < 6) {         cashbasevalue = "100";     } else if (techlevel < 9) {         cashbasevalue = "500";     } else if (techlevel < 11) {         cashbasevalue = "1000";     } else {         cashbasevalue = "5000";     }             setAttrs({cashbase:cashbasevalue});         });     });     //Total credits     on("change:repeating_careers:careercredits", function() {    getSectionIDs("repeating_careers", function(IDArray) {       var fieldNames = [];         for (var i=0; i < IDArray.length; i++) {          fieldNames.push("repeating_careers_" + IDArray[i] + "_careercredits");       }         var totalcredits = 0;         getAttrs(fieldNames, function(values) {          for (var i=0; i < IDArray.length; i++) {             total += parseInt(values["repeating_careers_" + IDArray[i] + "_careercredits"])||0;          }          setAttrs({             "credits": totalcredits          });         });        });     });     //Total shipdms     on("change:repeating_careers:careershipdm", function() {    getSectionIDs("repeating_careers", function(IDArray) {       var fieldNames = [];         for (var i=0; i < IDArray.length; i++) {          fieldNames.push("repeating_careers_" + IDArray[i] + "_careershipdm");       }         var totalshipdms = 0;         getAttrs(fieldNames, function(values) {          for (var i=0; i < IDArray.length; i++) {             total += parseInt(values["repeating_careers_" + IDArray[i] + "_careershipdm"])||0;          }          setAttrs({             "shipdms": totalshipdms          });         });        });     });     //unarmed combat damage     on("change:strength change:unarmed_martial_arts", function() {         getAttrs(["strength","unarmed_martial_arts" ,"unarmed_damage"                 ], function(pvalue) {             console.log("************ start unarmed combat calc************");             var unarmed_skill =  parseInt(pvalue.unarmed_martial_arts);             var strength =  parseInt(pvalue.strength);             var udamage =  Math.floor((unarmed_skill * strength)/10);             console.log("udamage "+udamage);             if(udamage < 1){                 udamage = 1;             }             setAttrs({unarmed_damage:udamage});         });     });     //set location hit capacities load and throw range     on("change:strength change:constitution", function() {         getAttrs(["strength", "constitution", "head_scratch","head_slight","head_serious","head_critical",                   "head_scratch","head_slight","head_serious","head_critical",                   "load","throw_range"                 ], function(pvalue) {             console.log("************ start capacities caclulation ************");             var constitution =  parseInt(pvalue.constitution);             var strength =  parseInt(pvalue.strength);             var head_hc =constitution;             var chest_hc=(constitution+strength)*3;             var other_hc = (constitution+strength)*2;             setAttrs({head_scratch: head_hc,head_slight: head_hc*2,head_serious: head_hc*4,head_critical: head_hc*8});             setAttrs({chest_scratch: Math.floor(chest_hc*0.5),chest_slight: chest_hc,chest_serious: chest_hc*2,chest_critical: chest_hc*4});               setAttrs({other_scratch: Math.floor(other_hc*0.5),other_slight: other_hc,other_serious: other_hc*2,other_critical: other_hc*4});                         setAttrs({load: chest_hc,throw_range:strength*4});         });     });     //weight     on("change:strength change:agility", function() {         getAttrs(["strength", "agility", "baseweight","weight"                 ], function(pvalue) {             console.log("************ start capacities caclulation ************");             var agility =  parseInt(pvalue.agility);             var strength =  parseInt(pvalue.strength);             var baseweight = parseInt(pvalue.baseweight);             var adjusted_weight = baseweight+(strength-agility);             setAttrs({weight: "" + adjusted_weight + "kgs"});         });     });     //strength     on("change:strbase change:strmod change:age_str_mod", function() {         getAttrs(["strength", "strmod", "strbase", "age_str_mod"                 ], function(pvalue) {             console.log("************ start capacities caclulation ************");             var strmod =  parseInt(pvalue.strmod);             var strbase =  parseInt(pvalue.strbase);             var age_str_mod = parseInt(pvalue.age_str_mod);             var adjusted_str = strmod+strbase+age_str_mod;             setAttrs({strength:adjusted_str});         });     });     //agility     on("change:aglbase change:aglmod change:age_agl_mod", function() {         getAttrs(["agility", "aglmod", "aglbase", "age_agl_mod"                 ], function(pvalue) {             console.log("************ start capacities caclulation ************");             var aglmod =  parseInt(pvalue.aglmod);             var aglbase =  parseInt(pvalue.aglbase);             var age_agl_mod = parseInt(pvalue.age_agl_mod);             var adjusted_agl = (aglmod+aglbase+age_agl_mod);             setAttrs({agility:adjusted_agl});         });     });         //constitution     on("change:conbase change:conmod change:age_con_mod" function() {         getAttrs(["constitution", "conmod", "conbase", "age_con_mod"                 ], function(pvalue) {             console.log("************ start capacities caclulation ************");             var conmod =  parseInt(pvalue.conmod);             var conbase =  parseInt(pvalue.conbase);             var age_con_mod =  parseInt(pvalue.age_con_mod);             var adjusted_con = (conmod+conbase+age_con_mod);             setAttrs({constitution:adjusted_con});         });     });     //Intelligence     on("change:intbase change:age_int_mod", function() {         getAttrs(["intelligence", "age_int_mod", "intbase"                 ], function(pvalue) {             console.log("************ start capacities caclulation ************");             var age_int_mod =  parseInt(pvalue.age_int_mod);             var intbase =  parseInt(pvalue.intbase);             var adjusted_int = (age_int_mod+intbase);             setAttrs({intelligence:adjusted_int});         });     });         //education     on("change:edubase change:edumod", function() {         getAttrs(["education", "edumod", "edubase",                 ], function(pvalue) {             console.log("************ start capacities caclulation ************");             var edumod =  parseInt(pvalue.edumod);             var edubase =  parseInt(pvalue.edubase);             var adjusted_edu = (edumod+edubase);             setAttrs({education:adjusted_edu});         });     });     //Charisma     on("change:chabase change:chamod", function() {         getAttrs(["charisma", "chamod", "chabase"                 ], function(pvalue) {             console.log("************ start capacities caclulation ************");             var chamod =  parseInt(pvalue.chamod);             var chabase =  parseInt(pvalue.chabase);             var adjusted_cha = (chamod+chabase);             setAttrs({charisma:adjusted_cha});         });     });     </script>
1526419627
Jakob
Sheet Author
API Scripter
Run it through e.g. the   closure compiler to find any syntax errors (which will just break the workers outright, rather than give error messages). In this case: in line 161, there's a missing comma after the string.
Thanks!