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

[SheetWorkers/Roll Templates] Inconsistent output with Roll Templates and SheetWorkers

Browser:  Version 62.0.3202.94 (Official Build) (64-bit) OS: Widows 7 Professional SP1 I have already cleared the chat.  I have already tried disabling extentions.  I have disabled all of the API scrips I am able.  Those that I have still enabled cannot be disabled as they are required by the character sheet to run. I have run into an issue designing my sheetworkers and having them integrate with roll templates.  I have a roll macro created in sheetworkers using the following bit of code: var critHit = parseInt(v[prefix+"_crit-target"])||0, critFail = parseInt(v[prefix+"_fail-target"])||0; var rDMod = parseFloat(v["DMG_ranged-mod"],10) || 0, rDMod2 = parseFloat(v["DMG_ranged2-mod"],10) || 0; var mDMod = parseFloat(v["DMG-mod"],10) || 0, mDMod2 = parseFloat(v["DMG2-mod"],10) || 0 if (atkType === "0") {attackType="None", buff_DMG_mod=0;}/* atkRoll does not work */ else if (atkType === "attk-melee") {atkRoll="[[ 1d20cf<"+critFail+"cs>"+critHit+" + @{attk-melee} ]]", attackType="Melee", buff_DMG_mod=mDMod;} else if (atkType === "attk-melee2") {atkRoll="[[ 1d20cf<"+critFail+"cs>"+critHit+" + @{attk-melee2} ]]", attackType="Melee2", buff_DMG_mod=mDMod2;} else if (atkType === "attk-ranged") {atkRoll="[[ 1d20cf<"+critFail+"cs>"+critHit+" + @{attk-ranged} ]]", attackType="Ranged", buff_DMG_mod=rDMod;} else if (atkType === "attk-ranged2") {atkRoll="[[ 1d20cf<"+critFail+"cs>"+critHit+" + @{attk-ranged2} ]]", attackType="Ranged2", buff_DMG_mod=rDMod2;} else if (atkType === "CMB") {atkRoll="[[ 1d20cf<"+critFail+"cs>"+critHit+" + @{attk-CMB} ]]", attackType="CMB";} else if (atkType === "CMB2") {atkRoll="[[ 1d20cf<"+critFail+"cs>"+critHit+" + @{attk-CMB2} ]]", attackType="CMB2";} console.log("ABILITY: Attack Type: " +attackType+ " || Attack Roll " +atkRoll+ " Bonus Damage: " +buff_DMG_mod+ "."); The variable atkRoll eventually outputs to an attribute (@{attackRoll}) on the character sheet for a roll template.  When entered into the roll template code it displays the roll as a FIXED number without the quantum roll formatting, in other instances it shows it with the full formatting desired (and required because of crit/fail ranges). I have asked on the SheetWorkers forms thinking I was not coding this properly, and eventually it was determined that the problem was not the code, or roll templates.  What then is left is a bug. The interesting thing is if I have the macro @{attackRoll} attribute repeated inside of the sheet workers it will display incorrectly for the first two and correctly thereafter.  I have currently switched to just using the value straight from the select code on the html ( @{abil-attack-type} ) (although this is not how I want to do it.).  And the result is absolutely identical. {{spl_attack=**Attack:** @{abil-attack-type} @{abil-attack-type} @{abil-attack-type} @{abil-attack-type} <- abil-attack-type }} A link to the discussion and help request is:  here so hopefully you can see some history as to what has been tried and what has failed and to help you have a better understanding of whats going on.
1513030785
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Just to be clear your issue is that on some inline roll template rolls, they are not getting the quantum roll styling? Are you able to provide a minimal test use case that shows this issue? I.E. the character sheet with the necessary attributes, roll button, and roll template that produce the problem?
Correct.  It is not displaying the Quantum roll styling.  I do not think I could create a minimal test either, there are just too many things interconnected with this to pull it apart.
1513037219
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Can you provide the code that's doing this, by either sending it to me or pointing me at your game where you're testing this?
1513058851

Edited 1513058865
Toby
Pro
Steve K. said: Can you provide the code that's doing this, by either sending it to me or pointing me at your game where you're testing this? Sorry for the delay, the code is a bit of a mess; but it works.  Feel free to take a look at the files on  Github .  I have duplicated this as a PM to you as well that also includes a link to the game itself. Please note: I am currently running several API, ChatSetAttr, isGM, Facing, Torch, RecursiveTable, TableExport and two custom made API. Chat Output Debug on('chat:message',(msg)=>{ log(msg.content); }); And Blindwhisper (thanks to Aaron) on("chat:message", function(msg) {     var cmdName = "!bw";     var msgWhisper = msg.content.slice(cmdName.length);     if(msg.type == "api" && msg.content.indexOf(cmdName) !== -1) {         if(_.has(msg,'inlinerolls')){             msgWhisper = _.chain(msg.inlinerolls)                 .reduce(function(m,v,k){                     m['$[['+k+']]']=v.results.total || 0;                     return m;                 },{})                 .reduce(function(m,v,k){                     return m.replace(k,v);                 },msgWhisper)                 .value();         }               if(_.has(msg,'rolltemplate')) {             sendChat('','/w gm &{template:'+msg.rolltemplate+'}'+msgWhisper);         } else {             sendChat('', '/w gm '+msgWhisper.replace(/\&/g,'&') );         }     } }); I have tried to run it with all but ChatSetAttr and Blind Whisper removed.  ChatSetAttr and BlindWhisper are both REQUIRED or the sheet kinda fails to work properly.  Chat Output Debug, was added by suggestion to help find out whats going on with this roll template problem.