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

Script Question with Power Cards

This is a question for our master API scripters out there. I am trying to edit the Power Cards API a very minor bit. The section below is a minor edit that I want to add. I just can't figure out how to get it to output Concentration instead of {{concentration=1}} function getSpellInfo(charid, spellname) { var return_set = []; try { var spell_prefix = filterObjs(function(z) { return (z.get("characterid") == charid && z.get("name").endsWith("spellname")); }) .filter(entry => entry.get("current") == spellname)[0] .get("name").slice(0,-9); } catch (e) { return(return_set) }; return_set.push("SP-NAME|" + getAttrByName(charid, spell_prefix + "spellname")); return_set.push("SP-LEVEL|" + (spell_prefix.charAt(16) == "c" ? 0 : spell_prefix.charAt(16))); return_set.push("SP-SCHOOL|" + getAttrByName(charid, spell_prefix + "spellschool")); return_set.push("SP-RANGE|" + getAttrByName(charid, spell_prefix + "spellrange")); return_set.push("SP-DURATION|" + getAttrByName(charid, spell_prefix + "spellduration")); return_set.push("SP-ATTACK|" + getAttrByName(charid, spell_prefix + "spellattack")); return_set.push("SP-DAMAGE|" + getAttrByName(charid, spell_prefix + "spelldamage")); return_set.push("SP-DAMAGETYPE|" + getAttrByName(charid, spell_prefix + "spelldamagetype")); return_set.push("SP-DAMAGE2|" + getAttrByName(charid, spell_prefix + "spelldamage")); return_set.push("SP-DAMAGETYPE2|" + getAttrByName(charid, spell_prefix + "spelldamagetype")); return_set.push("SP-HLDIE|" + getAttrByName(charid, spell_prefix + "spellhldie")); return_set.push("SP-HLDIETYPE|" + getAttrByName(charid, spell_prefix + "spellhldietype")); return_set.push("SP-OUTPUT|" + getAttrByName(charid, spell_prefix + "spelloutput")); var desc = getAttrByName(charid, spell_prefix + "spelldescription").replace(/\<p\>/g,"").replace(/\<\/p\>/g,"").replace(/\n/g,"<br>") return_set.push("SP-DESCRIPTION|" + desc); return_set.push("SP-MORECANTRIPDAMAGE|" + (desc.includes("damage increases by") ? 1 : 0)); return_set.push("SP-ATHIGHER|" + getAttrByName(charid, spell_prefix + "spellathigherlevels")); return_set.push("SP-ADDABILITY|" + (getAttrByName(charid, spell_prefix + "spelldmgmod") == "Yes" ?1:0)); return_set.push("SP-CASTINGTIME|" + getAttrByName(charid, spell_prefix + "spellcastingtime")); return_set.push("SP-SAVE|" + getAttrByName(charid, spell_prefix + "spellsave")); return_set.push("SP-SAVESUCCESS|" + getAttrByName(charid, spell_prefix + "spellsavesuccess")); return_set.push("SP-HEALING|" + getAttrByName(charid, spell_prefix + "spellhealing")); return_set.push("SP-CONC|" + getAttrByName(charid, spell_prefix + "spellconcentration")); return (return_set); } Everything above the SP-CONC line is fully functional already. Any help would be appreciated.
1532637844
The Aaron
Pro
API Scripter
Try: return_set.push("SP-CONC|" + (getAttrByName(charid, spell_prefix + "spellconcentration"))?'Concentration':'');
The Aaron said: Try: return_set.push("SP-CONC|" + (getAttrByName(charid, spell_prefix + "spellconcentration"))?'Concentration':''); Tried it and unfortunately, it now just gives ~SP-CONC$ instead of {{concentration=1}}
1532639402
The Aaron
Pro
API Scripter
Bummer.  Guess we'll have to wait for someone more familiar.
The Aaron said: Bummer.  Guess we'll have to wait for someone more familiar. I posed the question to the Power Cards scripter but was hoping it was something simple that someone else could figure out before he got online.
1532642715
Kurt J.
Pro
API Scripter
Untested as of yet, but the following should do it: return_set.push("SP-CONCENTRATION|" + (getAttrByName(charid, spell_prefix + "spellconcentration") == "{{concentration=1}}" ? "Concentration" : " "));
Kurt J. said: Untested as of yet, but the following should do it: return_set.push("SP-CONCENTRATION|" + (getAttrByName(charid, spell_prefix + "spellconcentration") == "{{concentration=1}}" ? "Concentration" : " ")); Didn't work but it's fine at this point.