How you'd like it
If you really want to do the summing directly in code, probably the easiest way would be to use a helper function like this:
function: COUNT:n minimum MIN:n {
if COUNT < 0 { result: -1 }
if COUNT < MIN { result: 0 }
result: 1
}
This just takes a number COUNT
(which could be the result of any dice roll) and compares it to a target number MIN
, returning -1 if the count is negative, 0 if it's non-negative but less than the target, and 1 if it's equal to or greater than the target. Plotting e.g. [[roll X d NORMAL] minimum 4]
will then directly give you the probabilities you asked for.
Of course, it's also easy enough to loop this over a range of dice pool sizes, if that's what you want.
The other way
There's no need to write any extra code for this, since the AnyDice user interface already provides the "At Least" and "At Most" modes that automatically sum the output probabilities.
For example, running the code by Jasper Flick from this answer (which, by default, uses DIFFICULTY: 7
and X: 4
dice) and clicking the "At Least" button gives the following output:
Looking at the bar labeled "4" in each graph, we can see that the probability of rolling at least 4 successes (with 4 dice against difficulty 7, in this case) is normally 2.56%, and rises to 11.86% with specialization, 15.36% with willpower and 27.94% with both.
Similarly, looking at the bar labeled "0" in the same output gives the probability of not botching (since the code treats a botched roll as -1 successes), which is 93.29% without willpower (and 100% with it). To get the probability of botching the roll, you can either subtract that from 100% (and, hopefully, get 6.71%), or just switch to "At Most" mode and look at the "-1" bar instead.