I'm clueless, need help with dice roller

Hey, I'm planning a gen to roll three 1d10 dice. However, If all three are above 5 (not on) I'm planning to add a skill point. However, I don't have any idea how to do that and count to make sure it is automatically counted.

; 3d10.ipt
; created 1/2/2021 6:46:38 AM
Set: die1b=[die1]
Set: die2b=[die2]
Set: die3b=[die3]

Table: main
[@die1][When]{die1b}>;5[do][@die2][else][do][@die2][end][when]{die2b}>;[do][@die3][else][do][@die3][end][when]{die3b}>;5[do][@yay][else][do][@oh][end]

Table: die1
{1d10},

Table: die2
{1d10},

Table: die3
{1d10},

Table: yay
one skill +1

Table: oh
no skill

Comments

  • edited January 2

    Without getting into the code, the way I'd attempt this is to have one variable called something like bonus-skill. Have it set: bonus-skill=0 in the header of the gen file.

    Have your main table do something like:
    [@rollstat] [when] {@bonus-skill} > 2 [do] [@skill] [end]

    rollstat looks like this:

    Table: rollstat
    {die1b=={1d10}} [when] {@die1b} > 5 [do] {bonus-skill=={{$bonus-skill}+1}}&
    {die2b=={1d10}} [when] {@die2b} > 5 [do] {bonus-skill=={{$bonus-skill}+1}}&
    {die3b=={1d10}} [when] {@die3b} > 5 [do] {bonus-skill=={{$bonus-skill}+1}}

    So basically, without figuring all the correct syntax for brackets and $'s, your rolling the 3 d10's one at a time and assigning their values to die1b, die2b, die3b (so you can add them or display them, or whatever.

    And immediately after rolling, you are evaluating whether greater than 5. If so, you increment @bonus-skill by one. If the value is 3 after this table call, then all 3 rolls would have had to be greater than 5... if it's 0, 1, or 2, then at least one roll was 5 or less.

    Now that you have this value, your main table command line evaluates @bonus-skill... if it's a 3 (i.e. greater than 2) it goes on to call a table roll for the bonus skill (or a text output "hooray, you get to pick another skill"... whatever you want). If that when-do is false, it does nothing. Of course the double == in that rollstat table makes those rolls silent.

    *** If you are doing this multiple times, be sure to add something like
    {bonus-skill==0} at the very start of table rollstat, or at the very end of the main table command line, so that value is reset to 0 before you make the next 3 d10 rolls.

    (and the hyphen in bonus-skill is bugging me... I'd select a better, simple name for it.

  • Okay, but I'm rolling the dice for a game where every point greater than five does then intended effect. like a 4, 7, and 9 does a total of 6 damage because 7-5=2 and 9-5=4. I'm still going to need the die to not be silent.

  • I just tried executing it and the results looked like code to me. I added an [End] to the end of each line (before this: &) and it starting making no results. I tried generating it in a list of 250 and none of them said anything about skills even as I added that table at the bottom.

  • I worked on getting the right syntax (I can never remember the brackets, $'s, @'s) and worked in the damage. At the end of table main, I display the three die rolls to see if it's working right. This should be pretty easy to pick apart and see what it's doing:

    ; DiceGen.ipt
    ; created 1/3/2021 4:33:57 PM
    set: bonusSkill=0
    set: die1=0
    set: die2=0
    set: die3=0
    set: damage=0
    
    Table: main
    [@rollstat] Damage is {$damage} [when] {$bonusSkill} > 2 [do] [@skill] [end]\n\n&
    die one is {$die1}\n&
    die two is {$die2}\n&
    die three is {$die3}
    
    Table: rollstat
    {die1=={1d10}} [when] {$die1} > 5 [do] {bonusSkill=={{$bonusSkill}+1}} {damage=={{$die1}-5}} [end]&
    {die2=={1d10}} [when] {$die2} > 5 [do] {bonusSkill=={{$bonusSkill}+1}} {damage=={{$damage}+{$die2}-5}} [end]&
    {die3=={1d10}} [when] {$die3} > 5 [do] {bonusSkill=={{$bonusSkill}+1}} {damage=={{$damage}+{$die3}-5}} [end]
    
    Table: skill
    Congrats... choose a bonus skill!
    
  • I appreciate it. This does it exactly.

  • I feel stupid.

    Each new skill added can be applied as a die to be rolled. However, only three dice of the character's choosing are accepted unless they have advantage or disadvantage. Either way I will be testing how to do this. If I need help I'll contact you.

  • A little more help?

    ; DiceGen.ipt
    ; created 1/3/2021 4:33:57 PM
    set: bonusSkill=0
    set: die1=0
    set: die2=0
    set: die3=0
    set: die1b=0
    set: die2b=0
    set: die3b=0
    set: die1c=0
    set: die2c=0
    set: die3c=0
    set: damage=0
    prompt: Rolls {1|2|3|4|5|6|0} 0

    Table: main
    [@rollstat] Damage is {$damage} [when] {$bonusSkill} > 2 [do] [@skill] [end]\n\n&
    die one is {$die1}\n&
    die two is {$die2}\n&
    die three is {$die3}\n&

    @Rolls=(0+(1{$prompt1}))} Rolls\n&
    [@{0+(1{$prompt1})} item]

    Table: item
    {die1b=={1d6}} [when] {$die1b} > 3 [do] {bonusSkill=={{$bonusSkill}+1}} {damage=={{$damage}+{$die1b}-3}} [end]&
    {die2b=={1d6}} [when] {$die2b} > 3 [do] {bonusSkill=={{$bonusSkill}+1}} {damage=={{$damage}+{$die2b}-3}} [end]&
    {die3b=={1d6}} [when] {$die3b} > 3[do] {bonusSkill=={{$bonusSkill}+1}} {damage=={{$damage}+{$die3b}-3}} [end]
    {die1c=={1d6}} [when] {$die1c} > 3 [do] {bonusSkill=={{$bonusSkill}+1}} {damage=={{$damage}+{$die1c}-3}} [end]&
    {die2c=={1d6}} [when] {$die2c} > 3 [do] {bonusSkill=={{$bonusSkill}+1}} {damage=={{$damage}+{$die2c}-3}} [end]&
    {die3c=={1d6}} [when] {$die3c} > 3[do] {bonusSkill=={{$bonusSkill}+1}} {damage=={{$damage}+{$die3c}-3}} [end]

    Table: rollstat
    {die1=={1d6}} [when] {$die1} > 3 [do] {bonusSkill=={{$bonusSkill}+1}} {damage=={{$die1}-3}} [end]&
    {die2=={1d6}} [when] {$die2} > 3 [do] {bonusSkill=={{$bonusSkill}+1}} {damage=={{$damage}+{$die2}-3}} [end]&
    {die3=={1d6}} [when] {$die3} > 3[do] {bonusSkill=={{$bonusSkill}+1}} {damage=={{$damage}+{$die3}-3}} [end]

    Table: skill
    Congrats... choose a bonus skill!

  • Really, your code is only missing a { directly before the (0 in the new @Rolls-(0...

    And, you didn't add anything after that to redisplay the new damage after doing all those extra rolls.

    So, I just changes those two lines - @Rolls... - to this (you can actually silence the Rolls line with a == now we know that it is assigning the correct value, and then use Rolls in the Table: Item call since it has a good value):

    Extra Rolls... {Rolls={(0+(1{$prompt1}))}} Rolls\n&
    [@{Rolls} item] New damage is {$damage}
    

    Lastly, I moved the prompt: to the before the set: commands. Not sure if necessary, but I always prompt first as a standard.

    It gives output without errors, but I'm not 100% sure it's exactly calculating right. Would maybe need to output every roll to check (and better understand the intended rule).

    Full code looks like this, if it's easier to cut and paste all:

    ; DiceGen2.ipt
    ; created 1/7/2021 1:24:47 PM
    prompt: Rolls {1|2|3|4|5|6|0} 0
    
    set: bonusSkill=0
    set: die1=0
    set: die2=0
    set: die3=0
    set: die1b=0
    set: die2b=0
    set: die3b=0
    set: die1c=0
    set: die2c=0
    set: die3c=0
    set: damage=0
    
    Table: main
    [@rollstat] Damage is {$damage} [when] {$bonusSkill} > 2 [do] [@skill] [end]\n\n&
    die one is {$die1}\n&
    die two is {$die2}\n&
    die three is {$die3}\n&
    
    Extra Rolls... {Rolls={(0+(1{$prompt1}))}} Rolls\n&
    [@{Rolls} item] New damage is {$damage}
    
    Table: item
    {die1b=={1d6}} [when] {$die1b} > 3 [do] {bonusSkill=={{$bonusSkill}+1}} {damage=={{$damage}+{$die1b}-3}} [end]&
    {die2b=={1d6}} [when] {$die2b} > 3 [do] {bonusSkill=={{$bonusSkill}+1}} {damage=={{$damage}+{$die2b}-3}} [end]&
    {die3b=={1d6}} [when] {$die3b} > 3[do] {bonusSkill=={{$bonusSkill}+1}} {damage=={{$damage}+{$die3b}-3}} [end]
    {die1c=={1d6}} [when] {$die1c} > 3 [do] {bonusSkill=={{$bonusSkill}+1}} {damage=={{$damage}+{$die1c}-3}} [end]&
    {die2c=={1d6}} [when] {$die2c} > 3 [do] {bonusSkill=={{$bonusSkill}+1}} {damage=={{$damage}+{$die2c}-3}} [end]&
    {die3c=={1d6}} [when] {$die3c} > 3[do] {bonusSkill=={{$bonusSkill}+1}} {damage=={{$damage}+{$die3c}-3}} [end]
    
    Table: rollstat
    {die1=={1d6}} [when] {$die1} > 3 [do] {bonusSkill=={{$bonusSkill}+1}} {damage=={{$die1}-3}} [end]&
    {die2=={1d6}} [when] {$die2} > 3 [do] {bonusSkill=={{$bonusSkill}+1}} {damage=={{$damage}+{$die2}-3}} [end]&
    {die3=={1d6}} [when] {$die3} > 3[do] {bonusSkill=={{$bonusSkill}+1}} {damage=={{$damage}+{$die3}-3}} [end]
    
    Table: skill
    Congrats... choose a bonus skill!
    

    But, again, you were basically only missing an { in one line.

  • I feel goofy... I'm also considering something. If I have it roll 1d6 and all are above 5 should they get two extra skills points? And three for all three being 6? JI wouldn't know how to factor that in but it might not make the game as fun... What do you think?

Leave a Comment