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

rollGreater im repeating section

1654930886

Edited 1654930942
Hi folks! My problem is the follow: I made a rolltemplate section that shows "success" if the roll is greater than a number and failure if lower. But the rollGreater fuction doesn't work if the rolltemplate is put on a repeating section, specifically the attribute that is the "threshold number" Here the rolltemplate (with italian words, sorry for my english, despite my name I'm italian): <rolltemplate class="sheet-rolltemplate-provaAbilitaFieldset">     <div class="sheet-container">         <div class="titolo"><h3> {{titolo}} </h3> </div>         <div>valore caratteristica {{valoreAttributo}} </div>          <div>soglia da superare: {{soglia}} </div>          <div>risultato {{risultato}} </div>         <div class= "successo-critico">              {{#rollGreater() risultato soglia}}                  <span><strong>SUCCESSO</strong></span>                 {{#rollWasCrit() risultato}}                    <span><strong>PRODIGIOSO!</strong></span>                  {{/rollWasCrit() risultato}}               {{/rollGreater() risultato soglia}}             </div>         <div class= "fallimento-critico-tps">              {{#rollWasFumble() risultato}}                <span><strong>fallimento critico!</strong></span>              {{/rollWasFumble() risultato}}         </div>              </div> </rolltemplate>   Here the inline roll and the repeating section: <fieldset class="repeating_generalskills"> <input type="text" name="attr_skillname" value="nome abilità"> <select type="number" name="attr_skill_stat" style="width:80px" value="caratteristica"> <option value="@{strength}">FOR</option> <option value="@{intelligence}">INT</option> <option value="@{wisdom}">SAG</option> <option value="@{dexterity}">DES</option> <option value="@{constitution}">COS</option> <option value="@{charisma}">CAR</option> </select> migliorata <select type="number" style="width:60px" name="attr_skill_slots_used"> <option value=0 selected="selected">0</option> <option value=1>+1</option> <option value=2>+2</option> <option value=3>+3</option> <option value=4>+4</option> <option value=5>+5</option> <option value=6>+6</option> </select> soglia*<input type="number" name="attr_skillTarget" value="[[20 - @{skill_slots_used} - @{skill_stat}]]" disabled="disabled" > <button type=roll name="roll_provaAbilitaFieldset" value="&{template:provaAbilitaFieldset} {{titolo=@{character_name} prova @{skillname} }} {{caratteristica= valore caratteristica}} {{valoreAttributo= @{skill_Stat} }} {{soglia= @{skillTarget} }}{{risultato= [[ 1d20 ]] }} {{risultatoSVantaggio= [[ 1d20 ]] }} " ></button> <br/> </fieldset> Any helps? Thanks!
1654935002
vÍnce
Pro
Sheet Author
Hi Elvis, Can you get a value to post if you target skillTarget?  ie @{selected|repeating_generalskills_$X_skillTarget} (X being the row# of the repeating attack) Also, not sure if it matters, but I don't think selects allow a "type" or "value" attributes and I believe you need to wrap the option values in quotes. ie <option value="1">+1</option>
1654943478

Edited 1654943491
GiGs
Pro
Sheet Author
API Scripter
Vince is correct on all counts. Also RollTemplates are no capable of using values unless they are from inline rolls [[ ]] and are definitely numbers. Your soglia= does not have [[ ]] brackets, that should be: {{soglia= [[@{skillTarget}]] }} You might also need to include the repeating section name there, making it {{soglia= [[@{repeating_generalskills_skillTarget}]] }}
1654943698

Edited 1654943779
Finderski
Plus
Sheet Author
Compendium Curator
I believe all you'll need to do is change this: {{soglia= @{skillTarget} }} To this: {{soglia= [[@{skillTarget}]] }} Or maybe this: {{soglia= [[0d6+@{skillTarget}]] }} rollGreater requires numbers for comparison, and the way you have soglia done right now, it's not a number, it's text (even if the attribute is using a number, it's still done as text). Edit: GiGs beat me to the punch...LOL
yes, I get the value in the chat if I wrote the command  The syntax of <option value="1">+1</option> without quotes works!
1654946532
GiGs
Pro
Sheet Author
API Scripter
Thats good to know, I hadnt test values without quotes. I wonder if it works for strings. Getting the value ibn chat only lets us know the value is correct. But as myself and Finderski point out, that doesn't matter: you need to encode that number inside inline roll brackets for it to work properly with rolltemplate logic helpers like rollGreater.
GiGs said: Vince is correct on all counts. Also RollTemplates are no capable of using values unless they are from inline rolls [[ ]] and are definitely numbers. Your soglia= does not have [[ ]] brackets, that should be: {{soglia= [[@{skillTarget}]] }} You might also need to include the repeating section name there, making it {{soglia= [[@{repeating_generalskills_skillTarget}]] }} Finderski said: I believe all you'll need to do is change this: {{soglia= @{skillTarget} }} To this: {{soglia= [[@{skillTarget}]] }} Or maybe this: {{soglia= [[0d6+@{skillTarget}]] }} rollGreater requires numbers for comparison, and the way you have soglia done right now, it's not a number, it's text (even if the attribute is using a number, it's still done as text). Edit: GiGs beat me to the punch...LOL It works! Thank you But I don't understand why the same syntax in repeating section is wrong   {{soglia= @{skillTarget} }} but it works outside the repeating section
1654951772

Edited 1655576667
GiGs
Pro
Sheet Author
API Scripter
Names in repeating sections are incomplete. Think about it: a repeating section can have, say, 10 rows. That's 10 copies of every attribute you have created in that section. How does Roll20 know which is which? When you create a macro using an attribute in that section, how does roll20 know you mean the skillTarget in the 1st row, or the copy in the 10th row? Roll20 solves this problem with some behind-the-scenes sneakiness. A repeating section is a template that roll20 uses to construct the true attribute names. It constructs a new full attribute name for each attribute, made up of three parts: The repeating section name A row ID, telling macros which row to use use The attribute name you have defined. So, the attribute skillTarget in the repeating section general skills, has a true attribute name that looks something like this: repeating_generalskills_-456ca754_skillTarget That middle string of randum numbers and letters is the row ID. Roll20 uses a method to construct those randomly, to ensure they are rare and no other repeating section row has the same value. the skillTarget part is not the true attribute name - it is just the final part of what becomes the true attribute name. Now, when you have something in a row calling other attrinutes in that same row , Roll20 inserts the row id automatically. So you can use repeating_generalskills_skillTarget I hope that helps explain things - repeating sections can be a bit confusing. They are simple to use, but have a lot of hidden complexity once you start digging deeper.
1655108830

Edited 1655108856
Thank you very much for the explanation very helpful