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

Newbie Character Sheet Designer seeking tips

Hey, all.  Working on making my first custom character sheet.  It was pretty daunting at first, but I'm picking things up and I'm now pretty pleased with what I've got so far -- it's functional, if still a bit ugly (though I know I can improve that as I continue to learn).  That said, there are a few things I'd still really like to figure out how to do.  Mostly around figuring out the code on Repeating entries. I've added a test Repeating entry to my sheet, and it provides only a single small text area, which you have to scroll through to read the whole entry.  What I'd love is for a Repeating Entry where you put in a name, and you can carrot out the full description. Bonus points when I get to the Equipment list if I can also add something like Weight as an element, which gets added up at the end. What kind of code am I looking at to do that?
1767817265
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
You just need to add all the elements that you want in the repeating element to the field set definition in your code. Then you can style them by targeting the .repitem or items within it in your css. For doing the carrot, assume you mean have it display on hover? That would just be handled via css. For the weight totaling, just add an attribute to hold the total outside the field set, and then you'll use a sheetworker to handle the totalling. The repeating sum sheetworker from the wiki cookbook handles most basic use cases of this. Long story short, treat repeating sections like they are sub sheets.
I mean like a little arrow button.  Someone clicks the arrow, and the name expands out to include a description.  So, like, someone might have an ability called "Tall", and when you click on it, it becomes "Tall: Can reach very tall shelves."  (Not literally, but just as an example.)
1767830989
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
That would be done with css. I usually go with what I call a collapse/expand pattern: HTML <input type="checkbox" name="attr_collapse" class="collapse-control"> <input type="text" name="attr_name"> <!-- Something that is shown regardless of collapse state --> <span name="attr_weight" class="collapsed"></span> <div class="expanded"> <!-- a bunch of stuff that is displayed in expanded mode --> <!-- Note that none of these have to be divs or spans, or whatever, the important part is the collapsed/expanded classes --> </div> CSS .collapse-control{     &:not(:checked) ~ .collapsed,     &:checked ~ .expanded{         display: none !important; /* important should usually be avoided, but since we want to hard override any other behavior this is an appropriate place for it */     } } You can insert that pattern anywhere on a sheet to control display of items. I leave the name of the collapse checkbox as attr_collapse  when I use the pattern in repeating sections, and change it to be a different name when using it outside of repeating sections.
Brilliant!  Thank you!