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

Roll Query and floor

1447167009

Edited 1447167532
I am trying to model casting at a higher spell level for the D&D 5e Spiritual Weapon in the regular 5e character sheet (not shaped). This is what I got so far: (?{Spell Slot|2}/2)d8 Spiritual Weapon gets one additional damage dice per two spell levels, so this works perfectly fine as long as I cast it only at even levels. If I use this function with an odd level spell slot (which of course doesn't make much sense, but is technically possible), it'll round the number of dice up to the next full number, which is not how the spell works. The obvious solution would be to use the floor() function, but I've ran into a problem there: floor(?{Spell Slot|2}/2)d8 will only return the value of the roll query divided by two, rounded down and not roll any dice. I'm still new to all this, so I'm wondering, is there something wrong with my syntax, or is this a limitation of the dice system? Now, this isn't a big issue. As mentioned it works perfectly fine as long as I don't screw around with it, I'm just trying to understand how all this works. :) Edit: Nevermind, I just figured out how to make it work. Just put the floor() function in an inline roll: [[floor(?{Spell Slot|2}/2)]]d8
1447168003

Edited 1447168206
The Aaron
Roll20 Production Team
API Scripter
Great! &nbsp;We always like the questions that answer themselves. =D You might additionally be interested in the drop down syntax for Roll Queries: ?{Spell Slot|2,1|4,2|6,3|8,4}d8 The above will prompt for the spell slot to use with a drop down containing only 2, 4, 6 and 8. &nbsp;Selecting one of those will result in the values 1,2,3 or 4. &nbsp;That saves the possibility of entering something invalid. There are some examples in the Wiki here: <a href="https://wiki.roll20.net/Macros#Drop-Down_Prompts_" rel="nofollow">https://wiki.roll20.net/Macros#Drop-Down_Prompts_</a>... &nbsp;
Oh nice! I knew there had to be more to that feature! I'll stick with my solution, though. I may run into a situation where I have to use an odd spell slot anyway, even though it doesn't make sense, simply because I have no even ones left. :)
1447168986

Edited 1447186353
The Aaron
Roll20 Production Team
API Scripter
No problem. =D &nbsp;Always nice to have options. &nbsp; You could also add those slots as notes: ?{Spell Slot|2 (3),1|4 (5),2|6 (7),3|8 (9),4|}d8 or as other lines: ?{Spell Slot|2,1|4,2|6,3|8,4|Waste a 3,1|Waste a 5,2|Waste a 7,3|Waste a 9,4}d8 Just throwing those out as possibles. &nbsp;Maybe they'll solve some other problem. =D
Yeah, I see how that works, that's pretty nifty. I have a lot of reading to do on Macros. :) Thanks!
1447171439
DK Heinrich
Marketplace Creator
Sheet Author
ok, i will be that guy... waste not waist - right?&nbsp;
1447181738

Edited 1447181762
I use this (?{Spell Slot Level|2}/2-.5)d8 as the program rounds up, but Arron's idea is a good one too.
1447186334
The Aaron
Pro
API Scripter
DK Heinrich said: ok, i will be that guy... waste not waist - right?&nbsp; BHAHAHAHA.. Is this my wife? &nbsp;=D &nbsp; &nbsp;&lt;fixing it&gt;
1447186633
DK Heinrich
Marketplace Creator
Sheet Author
The Aaron said: DK Heinrich said: ok, i will be that guy... waste not waist - right?&nbsp; BHAHAHAHA.. Is this my wife? &nbsp;=D &nbsp; &nbsp;&lt;fixing it&gt; hahaha - I am actually horrible at spelling/grammer/word policing - but I just wanted to give you crap :)
1447192722
Ziechael
Forum Champion
Sheet Author
API Scripter
DK Heinrich said: The Aaron said: DK Heinrich said: ok, i will be that guy... waste not waist - right?&nbsp; BHAHAHAHA.. Is this my wife? &nbsp;=D &nbsp; &nbsp;&lt;fixing it&gt; hahaha - I am actually horrible at spelling/grammer/word policing - but I just wanted to give you crap :) I noticed but chose to 'not' be 'that guy' ;)