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 making Custom Sheet for New RPG. Plz Halp!

I have hit the limit of my very limited coding expertise. In the middle is a line of Checkboxes labeled "attr_syplevel_$" Below the Checkboxes are the Buttons "Syphon" which rolls for a number of successes and "Stain", which I need to return BOTH successes and failures. When I click "Stain", in addition to returning BOTH successes and failures, I need it to also remove a checkbox.  (I can work with either direction) And when I click "Syphon", I need it to fill checkboxes equal to the successes rolled. How do I make this happen?
1703969825

Edited 1703969957
GiGs
Pro
Sheet Author
API Scripter
If you want to send something to chat and also change something on teh character sheet at the same time, you need Custom Roll Parsing. It's a special sheet worker, and is the only way to do this. If you want to combine a roll and any change at all to the character sheet, you always need to use CRP. To "remove" a checkbox, you'll need to use CSS. There's more than one way to do this. The method I use: You create the maximum number of checkboxes, give them each a different class, create a hidden attribute for each checkbox with its own class, then create a sheet worker that changes the value of the hidden checkboxes between 0 and 1 Finally use a CSS rule which hides the checkbox based on the hidden attribute's value. You can learn about these two approaches both on the wiki, and on my site ( <a href="https://cybersphere.me/roll20-sheet-author-master-list/" rel="nofollow">https://cybersphere.me/roll20-sheet-author-master-list/</a> ) which is meant to be easy to follow but is very exhaustive.
Thank you!&nbsp; I was hoping to not have to deal with any CSS until I was done with the "hard code" of the HTML/JS...but alas, it seems it can not be helped.&nbsp; I will look into these solutions.&nbsp;&nbsp;
1703974446
GiGs
Pro
Sheet Author
API Scripter
CSS is vital for any character sheet. You can create a sheet without JS but you can't create one without CSS (at least, not a presentable one).
Thank you so much for this reference!&nbsp; I am learning so much about what is possible with this and I know for a fact I will be returning to the Spell Slots Section when I begin flushing out my Repeating Sections for the Spell Tab I will be including later. I have gone through all of the examples and I was hoping you could point me to a particular example I did not see.&nbsp; My system is a hybrid.&nbsp; Skill Checks are a simple 3d6+Skill Bonus, but Shade Checks use a d6 storytelling table (Low scores of 1 require a high roll of 6 to succeed, 2=5+, 3=4+, and so on). I still need to find a way to parse Successes from Failures in each Shade Check roll, because some rolls will use the number of Failures to affect the sheet.&nbsp; My question is do you have a reference code available for the VTM5 system?&nbsp; I do not need to bother with additional factors like "Messy Criticals" or "Beastial Failures" (thank god...) But I do know if I could see what THAT parsing system looks like, I could pick it apart for my own use. Just a nudge in that direction and I will be well on my way!
1704060188
GiGs
Pro
Sheet Author
API Scripter
I dont have such code available, sorry. If you describe what you need, I can help, and might be able to quickly whip up something for you to analyse.
Drat. Okay.&nbsp; This is the code for the Stain Button.&nbsp; What I am looking for is code that instead of simply showing the die results will: -Show How Many Successes there are and Label them as "Stained Shade" -Show How Many Failures there are and label them as "Unstained Shade" -Display each Dominion separately, while ignoring Dominions with 0 results. &lt;div class="sheet-col"&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button type="roll" value="&amp;{template:default} {{name=Stain}} {{Roll=[[@{aetherscore}d6&gt;@{aetherstain} + @{corruptionscore}d6&gt;@{corruptionstain} + @{destructionscore}d6&gt;@{destructionstain} + @{purityscore}d6&gt;@{puritystain} + @{vitalityscore}d6&gt;@{vitalitystain}]]}}" name="StainCheck"&gt;Stain&lt;/button&gt; &nbsp; &nbsp; &lt;/div&gt; Im pretty sure I can take the rest from there. Let me know if you need more details.
And Thank you.
1704063265
GiGs
Pro
Sheet Author
API Scripter
You'll need a purpose built rolltemplate for that, do you have any of the groundwork for that done?
No, not yet. I will get to work in that tomorrow. Happy New Year!
Okay, so quick question for clarity...when I make the CRP Sheet Worker, can the Sheet Worker call attributes declared on the rest of the HTML code OR do I need to re-establish those values in the CRP Sheet Worker somehow?
1704594720

Edited 1704594854
GiGs
Pro
Sheet Author
API Scripter
The CRP can call the attribute values, and it does it the same as any other sheet worker. Wrap the internals of your sheet worker in a getAttrs function, like on('change:whatever', () =&gt; { getAttrs(['whatever'], values =&gt; { \\ your CRP workings here. }): }); the attribute or attributes grabbed are inside the values object. You can copy them into their own variables like this: const new_variable = +values.whatever || 0; If its not a number, you can get rid of the coercion into a number and do this: const new_variable = values.whatever;