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

I can't seem to insert a "floor()" into variable dice amount macro?

I am running a 3.5 game and am setting up macros for my players which are less than amazing with the rules. One player has chosen a spell which allows a variable amount of dice with a maximum, and I got that, but I can't get the function to round down without it breaking. The spell is lesser, orb of sound, which I have copy/pasted below... An orb of sonic about 2 inches across shoots from your palm at its target, dealing 1d8 points of sonic damage. You must succeed on a ranged touch attack to hit your target.  For every two caster levels beyond 1st, your orb deals an additional 1d8 points of damage: 2d8 at 3rd level, 3d8 at 5th level, 4d8 at 7th level, and the maximum of 5d8 at 9th level or higher. I wrote a macro that will calculate how many dice will be rolled, and automatically roll them, with the max of 5d8, buuuut I need it to round down. This part works fine= [[  {(  1+((@{arcanecasterlevel}-1)/2)  )d8, 5d8}kl1  ]]  }}, but its missing the floor() that will round down decimals. If I put that in, then it breaks. Here is what I need it to be= [[  {(  1+floor((@{arcanecasterlevel}-1)/2)  )d8, 5d8}kl1  ]]  }}.  I feel like this is just a syntax error, but I put in a new set pf parenthesis all over this thing and it doesn't seem to help. Any suggestions?
1652711592
Kraynic
Pro
Sheet Author
This is untested, but I would try replacing the outer () with [[]]. That will force it to be resolved to a number before it tries to roll any dice, since the dice roller works from the innermost to outermost with inline rolls. [[  {[[1+floor((@{arcanecasterlevel}-1)/2)]]d8, 5d8}kl1  ]] I also removed some of the spaces, in case they were an issue.
That is really fascinating. I never considered [[ ]] brackets inside of other brackets. I put it in and it works. You have leveled up my macro skill. Gosh, I wonder if this is what it feels like for the Dragoborn, when he hands gold to Faendal? I feel kind of bad for stealing it all back now. Thanks for the help, and the moral conundrum.