I'm trying a program on Anydice that uses d6s where 1-3 = minor success, and 4-6 = major success. After the roll of 1 to 3 of these, you roll a different d6 where on a 5 or 6 you cancel (Nix) a minor success. This is the program I've come up with after long hours of attempt:
W: {1:3, 2:3}
D: {0:4, 1:2}
function: W:n outcomes {
MAJOR: 0
MINOR: 0
SUCCESSES: 0
if W = 2 { MAJOR: 1 }
if W = 1 { MINOR: 1 }
SUCCESSES: MAJOR + MINOR
result: SUCCESSES
}
loop DICE over {1..3} {
TOTAL: 0
function: D:n cancels {
NIX: 0
if D = 0 { NIX: 0 }
if D = 1 { NIX: 1 }
result: NIX
loop THROW over {1..DICE} { TOTAL: TOTAL + [W dW outcomes] }
if [count 1 in TOTAL > 0] & [count 1 in NIX = 1] { TOTAL: -1 }
}
output TOTAL named "[DICE] D"
}
However I'm getting a
"syntax error: I was expecting a "}" somewhere, to end a code block."
But doesn't look like there are any brackets left to close. Can someone identify what is wrong with the program and enlighten me if there is a better way to do this?