General method to output dd1,d2,d3…dn in AnyDiceHow do I find the highest number rolled in a pool if dice, and the number of times it is rolled using AnyDice?AnyDice Help: ORE-Like ResolutionCompare die pool probabilities in AnyDiceAnyDice functions and subsequent dice rollsImplementing multiattack in AnyDiceHow can I model this “Party Draft Pool” ability score generation method in AnyDice?Exploding “D9” success-counting pools in anydice?How can I calculate the sum of 2 random dice out of a 3d6 pool in AnyDice?

How does a Mandalorian eat food if he never takes his helmet off?

Gradient, Divergence and Curl

A twisted enigma

Why aren't there attempts to evolve classical musical instruments so that they're easier to play?

What are basic concepts of fusion kitchen?

Is Yoda made using CGI in the original Star Wars or is it practical effects?

Is the .wav file created from a .mp3 file has better quality than the .mp3 file itself?

How does a common emitter amplifier work (intuitively)

What is the meaning of "wiped my face with a planet"?

Fishy: An ASCII Programming Language

Why is this overload of a conversion operator chosen?

Selecting from a list of tuples

How to set up a "Forced choice" for players in a game?

How to protect an employee's wages before the company declares bankruptcy?

Large (70) stellar mass black hole disrupts astrophysics?

Are there any surviving Ancient Greek letters (epistolary)?

Can one get into trouble if one doesn't show up at the gate 30 minutes before departure (or whatever time window the boarding pass is indicating)?

Why only sine waves?

What is the difference between Shadowrun 3e and 6e?

Bitcoin sent, recipient claiming not received

When is TeX better than LaTeX?

Why does the takeoff N1 limit start to decrease below 30°C OAT?

Is the "p" in "spin" really a "b"?

Was refused in UK, should I replace my passport?



General method to output dd1,d2,d3…dn in AnyDice


How do I find the highest number rolled in a pool if dice, and the number of times it is rolled using AnyDice?AnyDice Help: ORE-Like ResolutionCompare die pool probabilities in AnyDiceAnyDice functions and subsequent dice rollsImplementing multiattack in AnyDiceHow can I model this “Party Draft Pool” ability score generation method in AnyDice?Exploding “D9” success-counting pools in anydice?How can I calculate the sum of 2 random dice out of a 3d6 pool in AnyDice?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









7















$begingroup$


I'm trying to find a more general method to create certain one-sided distributions using anydice.com, such that the values less than or equal to 0 show as 0, and the rest show normally, of a 2dy-8 dice roll.



As an example, for a 2d6-8, I will enter the following:



output (2d6-8>0)*dd1,d2,d3,d4,


while for 2d7-8, I will enter the following:



output (2d7-8>0)*dd1,d2,d3,d4,d5,d6.


These give me exactly what I want, but for higher values of y (2d12, for instance), this becomes more and more cumbersome, so I'm wondering if there is a more general (compact) way to write this out. Also, I do not want to have to make a custom function, but rather use only the single-line general "output xxx" language anydice employs.



Any help or suggestions is greatly appreciated.










share|improve this question











$endgroup$










  • 1




    $begingroup$
    Hi Russ, welcome to rpg.se! Take the tour and visit the help center for more information.
    $endgroup$
    – linksassin
    Sep 26 at 0:18

















7















$begingroup$


I'm trying to find a more general method to create certain one-sided distributions using anydice.com, such that the values less than or equal to 0 show as 0, and the rest show normally, of a 2dy-8 dice roll.



As an example, for a 2d6-8, I will enter the following:



output (2d6-8>0)*dd1,d2,d3,d4,


while for 2d7-8, I will enter the following:



output (2d7-8>0)*dd1,d2,d3,d4,d5,d6.


These give me exactly what I want, but for higher values of y (2d12, for instance), this becomes more and more cumbersome, so I'm wondering if there is a more general (compact) way to write this out. Also, I do not want to have to make a custom function, but rather use only the single-line general "output xxx" language anydice employs.



Any help or suggestions is greatly appreciated.










share|improve this question











$endgroup$










  • 1




    $begingroup$
    Hi Russ, welcome to rpg.se! Take the tour and visit the help center for more information.
    $endgroup$
    – linksassin
    Sep 26 at 0:18













7













7









7





$begingroup$


I'm trying to find a more general method to create certain one-sided distributions using anydice.com, such that the values less than or equal to 0 show as 0, and the rest show normally, of a 2dy-8 dice roll.



As an example, for a 2d6-8, I will enter the following:



output (2d6-8>0)*dd1,d2,d3,d4,


