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 .
×
May your rolls be merry + bright! 🎄
Create a free account

Repeating field with roll button

1430994502

Edited 1430994932
BlackyB
Sheet Author
Hello there, I'm actualy working on a custom sheet and I have problems with some features I would like to include On my custom sheet, I have a "Spell" field, but not every character will have spells. So I would like to only show one, and wizard and sorcerer should be able to add some with a <fieldset class="repeating_spells"> So here's my 'script' : </tr> <tr> <td> <button type="roll" value="/roll {1d20}<[[@{MagiePhy}+@{SortAttaque_1}]] Incantation @{SortNom_1}" name="roll_SortAttaque_1" /> Attaque Roll for attack (1d20< Physical Magic which is definited in the character sheet + Intel Bonus <button type="roll" value="/roll @{SortDes_1}d6+@{SortDegats_1} Blesse à hauteur de" name="roll_SpellDmgOne"/> Dégats Roll for damage (Number of dice x d6 + Damage modificator ) </td> <td><input type="text" name="attr_SortNom_1" value="" /></td> Name field <td><input type="number" name="attr_SortDes_1" value="1" /></td> Number of dice <td><input type="number" name="attr_SortDegats_1" value="0" /></td> Damage modificator <td><input type="number" name="attr_SortAttaque_1" value="0" /></td> Intel Bonus <td><input type="number" name="attr_SortCout_1" value="0" /></td> Spell Cost <td></td> </tr> <tr> I can't figure out how to make it work properly and not only showing a blank field, but create each field that are linked : - Two Rolls (Attack / Damage) - Name - Number of D6 for damage - Bonus damage - Intel bonus - Spell Cost It works fine if I do multiple field in the character sheet, but I want it to be more 'flexible"
1430996420
Finderski
Plus
Sheet Author
Compendium Curator
A few questions... The above code, is it already in a <fieldset>? If so, you can't leave any of the fields blank, otherwise it won't work. <fieldset>s are kind of...difficult at the moment. It can't initialize any values, even when a default value is provided. Does every character get to use 1 spell? If not, why show even one spell for non-Wizard/non-Sorcerer types? What do you mean when you say, "It works fine if I do multiple field in the character sheet"? BlackyB said: Hello there, I'm actualy working on a custom sheet and I have problems with some features I would like to include On my custom sheet, I have a "Spell" field, but not every character will have spells. So I would like to only show one, and wizard and sorcerer should be able to add some with a <fieldset class="repeating_spells"> <snip code> I can't figure out how to make it work properly and not only showing a blank field, but create each field that are linked : - Two Rolls (Attack / Damage) - Name - Number of D6 for damage - Bonus damage - Intel bonus - Spell Cost It works fine if I do multiple field in the character sheet, but I want it to be more 'flexible" To address some of your other items...To hide fields, you'll need to use CSS. So, you'll need a toggle of some sort to show/hide the spells section. There are several ways you could approach this, but it all boils down to toggles, and the code will be available for every sheet. If you want to see one approach, the Savage Worlds (Tabbed) sheet uses stylized toggles to show and hide different sections, and it also includes a "Configuration" panel to give some additional controls. So, what you want to do is very doable. Can you give a screenshot of what your sheet looks like and the output of pressing the buttons? That may help and provide more context.
1430997416

Edited 1430998128
BlackyB
Sheet Author
1) The above code is not in a fieldset right now 2) Not every character have a spell or more, so I could totally hide the section, if I know how xD 3) I mean that I manually created few spell field in the sheet Here is what it looks like Link below for biggest picture Here
BlackyB said: 2) Not every character have a spell or more, so I could totally hide the section, if I know how xD Css Wizardry , for all you vanishing & re-appearing needs. Its in the first post, third "heading". The configuration menu in the Savae Worlds (tabbed) sheet is an advanced, and much more amazing, version of said hiding things.
1431000749
Finderski
Plus
Sheet Author
Compendium Curator
Ok, so if I'm understanding things correctly, what you have is working, you'd just like it to be a <fieldset> and hidden, correct? Assuming that's correct... HTML: <input class="sheet-useSpells" type="checkbox" name="attr_showSpells"> <div class="spells"> <div class="sheet-col">table header 1</div> <div class="sheet-col">table header 2</div> <!-- keep doing the above until you get all your headers --> <fieldset class="spells"> <div class="sheet-row"> <button type="roll" value="/roll {1d20}<[[@{MagiePhy}+@{SortAttaque_1}]] Incantation @{SortNom_1}" name="roll_SortAttaque_1" /> Attaque <button type="roll" value="/roll @{SortDes_1}d6+@{SortDegats_1} Blesse à hauteur de" name="roll_SpellDmgOne"/> Dégats <input type="text" name="attr_SortNom_1" value="" /> <input type="number" name="attr_SortDes_1" value="1" /> <input type="number" name="attr_SortDegats_1" value="0" /> <input type="number" name="attr_SortAttaque_1" value="0" /> <input type="number" name="attr_SortCout_1" value="0" /> </div> </fieldset> </div> CSS: .sheet-spells { /*Hide the table of spells*/ display: none; } .sheet-useSpells:checked + .sheet-spells { /*if the input field attr_showSpells is checked, show the table*/ display: inline-block; } The HTML will likely require some styling to get things lined up. Within the fieldset tags and within the <div class="sheet-row"> you may need to use additional <div class="sheet-col"> tags to get the spacing correct, but the overall idea is that each fieldset is a self-contained row so that when the Add+ button is pressed, it doesn't screw things up.
1431010941

