I'm always grateful for your assistance GiGs. Thanks ;-) Of course I'm doing some work on the PF Community sheet which doesn't fit the "typical" mold when dealing with the sheetworkers since the sheet uses a "modular" handling for development that are section/function specific ( src folder on github ) . Often times, one module calls functions from another module which makes it a little harder for novices(me) to follow exactly what is happening in the code. I'm working within the PFSpells.js "module". Currently, the sheet allows you to generate a spell attack from a spell for attack/damage based spells. Many users have requested a method to execute the linked spell from within the attack's chat output. So, I've added a method that does that and it seems to work fine. ;-) BUT, I know some people may not want to include a link to the spell from the associated attack, so I've added a sheet option to toggle the this feature. Here's a sub-section of PFSpells.js (see the bold comment/code near the bottom) where I've added an option that adds a link to execute the spell when you create a spell attack. This seems to work as expected. Now need to include a conditional check using a checkbox located outside repeating_spells <input type="checkbox" name="attr_toggle_spell_include_link" value="1" checked /> I think I just need to grab the value of "toggle_spell_include_link" to test. Maybe something like; ...
var testSpellOption = parseInt(v["toggle_spell_include_link"]); if (testSpellOption===1) { <run code to include a link in the spell attack> }
... I don't seem to have a problem grabbing any attributes from within repeating_spell. It appears that spellPrefix(see code below) somehow knows this section of code is within repeating_spells, but I'm not sure how that works...? I don't see anything directly that assigns repeating_spells to spellPrefix... Since I'm working within repeating_spells, how can I grab the value of toggle_spell_include_link? Thanks /* ******************************** REPEATING SPELL FUNCTIONS ********************************** */
function setAttackEntryVals (spellPrefix,weaponPrefix,v,setter,noName){
var notes="",attackType="";
setter = setter||{};
try {
TAS.debug("UPDATING SPELL ATTACK: "+spellPrefix,v);
attackType=PFUtils.findAbilityInString(v[spellPrefix + "spell-attack-type"]);
if (v[spellPrefix + "name"]) {
if (!noName) {
setter[weaponPrefix + "name"] = v[spellPrefix + "name"];
}
setter[weaponPrefix + "source-spell-name"] = v[spellPrefix + "name"];
}
if (attackType) {
setter[weaponPrefix + "attack-type"] = v[spellPrefix + "spell-attack-type"];
if ((/CMB/i).test(attackType)) {
setter[weaponPrefix + "vs"] = "cmd";
} else {
setter[weaponPrefix + "vs"] = "touch";
}
}
if (v[spellPrefix+"range_numeric"]){
setter[weaponPrefix + "range"]=v[spellPrefix+"range_numeric"];
}
if (v[spellPrefix+"range"] && v[spellPrefix+"range_pick"]==="see_text" ){
notes += "Range: " + v[spellPrefix+"range"];
}
if (v[spellPrefix +"damage-macro-text"]){
setter[weaponPrefix+"precision_dmg_macro"] = v[spellPrefix+"damage-macro-text"];
if(attackType){
setter[weaponPrefix+"critical_dmg_macro"] = v[spellPrefix+"damage-macro-text"];
}
}
if (v[spellPrefix+ "damage-type"]){
setter[weaponPrefix+"precision_dmg_type"] = v[spellPrefix+"damage-type"];
if(attackType){
setter[weaponPrefix+"critical_dmg_type"] = v[spellPrefix+"damage-type"];
}
}
if (v[spellPrefix+"save"] ){
notes += "\n**Save:** " + v[spellPrefix + "save"];
if ( !(/none/).test(v[spellPrefix+"save"])){
notes += " **DC:** " + v[spellPrefix+"savedc"]
}
}
if ( v[spellPrefix+"sr"]){
if (notes) { notes += "";}
notes += "\n**Spell Resistance:** " + v[spellPrefix + "sr"];
}
// include a link in the weapon notes to execute the spell from chat
if (v[spellPrefix + "name"]) {
if (notes) {
notes += "";
}
notes += "\n**Cast Spell:** [" + v[spellPrefix + "name"] + "]" + "(~@{character_name}|" + spellPrefix + "roll)";
}
// end of link code
if (notes){
setter[weaponPrefix+"notes"]=notes;
}
} catch (err){
TAS.error("PFSpells.setAttackEntryVals",err);
} finally {
return setter;
}
}