+
Added support for API rolls using the Alien RPG dice roller script. This requires a Pro account.
@@ -3039,8 +3052,8 @@
/* */
// CALCULATE Health
on("change:strength change:tough sheet:opened", (eventinfo) => {
- clog("Change detected: Health");
- clog(`Eventinfo: ${JSON.stringify(eventinfo)}`);
+ //clog("Change detected: Health");
+ //clog(`Eventinfo: ${JSON.stringify(eventinfo)}`);
getAttrs(["strength", "tough", "health_calc"], (values) => {
const strength = int(values.strength),
tough = int(values.tough),
@@ -3117,7 +3130,7 @@
const food = Math.ceil(int(values.food)/4),
water = Math.ceil(int(values.water)/4),
encumb = food + water;
- clog(`Food ${food}, water ${water} and encumberance ${encumb}`);
+ //clog(`Food ${food}, water ${water} and encumberance ${encumb}`);
setAttrs({
encumbrance_consum: encumb
});
@@ -3137,16 +3150,16 @@
carrycap = (strength*2) + packmule,
config = values.config_advencumbrance,
encumb = int(values.encumbrance);
- clog(`Carry cap and pack mule: pack mule ${packmule}, strength ${strength} and carry cap ${carrycap}`);
- clog(`Test total ${total} for nonzero value: ${total != 0}`);
- clog(`advanced encumbrance: ${values.config_advencumbrance}`);
+ //clog(`Carry cap and pack mule: pack mule ${packmule}, strength ${strength} and carry cap ${carrycap}`);
+ //clog(`Test total ${total} for nonzero value: ${total != 0}`);
+ //clog(`advanced encumbrance: ${values.config_advencumbrance}`);
var overencumbered = 0, overloaded = 0, total = 0;
( config == "on" ) ? total = encumb_calc : total = encumb;
( total > carrycap ) ? overencumbered = 1 : overencumbered = 0;
( total > (carrycap*2) ) ? overloaded = 1 : overloaded = 0;
- clog(`Manual encumbrance is ${encumb}, calculated encumbrance is ${encumb_calc} and total is ${total}`);
- clog(`Overencumbered: ${total > carrycap}`);
- clog(`overloaded: ${total > (carrycap*2)}`);
+ //clog(`Manual encumbrance is ${encumb}, calculated encumbrance is ${encumb_calc} and total is ${total}`);
+ //clog(`Overencumbered: ${total > carrycap}`);
+ //clog(`overloaded: ${total > (carrycap*2)}`);
//if ( total > carrycap ) overencumbered = 1;
//if ( total > (carrycap*2) ) overloaded = 1;
//if ( encumb > carrycap ) overenc_manual = 0;
@@ -3169,7 +3182,7 @@
const target = arma+"_targetrange";
const rangemod = arma+"_rangemod";
//clog("Armament: "+arma+" Target: "+target+" Range mod: "+rangemod);
- on(`change:${target}`, (eventInfo) => {
+ on(`change:${target} sheet:opened`, (eventInfo) => {
getAttrs([target, rangemod], (values) => {
//clog("Armament changed: "+target+" value: "+values[target]+" current range mod: "+values[rangemod]);
var actual = 0;
@@ -3235,7 +3248,7 @@
// Set Ship logs 2nd tab indicator
on(`change:log16 change:log17 change:log18 change:log19 change:log20 change:log21 change:log22 change:log23 change:log24 change:log25 change:log26 change:log27 change:log28 change:log29 change:log30 sheet:opened`, (eventInfo) => {
getAttrs(["log16", "log17", "log18", "log19", "log20", "log21", "log22", "log23", "log24", "log25", "log26", "log27", "log28", "log29", "log30"], (values) => {
- clog("log values for button status: "+JSON.stringify(values));
+ //clog("log values for button status: "+JSON.stringify(values));
const button = "logs2_tab";
var active = "-";
@@ -3243,10 +3256,10 @@
if( values[`log${i}`] != "" ) {
active = "II";
}
- clog("value: "+ JSON.stringify(values[`log${i}`]) +", active: "+ active);
+ //clog("value: "+ JSON.stringify(values[`log${i}`]) +", active: "+ active);
}
- clog("active eor : "+active);
+ //clog("active eor : "+active);
setAttrs({
[button]: active
},{silent:true});
@@ -3257,7 +3270,7 @@
// Set Ship logs 3rd tab indicator
on(`change:log31 change:log32 change:log33 change:log34 change:log35 change:log36 change:log37 change:log38 change:log39 change:log40 change:log41 change:log42 change:log43 change:log44 change:log45 sheet:opened`, (eventInfo) => {
getAttrs(["log31", "log32", "log33", "log34", "log35", "log36", "log37", "log38", "log39", "log40", "log41", "log42", "log43", "log44", "log45"], (values) => {
- clog("log values for button status: "+JSON.stringify(values));
+ //clog("log values for button status: "+JSON.stringify(values));
const button = "logs3_tab";
var active = "-";
@@ -3265,10 +3278,10 @@
if( values[`log${i}`] != "" ) {
active = "III";
}
- clog("value: "+ JSON.stringify(values[`log${i}`]) +", active: "+ active);
+ //clog("value: "+ JSON.stringify(values[`log${i}`]) +", active: "+ active);
}
- clog("active eor : "+active);
+ //clog("active eor : "+active);
setAttrs({
[button]: active
},{silent:true});
@@ -3279,10 +3292,10 @@
talents = {"one": "I", "two": "II", "three": "III", "four": "IV", "five": "V", "six": "VI", "seven": "VII", "eight": "VIII"};
_.each(Object.keys(talents), (tal) => {
on(`change:talent_${tal} sheet:opened`, function() {
- clog(`Current talent: ${tal}, current value: ${talents[tal]}`);
+ //clog(`Current talent: ${tal}, current value: ${talents[tal]}`);
getAttrs([`talent_${tal}`], function(v){
var talentname = v[`talent_${tal}`];
- clog("Talent output: "+ (talentname.length > 0) ? talents[`${tal}`] : "-");
+ //clog("Talent output: "+ (talentname.length > 0) ? talents[`${tal}`] : "-");
var txt = (talentname.length > 0) ? talents[`${tal}`] : "-";
setAttrs({[`tal_${tal}`]: txt});
});