while for 2d7-8, I will enter the following:



output (2d7-8>0)*dd1,d2,d3,d4,d5,d6.


These give me exactly what I want, but for higher values of y (2d12, for instance), this becomes more and more cumbersome, so I'm wondering if there is a more general (compact) way to write this out. Also, I do not want to have to make a custom function, but rather use only the single-line general "output xxx" language anydice employs.



Any help or suggestions is greatly appreciated.










share|improve this question











$endgroup$




I'm trying to find a more general method to create certain one-sided distributions using anydice.com, such that the values less than or equal to 0 show as 0, and the rest show normally, of a 2dy-8 dice roll.



As an example, for a 2d6-8, I will enter the following:



output (2d6-8>0)*dd1,d2,d3,d4,


while for 2d7-8, I will enter the following:



output (2d7-8>0)*dd1,d2,d3,d4,d5,d6.


These give me exactly what I want, but for higher values of y (2d12, for instance), this becomes more and more cumbersome, so I'm wondering if there is a more general (compact) way to write this out. Also, I do not want to have to make a custom function, but rather use only the single-line general "output xxx" language anydice employs.



Any help or suggestions is greatly appreciated.







anydice






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 26 at 1:05







Russ

















asked Sep 25 at 23:37









RussRuss

733 bronze badges




733 bronze badges










  • 1




    $begingroup$
    Hi Russ, welcome to rpg.se! Take the tour and visit the help center for more information.
    $endgroup$
    – linksassin
    Sep 26 at 0:18












  • 1




    $begingroup$
    Hi Russ, welcome to rpg.se! Take the tour and visit the help center for more information.
    $endgroup$
    – linksassin
    Sep 26 at 0:18







1




1




$begingroup$
Hi Russ, welcome to rpg.se! Take the tour and visit the help center for more information.
$endgroup$
– linksassin
Sep 26 at 0:18




$begingroup$
Hi Russ, welcome to rpg.se! Take the tour and visit the help center for more information.
$endgroup$
– linksassin
Sep 26 at 0:18










2 Answers
2






active

oldest

votes


















12

















$begingroup$

You want to use the highest of NUMBER and NUMBER function in AnyDice instead, so that you don't need to manually specify the outcome based on your prior knowledge of how that roll should behave.



output [highest of 2d6-8 and 0]
output [highest of 2d7-8 and 0]
output [highest of 2d12-8 and 0]


Each of these will treat all negative results of the 2dX-Y roll as being equal to 0 instead.






share|improve this answer












$endgroup$













  • $begingroup$
    Excellent, that works perfectly. Many thanks.
    $endgroup$
    – Russ
    Sep 26 at 11:56


















2

















$begingroup$

In general, if AnyDice didn't happen to already have a suitable function built in (as noted in Xirema's answer), the answer would be to make a custom function. Like this, for example:



function: ROLL:n but not less than zero 
if ROLL < 0
result: 0
else
result: ROLL



output [2d12 - 8 but not less than zero]


The reason why you need a (custom or built-in) function is that if you try to use a die roll in an if statement outside of a function, AnyDice will refuse to do run the code and print an error message instead:




calculation error



Boolean values can only be numbers, but you provided "d?".

Depending on what you want, you might need to create a function.




However, if you pass that same die roll to a function that expects a number (i.e. has :n after the parameter name), then AnyDice will automatically call the function for every possible value of the roll and collect the results back into a custom die. Inside the function, the parameter (e.g. ROLL above) will be a fixed number, and thus expressions involving it (like ROLL < 0) will have a definite fixed value that can be safely used in an if statement.



(If you want to look at the individual dice in a rolled pool of two or more, you can also make the function expect a sequence by replacing the :n with :s. In this particular case it wouldn't make any difference, however, since applying math operations like - 8 to a dice pool in AnyDice will automatically add up all the dice together before doing the math. So there's no way to get the individual d12s back out of 2d12 - 8.)






share|improve this answer










