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

Inline roll failure

Been trying to build some macros to help automate combat a little in a Shadowrun game I play, but kept getting slapped with a "Could not determine result type of: [{"type":"M","expr":"(floor(8/3)+floor(0/3))"},{"type":"C","text":"d6>5"}]" error. After taking everything apart and putting it back together I think I found the culprit: /roll [[ ( floor( @{stun}/@{paintolerance} ) + floor( @{physical}/@{paintolerance} ) )d6>5 ]] Was using this to automatically insert a dice penalty into larger macros. The bug only crops up when the floor() function and the d6>5 function are both within the double brackets.
1411064063
Lithl
Pro
Sheet Author
API Scripter
You can't use functions (such as floor) to define the number of dice to roll. However, you can use the result of an inline roll to define the number of dice, regardless of what's used in the inline roll: /roll [[floor( @{stun}/@{paintolerance} ) + floor( @{physical}/@{paintolerance} )]]d6>5 (This also makes more sense, because otherwise you're basically saying something to the effect of "/roll 3 successes") Additionally, the number of dice is automatically rounded to the nearest whole number. You could avoid using floor altogether: /roll (@{stun}/@{paintolerance} - 0.5)d6>5 + (@{physical}/@{paintolerance} - 0.5)d6>5 OR [[(@{stun}/@{paintolerance} - 0.5)d6>5 + (@{physical}/@{paintolerance} - 0.5)d6>5]] Taking out the calls to floor lets you put the entire thing in an inline roll, instead of using /roll. The -0.5 in the above formula is because the number of dice has round applied rather than floor; round(x - 0.5) produces the same behavior as floor(x).
1411065325

Edited 1411065349
Will K.
Sheet Author
That last solution is perfect! It was actually right under my nose all morning, kept trying to come up with overcomplicated ways to round a number down to it's closest integer. Well, that's what a lack of sleep will do. Thanks so much for the help!
1411068917

Edited 1411069572
Will K.
Sheet Author
Well, that didn't work quite as well as I hoped. See, I'm not looking to roll ( floor(@{stun}/@{paintolerance}) +floor(@{physical}/@{paintolerance}) )d6>5, I'm actually looking to subtract that from a dice pool. The whole macro looks a bit more like this: /r ( @{attribute} +@{skill} +?{modifiers} -( (@{stun}/@{paintolerance}) +(@{physical}/@{paintolerance}) ) )d6k@{accuracy} After what you posted I thought I'd get away with the following change: [[ ( @{attribute} +@{skill} +?{modifiers} -( [[ (@{stun}/@{paintolerance} -0.5) d1>1]] + [[ (@{physical}/@{paintolerance} -0.5 ) d1>1 ]] )d6k@{accuracy} ]] Was trying for a boolean arrangement with the (x-0.5)d1>1, turns out it doesn't like nested brackets though, and without them it becomes: [[ ( @{attribute} +@{skill} +?{modifiers} -( (@{stun}+@physical)/@{paintolerance} -1) )d6k@{accuracy} ]] Shadowrun is a complicated system. Really big dicepools, lots of modifiers, and 3 rolls for every combat action. One roll to hit a target, one roll by the target to avoid being hit, and another roll to reduce the damage of being hit. It's satisfying to play, but combat can chug for hours with everyone trying to add/subtract the appropriate modifiers from three different dice pools with every turn. I have a macro that'll do most of the work with two clicks and an input prompt, but the math is messy and fills the chatbox. So, while I was hoping to hide everything inside an inline value, it's not strictly necessary. Still, I really appreciate you're taking the time to help!
1411072619

Edited 1411073478
Lithl
Pro
Sheet Author
API Scripter
Are @{stun} and @{physical} always going to be equal or less than @{paintolerance}? (Your attempt with d1>1 implies this.) If so, I think there might be a way. Otherwise, I don't think you'll be able to get away with just a single inline roll. Edit: Well, my idea for that solution is coming up with the number of dice to roll, but not actually rolling the dice for some reason. Assuming you want stun/paintolerance and physical/paintolerance to produce 0 or 1, though, this one ought to work, just not as a purely inline roll: /roll [[@{attribute} + @{skill} + ?{modifiers} - {@{stun} - @{paintolerance}, -1}kh1 - {@{physical} - @{paintolerance}, -1}kh1 - 2]]d6k@{accuracy}
1411075159

Edited 1411075169
Gauss
Forum Champion
Moved to specific use questions since this is not a bug.
1411127671

Edited 1411133711
Will K.
Sheet Author
Unfortunately I don't think there's going to be an elegant solution after all. Stun and Physical are separate damage tracks and Paintolerance is the increment on each track by which negative modifiers are applied to the rolls. The whole macro looks something like this: ability: shoot at target /emas @{name} fires a round at @{target|name}! /desc Net Hits= /roll [[ (@{primaryweaponskill} +?{modifiers?|0} -(floor( @{stun}/@{paintolerance} ) + floor( @{physical}/@{paintolerance} )))]]d6k@{primaryweaponacc}>5 - [[ (@{target|intuition} +@{target|reaction} -(floor( @{target|stun}/@{target|paintolerance} ) + floor( @{target|physical}/@{target|paintolerance} )))]]d6>5 /emas @{target|name} takes net hits plus [[ @{primaryweapondam} -( @{target|body} +@{target|armor} +@{target|armormisc} +@{primaryweaponap} )d6>5 ]] damage if target is hit! Damage is stun if attack doesn't succeed with at least [[(ceil((@{target|armor}+@{target|armormisc}+@{primaryweaponap})/2))-@{primaryweapondam}]] net hits. I was hoping to make it work like this: /emas @{name} fires a round at @{target|name}! @{name} scores [[ (@{primaryweaponskill} +?{modifiers?|0} -(floor( @{stun}/@{paintolerance} ) + floor( @{physical}/@{paintolerance} )))d6k@{primaryweaponacc}>5 - (@{target|intuition} +@{target|reaction} -(floor( @{target|stun}/@{target|paintolerance} ) + floor( @{target|physical}/@{target|paintolerance} )))d6>5 ]] net hits! @{target|name} takes net hits plus [[ @{primaryweapondam} -( @{target|body} +@{target|armor} +@{target|armormisc} +@{primaryweaponap} )d6>5 ]] damage! Damage is stun if attack doesn't succeed with at least [[(ceil((@{target|armor}+@{target|armormisc}+@{primaryweaponap})/2))-@{primaryweapondam}]] net hits. But I can live with what I got. Anyways, thanks again guys for taking a look.