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

[Splittermond] Custom Roll Parsing: Chat Command Button

1632670755
Loki
Sheet Author
Hi! In my main sheet whenever a player attacks there is a button in the chat that automatically rolls the damage if someone clicks on it. It looks like this: After clicking on "Wirf!" another roll on a damage roll template happens and that looks like this: This works flawlessly from within the repeating section. But now that I want to update all rolls to Custom Roll Parsing I stumble over the following error whenever I want to parse the roll: As you can see the mechanism works nevertheless, but the error is still annoying. This is the code for the chat button: <input type="hidden" name="attr_damageroll" /> <input type="hidden" name="attr_rolldamage" value="[Wirf!](~repeating_nahkampfwaffen_show_damage)" /> <button type="roll" name="roll_show_damage" style="display: none" value="@{showing_damage}" class="btn ui-draggable"></button> <input type="hidden" name="attr_showing_damage" value="&{template:splittermond_damage} {{charactername=@{character_name}}} {{name=Waffe: @{waffenname}}} {{damage=[[@{damageroll}]]}}" /> damageroll holds the raw roll command, e.g. "2d6+2". rolldamage holds the code for the button. roll_show_damage is the button itself showing_damage is the value of the button, including the roll template and the attributes. The error message says that no attribute was found for [Wirf!](~some_cryptic_number) but I don't know what that means. The old (working) code for the roll button is: <button class="button button--primary" type=roll value="@{abilityroll} {{name=Waffe: @{waffenname}}} {{charactername=@{character_name}}} {{damage=@{rolldamage}}} {{Probe=[[?{Art des Wurfs|Standardwurf, 2d10cs>10cf<1 | Sicherheitswurf, 2d10d1cs>10cf<1 | Risikowurf, 4d10k2cs>10cf<1} + @{waffenwert} + @{waffenmod} + @{nahwaffenattrmod} + ?{Modifikator|0} + @{angriffsbonus} + @{kampffertigkeitenbonus} + @{hiddenallfert} - @{geblendet} - @{erschoepft} - @{schadensmod}]]}} {{dmgmalus=[[@{schadensmod}d1]]}} {{basiswert=[[@{waffenwert}d1]]}} {{erschoepft=[[@{erschoepft}d1]]}} {{geblendet=[[@{geblendet}d1]]}} {{schwierigkeit=[[1d0 + ?{Schwierigkeit|15}]]}} {{Ticks=[[@{waffenwgs}+@{gesamttickplus}+@{benommen}} @{initracker_input}]]}}"></button> Now I'm Roll parsing it like this: on("clicked:repeating_nahkampfwaffen:angriff clicked:repeating_nahkampfwaffen:aktiveabwehr", function(eventInfo) { let modus = eventInfo.sourceAttribute.split("_")[3]; getAttrs(['repeating_nahkampfwaffen_gm', 'repeating_nahkampfwaffen_waffenname', 'repeating_nahkampfwaffen_damageroll', 'repeating_nahkampfwaffen_rolldamage', 'repeating_nahkampfwaffen_waffenwert', 'repeating_nahkampfwaffen_waffenmod', 'repeating_nahkampfwaffen_nahwaffenattrmod', 'repeating_nahkampfwaffen_angriffsbonus', 'repeating_nahkampfwaffen_kampffertigkeitenbonus', 'hiddenallfert', 'geblendet', 'erschoepft', 'schadensmod', 'dice_mod'], function (values) { let baseDice = ""; let baseRoll = ""; let mode = 1; let bBeh = 0; let wuerfel = ""; let waffenname = values['repeating_nahkampfwaffen_waffenname']; let waffenwert = parseInt(values['repeating_nahkampfwaffen_waffenwert'], 10) || 0; let waffenmod = parseInt(values['repeating_nahkampfwaffen_waffenmod'], 10) || 0; let damageroll = values['repeating_nahkampfwaffen_damageroll']; let rolldamage = values['repeating_nahkampfwaffen_rolldamage']; let nahwaffenattrmod = parseInt(values['repeating_nahkampfwaffen_nahwaffenattrmod'], 10) || 0; let angriffsbonus = parseInt(values['repeating_nahkampfwaffen_angriffsbonus'], 10) || 0; let kampffertigkeitenbonus = parseInt(values['repeating_nahkampfwaffen_kampffertigkeitenbonus'], 10) || 0; let hiddenallfert = parseInt(values['hiddenallfert'], 10) || 0; let grmmode = parseInt(values['repeating_nahkampfwaffen_gm'], 10) || 0; let geblendet = parseInt(values['geblendet'], 10) || 0; let erschoepft = parseInt(values['erschoepft'], 10) || 0; let schadensmod = parseInt(values['schadensmod'], 10) || 0; let dice_mod = parseInt(values['dice_mod'], 10) || 0; let sum = +waffenwert + +waffenmod + +nahwaffenattrmod + +hiddenallfert - +angriffsbonus + +kampffertigkeitenbonus - +geblendet - +erschoepft - +schadensmod; switch (+values.dice_mod) { case 1: baseDice = "[[{[[1d10]],[[1d10]]}k1]]"; wuerfel = "{{wuerfel1=$[[0]]}} {{wuerfel2=$[[1]]}}"; break; case 3: baseDice = "[[{[[1d10]],[[1d10]],[[1d10]],[[1d10]]}k2]]"; mode = 4; wuerfel = "{{wuerfel1=$[[0]]}} {{wuerfel2=$[[1]]}} {{wuerfel3=$[[2]]}} {{wuerfel4=$[[3]]}}"; break; default: baseDice = "[[[[1d10]] + [[1d10]]]]"; wuerfel = "{{wuerfel1=$[[0]]}} {{wuerfel2=$[[1]]}}"; mode = 2; break; } if (modus == "angriff") { baseRoll = `@{abilityroll} {{name=${waffenname}}} {{charactername=@{character_name}}} {{damage=@{${rolldamage}}}} {{Probe=[[ ${baseDice} + [[${sum}]] ]]}} {{mod=[[?{Situationsmodifikator|0}]]}} {{grossmeister=[[1d10]]}} {{erfolge=[[1]]}} ${wuerfel} {{mode=[[${mode}]]}} {{success=[[0]]}} {{dmgmalus=[[@{schadensmod}d1]]}} {{geblendet=[[@{geblendet}d1]]}} {{basiswert=[[${waffenwert}d1]]}} {{skillbonus=[[${waffenmod}]]}} {{angriffsbonus=[[${angriffsbonus}]]}} {{kampffertigkeitenbonus=[[${kampffertigkeitenbonus}]]}} {{erschoepft=[[@{erschoepft}d1]]}} {{bbeh=[[${bBeh}]]}} {{grmmode=[[${grmmode}]]}} {{schwierigkeit=[[1d0 + ?{Schwierigkeit|15}]]}}`; } else if (modus == "aktiveabwehr") { baseRoll = `@{abilityroll} {{name=${rollName}}} {{charactername=@{character_name}}} {{Probe=[[ ${baseDice} + [[${sum}]] ]]}} {{mod=[[?{Situationsmodifikator|0}]]}} {{grossmeister=[[1d10]]}} {{erfolge=[[1]]}} {{wuerfel1=$[[0]]}} {{wuerfel2=$[[1]]}} {{standardwurf=$[[2]]}} {{mode=[[2]]}} {{success=[[0]]}} {{dmgmalus=[[@{schadensmod}d1]]}} {{geblendet=[[@{geblendet}d1]]}} {{basiswert=[[${vStat}d1]]}} {{skillbonus=[[${bStat}]]}} {{attributsmodifikatoren=[[${attributsmodssum}]]}} {{erschoepft=[[@{erschoepft}d1]]}} {{bbeh=[[${bBeh}]]}} {{behinderung=[[${behinderung}]]}} {{grmmode=[[${grmmode}]]}} {{schwierigkeit=[[1d0 + ?{Schwierigkeit|15}]]}}`; } processRoll(baseRoll); }); }); In both cases the attribute {{damage}} is set to the same value. I know this might be confusing for anyone else than me, but maybe you have a tip why this error occurs. Cheers!
1632679615
.Hell
Sheet Author
In the error there are two different kinds of brackets. This might be a lead. I think in here <a href="https://app.roll20.net/forum/post/10346883/adventures-with-startroll" rel="nofollow">https://app.roll20.net/forum/post/10346883/adventures-with-startroll</a> might be some nice tips for your goal. I already put something similar in one of my sheets with the help of that link
1632688028
Loki
Sheet Author
Thank you .Hell. I had to add the id of the repeating row into the attributes inside the repeating_section, which is kinda weird, but it works. :) Cheers!