Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

help with a macro in-line

Hi there, I am trying to build a macro that will let me select dice by spell level, and also only take 2's as the lowest possible roll.

(1+?{What Spell Level?|2|3|4|5|6|7|8|9})d6, (1+?{What Spell Level?|2|3|4|5|6|7|8|9})d2r]kh(1+?{What Spell Level?|2|3|4|5|6|7|8|9})

this is what i started with, for a 2nd lvl spell that does 3d6 damage, and scales by 1d6 per lvl to 9, so it rolls (1+2)d6, (1+2)d2r, and keep the highest (1+2)

what i think is supposed to happen is it should first roll my 3d6, so i get (X+y+Z), then it should be rolling my d2's, but also re-rolling any 1s, so i should end up with (2+2+2). then it should have (X+Y+Z+2+2+2)kh3, and never return a 1. however i have had it return a 1, another attempt i made was this


(1+?{What Spell Level?|2|3|4|5|6|7|8|9})d6, (200)d2r]kh(1+?{What Spell Level?|2|3|4|5|6|7|8|9})


where it would roll the d6s, and a crazy amount of d2s, and keep the highest, the odds of it ever returning a 1 should be crazy low, but it still is happening. i must have a syntax error or something? any help would be appreciated.

December 20 (2 years ago)

Edited December 20 (2 years ago)

Question: are you trying to reroll any 1s, or are you treating any 1s that are rolled as a 2? Those are two different things but it looks like you're trying to do both.

If you simply want to reroll 1s then the macro is pretty simple:

[[[[1+?{What Spell Level?|2|3|4|5|6|7|8|9}]]d6r]]

But if you want to treat all rolled 1s as 2s, then that isn't so simple, because the 'kh' will apply to the full die roll, not each individual roll.

So for a 2d6 roll like this:

[[{[[2d6]],2}kh1]]

The 2 is being compared to the 2d6 result, not each individual die roll. If you get a 1 and a 3 on the dice rolls, then the two is being compared to a 4, not the 1 and 3 separately.

To compare a 2 against each die, you'd have to construct this:

[[{[[1d6]],2}kh1 + {[[1d6]],2}kh1]]

So to put it in a full macro where you roll (1+1)d6 per level (with html substitutions) looks like this:

[[?{What Spell Level?|
2,{[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1|
3,{[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1|
4,{[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1|
5,{[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1|
6,{[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1|
7,{[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1|
8,{[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1|
9,{[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1 + {[[1d6]],2}kh1}}]]

Or you can create a comparison with a grouped roll (with html substitutions):

?{What Spell Level?|
2,[[{1d6,1d6,2d1,2d1}kh2]]|
3,[[{1d6,1d6,1d6,2d1,2d1,2d1}kh3]]|
4,[[{1d6,1d6,1d6,1d6,2d1,2d1,2d1,2d1}kh4]]|
5,[[{1d6,1d6,1d6,1d6,1d6,2d1,2d1,2d1,2d1,2d1}kh5]]|
6,[[{1d6,1d6,1d6,1d6,1d6,1d6,2d1,2d1,2d1,2d1,2d1,2d1}kh6]]|
7,[[{1d6,1d6,1d6,1d6,1d6,1d6,1d6,2d1,2d1,2d1,2d1,2d1,2d1,2d1}kh7]]|
8,[[{1d6,1d6,1d6,1d6,1d6,1d6,1d6,1d6,2d1,2d1,2d1,2d1,2d1,2d1,2d1,2d1}kh8]]|
9,[[{1d6,1d6,1d6,1d6,1d6,1d6,1d6,1d6,1d6,2d1,2d1,2d1,2d1,2d1,2d1,2d1,2d1,2d1}kh9]]}

I think the first one has a prettier output (it just shows up in a yellow box), whereas the second one will always show up in a blue box. But the second one has a more 'readable' tooltip, which may be handy if you want to see what all the rolls actually were.

There may be a way to do this that I'm not aware of, so if someone comes along with some elegant macro then just ignore all of this!

December 20 (2 years ago)
GiGs
Pro
Sheet Author
API Scripter

Does the character have a level attribute? You could have the macro reference that than require entering it manually.

Is the roll basically using d6's with a minimum 2?

In that case the best way is to roll d5+1. Something like

[[1+?{What Spell Level?|2|3|4|5|6|7|8|9}]]d5 + [[1+ ?{What Spell Level?}]]



December 20 (2 years ago)


GiGs said:

Does the character have a level attribute? You could have the macro reference that than require entering it manually.

Is the roll basically using d6's with a minimum 2?

In that case the best way is to roll d5+1. Something like

[[1+?{What Spell Level?|2|3|4|5|6|7|8|9}]]d5 + [[1+ ?{What Spell Level?}]]

Yeah... that's the much more elegant approach that I was talking about!

But I think it needs to be wrapped in one additional set of braces:

[[ [[1+?{What Spell Level?|2|3|4|5|6|7|8|9}]]d5 + [[1+ ?{What Spell Level?}]] ]]
December 20 (2 years ago)
GiGs
Pro
Sheet Author
API Scripter


Jarren said:

Yeah... that's the much more elegant approach that I was talking about!
Thats what I get for having the tab open too long before replying - I didn't see you'd already replied :)

I want to thank everyone for their help. I kept working on this late at night and ended up with a version of Evan G.'s Elemental adept micro

{?{Dice Number|1}{d6}+?{Dice Number}d2r<1}kh?{Dice Number}

with a modification to the "at higher lvl" wording of the spell description telling me how many dice i need to roll/lvl. for example
Burning Hands 

and essentially have two versions of the spells my character casts that can be transmuted to his adept/affinity. the vanilla version, kept also as a reference, and then the Lightning version with the macro and for thunderwave(lightning)lvl1=2 lvl2=3 lvl3=4 lvl4=5 lvl5=6 lvl6=7lvl7=8 lvl8=9 lvl9=10,      and change the d6 to a d8. i also slip a + CHA MOD in there at the end.