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

Need help with inline macro

I'm trying to pull a stat off a D&D 4e character sheet, divide it by a certain amount, and then use that amount to determine how many of the Fate/fudge dice to roll. I'd like to do it as an inline roll, but I can't get it to work. I'm using the floor() function to get a whole number for the dice roll, but it won't actually do the dice roll unless I type it in funky, aka not as an inline roll, just inline calculations. I have a character named Nick's Fighter, he has a strength attribute of 18 (this can be referenced by @{Nick's Fighter|strength} which spits out the proper number when I do the inline command like this - [[@{Nick's Fighter|strength}]] which gives the little box with 18 in it), and I need to divide that attribute by 5. That should give me 3, and I want to roll that many fate dice. This is what I tried at first, but it gave me an error. (Could not determine result type of: [{"type":"M","expr":"floor(18/5)"},{"type":"C","text":"df"}]) [[floor(@{Nick's Fighter|strength}/5)df]] This is the only way I can get it to work. /r [[floor(@{Nick's Fighter|strength}/5)]]df What am I missing to get it all inline?
1402948746
The Aaron
Roll20 Production Team
API Scripter
Try: [[ ((@Nick's Fighter|strength}-2.5)/5)df ]] The -2.5 will cause the rounding to skew to where it behaves as floor and get you the right number of dice.
1402948996

Edited 1402949127
Lithl
Pro
Sheet Author
API Scripter
Try (@{Nick's Fighter|strength} / 5 - 0.5)df The number of dice is automatically rounded to the nearest whole number (because rolling a fractional number of dice doesn't make sense). To make sure your number doesn't get rounded up, subtract 0.5 from your initial result: 1.0 - 0.5 = 0.5 => 1 1.1 - 0.5 = 0.6 => 1 1.4 - 0.5 = 0.9 => 1 1.5 - 0.5 = 1.0 => 1 1.6 - 0.5 = 1.1 => 1 1.9 - 0.5 = 1.4 => 1
1402949058
The Aaron
Roll20 Production Team
API Scripter
This also works: [[ ({floor(@{Nick's Fighter}/5)}kh1)df ]]
1402949322
Lithl
Pro
Sheet Author
API Scripter
Aaron said: This also works: [[ ({floor(@{Nick's Fighter}/5)}kh1)df ]] I just get the number of dice (3) instead of the roll (3df).
Thanks guys, getting the results I'm wanting now! =D Really appreciate the speedy responses. You just made one flustered DM that much less stressed about running his game.
1402952893
The Aaron
Roll20 Production Team
API Scripter
Brian -- You're right, that second method doesn't work. I was so excited not to get the error that I forgot to check the results. =D Lake / James -- Glad to hear it!
1402956989
Lithl
Pro
Sheet Author
API Scripter
Worth mentioning: Aaron's first method and my method are the same thing, mathematically. (X - 2.5) / 5 = X / 5 - 2.5 / 5 = X / 5 - 0.5