$endgroup$















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "122"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    noCode: true, onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );














    draft saved

    draft discarded
















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2frpg.stackexchange.com%2fquestions%2f156800%2fgeneral-method-to-output-dd1-d2-d3-dn-in-anydice%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown


























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    12

















    $begingroup$

    You want to use the highest of NUMBER and NUMBER function in AnyDice instead, so that you don't need to manually specify the outcome based on your prior knowledge of how that roll should behave.



    output [highest of 2d6-8 and 0]
    output [highest of 2d7-8 and 0]
    output [highest of 2d12-8 and 0]


    Each of these will treat all negative results of the 2dX-Y roll as being equal to 0 instead.






    share|improve this answer












    $endgroup$













    • $begingroup$
      Excellent, that works perfectly. Many thanks.
      $endgroup$
      – Russ
      Sep 26 at 11:56















    12

















    $begingroup$

    You want to use the highest of NUMBER and NUMBER function in AnyDice instead, so that you don't need to manually specify the outcome based on your prior knowledge of how that roll should behave.



    output [highest of 2d6-8 and 0]
    output [highest of 2d7-8 and 0]
    output [highest of 2d12-8 and 0]


    Each of these will treat all negative results of the 2dX-Y roll as being equal to 0 instead.






    share|improve this answer












    $endgroup$













    • $begingroup$
      Excellent, that works perfectly. Many thanks.
      $endgroup$
      – Russ
      Sep 26 at 11:56













    12















    12











    12







    $begingroup$

    You want to use the highest of NUMBER and NUMBER function in AnyDice instead, so that you don't need to manually specify the outcome based on your prior knowledge of how that roll should behave.



    output [highest of 2d6-8 and 0]
    output [highest of 2d7-8 and 0]
    output [highest of 2d12-8 and 0]


    Each of these will treat all negative results of the 2dX-Y roll as being equal to 0 instead.






    share|improve this answer












    $endgroup$



    You want to use the highest of NUMBER and NUMBER function in AnyDice instead, so that you don't need to manually specify the outcome based on your prior knowledge of how that roll should behave.



    output [highest of 2d6-8 and 0]
    output [highest of 2d7-8 and 0]
    output [highest of 2d12-8 and 0]


    Each of these will treat all negative results of the 2dX-Y roll as being equal to 0 instead.







    share|improve this answer















    share|improve this answer




    share|improve this answer








    edited Sep 26 at 7:31









    Carcer

    38.1k6 gold badges124 silver badges190 bronze badges




    38.1k6 gold badges124 silver badges190 bronze badges










    answered Sep 26 at 3:01









    XiremaXirema

    41k4 gold badges128 silver badges230 bronze badges




    41k4 gold badges128 silver badges230 bronze badges














    • $begingroup$
      Excellent, that works perfectly. Many thanks.
      $endgroup$
      – Russ
      Sep 26 at 11:56
















    • $begingroup$
      Excellent, that works perfectly. Many thanks.
      $endgroup$
      – Russ
      Sep 26 at 11:56















    $begingroup$
    Excellent, that works perfectly. Many thanks.
    $endgroup$
    – Russ
    Sep 26 at 11:56




    $begingroup$
    Excellent, that works perfectly. Many thanks.
    $endgroup$
    – Russ
    Sep 26 at 11:56













    2

















    $begingroup$

    In general, if AnyDice didn't happen to already have a suitable function built in (as noted in Xirema's answer), the answer would be to make a custom function. Like this, for example:



    function: ROLL:n but not less than zero 
    if ROLL < 0
    result: 0
    else
    result: ROLL



    output [2d12 - 8 but not less than zero]


    The reason why you need a (custom or built-in) function is that if you try to use a die roll in an if statement outside of a function, AnyDice will refuse to do run the code and print an error message instead:




    calculation error



    Boolean values can only be numbers, but you provided "d?".

    Depending on what you want, you might need to create a function.




    However, if you pass that same die roll to a function that expects a number (i.e. has :n after the parameter name), then AnyDice will automatically call the function for every possible value of the roll and collect the results back into a custom die. Inside the function, the parameter (e.g. ROLL above) will be a fixed number, and thus expressions involving it (like ROLL < 0) will have a definite fixed value that can be safely used in an if statement.



    (If you want to look at the individual dice in a rolled pool of two or more, you can also make the function expect a sequence by replacing the :n with :s. In this particular case it wouldn't make any difference, however, since applying math operations like - 8 to a dice pool in AnyDice will automatically add up all the dice together before doing the math. So there's no way to get the individual d12s back out of 2d12 - 8.)






    share|improve this answer










    $endgroup$


















      2

















      $begingroup$

      In general, if AnyDice didn't happen to already have a suitable function built in (as noted in Xirema's answer), the answer would be to make a custom function. Like this, for example:



      function: ROLL:n but not less than zero 
      if ROLL < 0
      result: 0
      else
      result: ROLL



      output [2d12 - 8 but not less than zero]


      The reason why you need a (custom or built-in) function is that if you try to use a die roll in an if statement outside of a function, AnyDice will refuse to do run the code and print an error message instead:




      calculation error



      Boolean values can only be numbers, but you provided "d?".

      Depending on what you want, you might need to create a function.




      However, if you pass that same die roll to a function that expects a number (i.e. has :n after the parameter name), then AnyDice will automatically call the function for every possible value of the roll and collect the results back into a custom die. Inside the function, the parameter (e.g. ROLL above) will be a fixed number, and thus expressions involving it (like ROLL < 0) will have a definite fixed value that can be safely used in an if statement.



      (If you want to look at the individual dice in a rolled pool of two or more, you can also make the function expect a sequence by replacing the :n with :s. In this particular case it wouldn't make any difference, however, since applying math operations like - 8 to a dice pool in AnyDice will automatically add up all the dice together before doing the math. So there's no way to get the individual d12s back out of 2d12 - 8.)






      share|improve this answer










      $endgroup$
















        2















        2











        2







        $begingroup$

        In general, if AnyDice didn't happen to already have a suitable function built in (as noted in Xirema's answer), the answer would be to make a custom function. Like this, for example:



        function: ROLL:n but not less than zero 
        if ROLL < 0
        result: 0
        else
        result: ROLL



        output [2d12 - 8 but not less than zero]


        The reason why you need a (custom or built-in) function is that if you try to use a die roll in an if statement outside of a function, AnyDice will refuse to do run the code and print an error message instead:




        calculation error



        Boolean values can only be numbers, but you provided "d?".

        Depending on what you want, you might need to create a function.




        However, if you pass that same die roll to a function that expects a number (i.e. has :n after the parameter name), then AnyDice will automatically call the function for every possible value of the roll and collect the results back into a custom die. Inside the function, the parameter (e.g. ROLL above) will be a fixed number, and thus expressions involving it (like ROLL < 0) will have a definite fixed value that can be safely used in an if statement.



        (If you want to look at the individual dice in a rolled pool of two or more, you can also make the function expect a sequence by replacing the :n with :s. In this particular case it wouldn't make any difference, however, since applying math operations like - 8 to a dice pool in AnyDice will automatically add up all the dice together before doing the math. So there's no way to get the individual d12s back out of 2d12 - 8.)






        share|improve this answer










        $endgroup$



        In general, if AnyDice didn't happen to already have a suitable function built in (as noted in Xirema's answer), the answer would be to make a custom function. Like this, for example:



        function: ROLL:n but not less than zero 
        if ROLL < 0
        result: 0
        else
        result: ROLL



        output [2d12 - 8 but not less than zero]


        The reason why you need a (custom or built-in) function is that if you try to use a die roll in an if statement outside of a function, AnyDice will refuse to do run the code and print an error message instead:




        calculation error



        Boolean values can only be numbers, but you provided "d?".

        Depending on what you want, you might need to create a function.




        However, if you pass that same die roll to a function that expects a number (i.e. has :n after the parameter name), then AnyDice will automatically call the function for every possible value of the roll and collect the results back into a custom die. Inside the function, the parameter (e.g. ROLL above) will be a fixed number, and thus expressions involving it (like ROLL < 0) will have a definite fixed value that can be safely used in an if statement.



        (If you want to look at the individual dice in a rolled pool of two or more, you can also make the function expect a sequence by replacing the :n with :s. In this particular case it wouldn't make any difference, however, since applying math operations like - 8 to a dice pool in AnyDice will automatically add up all the dice together before doing the math. So there's no way to get the individual d12s back out of 2d12 - 8.)







        share|improve this answer













        share|improve this answer




        share|improve this answer










        answered Sep 26 at 12:30









        Ilmari KaronenIlmari Karonen

        12.8k3 gold badges36 silver badges52 bronze badges




        12.8k3 gold badges36 silver badges52 bronze badges































            draft saved

            draft discarded















































            Thanks for contributing an answer to Role-playing Games Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2frpg.stackexchange.com%2fquestions%2f156800%2fgeneral-method-to-output-dd1-d2-d3-dn-in-anydice%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown









            Popular posts from this blog

            Tamil (spriik) Luke uk diar | Nawigatjuun

            Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

            Where does the image of a data connector as a sharp metal spike originate from?Where does the concept of infected people turning into zombies only after death originate from?Where does the motif of a reanimated human head originate?Where did the notion that Dragons could speak originate?Where does the archetypal image of the 'Grey' alien come from?Where did the suffix '-Man' originate?Where does the notion of being injured or killed by an illusion originate?Where did the term “sophont” originate?Where does the trope of magic spells being driven by advanced technology originate from?Where did the term “the living impaired” originate?