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

Sheet worker scripts???

I'm wondering if there's a way to simplify the roll button equation I am currently using by way of script workers. I know nothing about functions or any type of js stuff, so it would need to be explained to me like I'm 5 lol. I have included a link to look at the sheet I'm working on in case it's needed for anyone to figure out anything, but basically at line 25: &lt;td colspan="2" align="center"&gt;&lt;button type="roll" value="&{template:default} {{name= @{character_name} rolls some bullshit }} {{Roll=[[ 1d20! +@{hasINT} +@{hasREA} +@{hasREA2} +@{hasREC} +@{hasPRE} +@{hasPSY} +@{hasSP} +@{hasSP2} +@{hasPHY} +@{hasPHY2} +@{hasETHIC} +@{hasETHIC2} +@{hasdrive} +@{hasheavy} +@{hasoper} +@{haspaero} +@{haspcap} +@{haspdiri} +@{haspgrav} +@{haspgyro} +@{hasphover} +@{hasphydro} +@{haspov} +@{haspof} +@{hasppa} +@{haspsub} +@{hasptread} +@{hasGen1} +@{hasGen2} +@{hasGen3} +@{hasGen4} +@{hasGen5} +@{hasGen6} +@{hasGen7} +@{hasGen8} +@{hasGen9} +@{hasGen10} +@{hasGen11} +@{hasGen12} +@{hasGen13} +@{hasGen14} +@{hasGen15} +@{hasGen16} +@{hasGen17} +@{hasGen18} +@{hasGen19} +@{hasGen20} +@{hasSpec1} +@{hasSpec2} +@{hasSpec3} +@{hasSpec4} +@{hasSpec5} +@{hasSpec6} +@{hasSpec7} +@{hasSpec8} +@{hasSpec9} +@{hasSpec10} +@{hasElite1} +@{hasElite2} +@{hasElite3} +@{hasElite4} +@{hasElite5} +@{hasaero} +@{hasacc} +@{hasant} +@{hasarr} +@{hasast} +@{hasav} +@{hasbasic} +@{hasbio} +@{hasbio2} +@{hasbro} +@{hasbot} +@{hascap} +@{haschem} +@{hasclo} +@{hascomm} +@{hascomp} +@{hascook} +@{hascryo} +@{hascyber} +@{hasdemo} +@{hasdiag} +@{hasdirr} +@{hasdisg} +@{haselec} +@{haselec2} +@{hasexpert} +@{hasfirst} +@{hasforg} +@{hasgamb} +@{hasgen} +@{hasgene} +@{hasgrav} +@{hasgeo} +@{hasgyro} +@{hasharm} +@{hashack} +@{hashist} +@{hasinte} +@{hasisso} +@{hasisso2} +@{hasknow} +@{haslibr} +@{hasmath} +@{hasnano} +@{hasorbi} +@{haspaint} +@{haspa} +@{hasperc} +@{hasphoto} +@{haspharm} +@{haspick} +@{hasplay} +@{hasprog} +@{hasrad} +@{hasshad} +@{hasshield} +@{hasstock} +@{hasstreet} +@{hassub} +@{hassurg} +@{hassyst} +@{hasteach} +@{hasterm} +@{hasweap} +@{haswild} +@{haszoo} +@{hasstr} +@{hasend} +@{hasath} +@{hasbal} +@{hasbrawl} +@{hasclimb} +@{hasdodge} +@{hasdrop} +@{hasesc} +@{haseva} +@{hasfenc} +@{hasmart} +@{hasmelee} +@{hasquick} +@{hassoh} +@{hasstealth} +@{hasthrow} +@{haszero} +@{hasarch} +@{hashand} +@{hasrifle} +@{hasremote} +@{hastox} +@{hasSTUN} +@{hasprobe} +@{hasrange} +@{hassearch} +@{haslocate} +@{hasgaze} +@{hasproj} +@{hashumi} +@{hasflow} +@{hasdren} +@{hashydris} +@{hascraft} +@{hasillus} +@{hasperm} +@{hasfade} +@{hasshift} +@{hassacr} +@{hasmulti} +@{hasleach} +@{hasevent} +@{hascale} +@{hashist2} +@{haspath} +@{hassooth} +@{hasoracle} +@{haswisen} +@{hasfing} +@{hasobject} +@{hasrever} +@{haswill} +@{hasillu} +@{hassear} +@{hasignite} +@{haspyre} +@{hasstun2} +@{hasrend} +@{hascharge} +@{hasdeto} +@{hasflood} +@{haspurge} +@{haspsycho} +@{haspush} +@{hasshield} +@{hasbubb} +@{haswall} +@{haspush} +@{hasgrab} +@{hasdefl} +@{hassense} +@{hasemote} +@{hasdeep} +@{hastag} +@{hassugg} +@{hascomma} +@{hascommu} +@{haswipe} +@{haswrite} +@{hasfrune} +@{hasguard} +@{hasdefend} +@{hastelem} +@{hasrun} +@{hasswim} +@{hasjump} +@{hasaerob} +@{hascoun} +@{hasinter} +@{hasintim} +@{haslead} +@{hasperf} +@{haspain} +@{hassedu} +@{hassoci} +@{hassubt}]] }}" name="roll_Check"&gt;&lt;/button&gt;&lt;/td&gt; The sheet I have set up is for a custom game and has A LOT of skill trees. Is there a way that when you press the roll button, it only looks for the boxes that are currently "checked" and adds only those numbers to the roll instead of returning a value of 0 for all skills not checked. I hope Im being clear enough to be understood lol. I can try to explain further if needed. Link to full sheet code: <a href="https://drive.google.com/file/d/0B3x2GpqkqnRlMmFqN" rel="nofollow">https://drive.google.com/file/d/0B3x2GpqkqnRlMmFqN</a>...
1471889790
Lithl
Pro
Sheet Author
API Scripter
You could have a sheet worker that waits for any of those attributes to change, calculates the total and stores the result in a hidden attribute, and then the roll button would just call that attribute. You can't have a sheet worker respond to the roll button press, though.
Thanks, I didnt think so, but it was worth a try lol
Radio buttons can work, instead of checkboxes. &nbsp;It would be two radio buttons per skill,&nbsp; &lt;input type="radio" name="hasINT" value=""/&gt; &lt;input type="radio" name="hasINT" value="+foo"/&gt;&nbsp; Special&nbsp;note: the add sign ('+') is inside the radio button. &nbsp; and have the button not have the add sign:: &nbsp;value="&{template:default} {{name= @{character_name} rolls some bullshit }} {{Roll=[[ 1d20! @{hasINT} @{hasREA} I am assuming the end result you are looking for not having a huge list of "+0" in the pop up that shows up in the chat.