Edited 1431011120
BlackyB
Sheet Author
I understand that you create a checkbox which will be use to show or hide the spells table Anyway, I don't understant the 'table header 1' I assume that I need the same amount of header that column I need But I don't know how to make it work And I wanted to make this (All the spell bar with name, damage, bonus, etc), to be 'repeating_spellbar' I don't know if that's possible, because each repetition must create new attributes depending of the fields Here's what I get Here
I would also like to know how to align right a field I tried <td><input type="text" class="alright" name="attr_CharacterName" value="Nom du Personnage" /></td> But it don't seems to work
1431015127
Finderski
Plus
Sheet Author
Compendium Curator
BlackyB, sorry for the confusion. When I get a bit more time I'll post something a bit more specific. I find working with <table>s more hassle than they are worth with <fieldset>s. So, that's why I recommended divs, but those will need to be sized to form a table like structure. More to come in a little bit.
1431015817

Edited 1431017770
BlackyB
Sheet Author
Okay thanks for your time :) Btw, I would also like to know if we can create a "sheet-colrow" within another "sheet-colrow" ?
1431017499
Finderski
Plus
Sheet Author
Compendium Curator
Ok, I found some time. Here's the HTML that should work for you: <input class="sheet-useSpells" type="checkbox" name="attr_showSpells"> <div class="spells"> <h4 style="text-align: center;">Sorts</h4> <div class="sheet-col" style="width: 200px; text-align: center;">Lancers de dés</div> <div class="sheet-col" style="width: 200px; text-align: center;">Nom</div> <div class="sheet-col" style="width: 30px; text-align: center;">X D6</div> <div class="sheet-col" style="width: 30px; text-align: center;">Dégats+</div> <div class="sheet-col" style="width: 30px; text-align: center;">Bonus</div> <div class="sheet-col" style="width: 30px; text-align: center;">Cout</div> <fieldset class="repeating_spells"> <div class="sheet-row"> <div class="sheet-col" style="width: 200px;"> <button type="roll" value="/roll {1d20}<[[@{MagiePhy}+@{SortAttaque_1}]] Incantation @{SortNom_1}" name="roll_SortAttaque_1" /> Attaque <button type="roll" value="/roll @{SortDes_1}d6+@{SortDegats_1} Blesse à hauteur de" name="roll_SpellDmgOne"/> Dégats </div> <div class="sheet-col" style="width: 200px;"> <input type="text" name="attr_SortNom_1" value="" style="width: 190px;"/> </div> <div class="sheet-col" style="width: 30px;"> <input type="number" name="attr_SortDes_1" value="1" style="width: 25px;" /> </div> <div class="sheet-col" style="width: 30px;"> <input type="number" name="attr_SortDegats_1" value="0" style="width: 25px;" /> </div> <div class="sheet-col" style="width: 30px;"> <input type="number" name="attr_SortAttaque_1" value="0" style="width: 25px;" /> </div> <div class="sheet-col" style="width: 30px;"> <input type="number" name="attr_SortCout_1" value="0" style="width: 25px;" /> </div> </div> </fieldset> </div> What I meant by "header" was what table did you want on the columns. I looked at your image and just took those as the headers. This way, you only get the headers once and each time you press the Add button, it will just add a row for the buttons and fields for the spell. You will likely need to adjust the various "width" values to get the spacing you want. To align text to the right, you should be able to use something like: style="text-align: right;" You can also set it up in CSS, so you don't always have to write that, but that should hopefully get you what you're looking for.
1431019380

Edited 1431019484
BlackyB
Sheet Author
Sweet Jesus ! That's a fucking great job, it works like a charm ! Thanks a lot dude ! You'll be in the sheet credits :p
1431019530
Finderski
Plus
Sheet Author
Compendium Curator
LOL. No worries. Glad to help.
If you still have a few minutes G V. I would like to know if I can make a fieldset within a scroll list, which will affect a macro depending which one is selected For exemple, in the HTML you gave me, I would add a column with "Physical Magic" and "Psychic Magic" so depending on which one is selected my roll button will do => /roll d20<@{MagiePhy} Or => /roll d20<@{MagiePsy} (And others variables/attributes)
1431073063
Finderski
Plus
Sheet Author
Compendium Curator
Just to make sure I understand your question...when you say "scroll list" is that the same thing as a drop down menu, where you have you click on on the field and it shows different options? If that's what you mean, adding that type of field inside a <fieldset> is do able; it would be something like: <div class="sheet-col" style="width: 35px;"> <select name="attr_MagieType"> <option value="@{MagiePhy}">Physical</option> <option value="@{MagiePsy">Psychic</option> </select> </div> And then you're roll would be something like: /roll d20<@{MagieType} I'm assuming that @{MagiePhy} and @{MagiePsy} are actually fields somewhere else on the character sheet. If they are not, then that field would likely need to change. Also, I'm not sure, but the <option> values may need need to be: [[@{MagiPhy}]] and [[@{MagiePsy}]] so they become inline rolls. And you'll also need to adjust the width (probably of more than just the <div> above, as well).
Well, you're awesome again ! That's exactly what I was looking for ! I'll give it a try tonight and let you know But it seems légit, I didn't knew the correct synthax