
So I'm trying to do something that (I think) should be fairly simple, but I've been banging my head against the wall with this for hours now.
The rules (in pseudo-code) that I'm trying to implement in a roll button for a custom sheet are as follows:
let total = @{dice} + ?{bonus}
if [total] > 0
then
roll = [total]d6kh1
else
roll = 2d6kl1
In english: if the total number of dice is greater than 0, then roll that total and keep the highest; if it's equal to or less than 0 then roll 2 dice instead and keep the lowest.
I've tried implementing this using an inline conditional and a pseudo-reuse inside my roll template as follows:
{{roll=[[{{[[(@{${name}-dice}?{Boons / Curses|NA,+0|+2D,+2|+1D,+1|−1D,-1|−2D,-2})]],-1}>0}*([[[[(@{${name}-dice}?{Boons / Curses|NA,+0|+2D,+2|+1D,+1|−1D,-1|−2D,-2})]]d6sd]]-[[2d6sd]]]])+$[[3]]]]}}
but it's a horrible mess, and very difficult to debug. It's possible there's just a missed bracket or something, because the results it's spitting out when i test the roll button are almost right (just with a whole bunch of gobeldigoop inbetween), but I feel like there must be an easier way than this! Plus, on top of that, there's a secondary rule that I'd like to be able to account for too. So normally you only care about the result of the highest die in your roll, but if you rolled multiple 6s then you 'crit', and I'd like to be able to highlight that somehow. Currently I have no idea how to implement that.
I've heard about this new custom roll parsing feature, but I'm so bad with javascript. I don't know why this is, but it's my cryptonite. I look at js, and it's just noise to me. Even though I can program in plenty of other languages just fine. If this were python, c#, or rust, I'd be flying.
Anyway... so can CRP or some other kind of sheetworker help me with this conditional roll?
(The system is ICON btw, if anyone is familiar or wants to help me and wants to read the rules in more detail, the game is free).