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

Two-dimensional table lookup

I've got the following table: Modified Roll: ≤0 1 2 3 4 5 6 7 8 9 10 ≥11 Attacker's Span 1 1 1 * * * * 0 0 0 (1) (1) (1) 2 1 1 1 * * * * 0 0 0 (1) (1) 3 1 1 1 1 * * * * 0 0 0 (1) 4 2 1 1 1 1 * * * * 0 0 (1) 5 2 2 1 1 1 1 * * * * 0 (1) All characters in the game have the stat Span.  In an attack, the attacker rolls 1d10, adds his Span, subtracts his target's Span, and modifies for additional circumstances. He then cross-references the resulting number with his own Span to get the damage result in the table. Is there any way, short of programming a whole new API script, to do this sort of column-shift table-lookup in Roll20?
1461353593
The Aaron
Pro
API Scripter
Not easily.  There is probably some summation of terms equation that could be written which would arrive at the correct value, but it would be quite a bit of work to setup.  Easier to write an API script for it, which would be pretty trivial.
1461360304

Edited 1461443013
Silvyre
Forum Champion
Here's a macro for a table roll that uses PowerCards , which I cannot recommend higher for applications like this: !power {{ --name|Table Roll --Target's Span:|[[ ?{Target's Span|1|2|3|4|5} ]] --Attacker's Span:|[[ ?{Attacker's Span|1|2|3|4|5} ]] --Modified Roll:|[[ [$R] 1d10 + ?{Attacker's Span} - ?{Target's Span} + ?{Modifiers|0} ]] -- ?? $R <= 0 ?? Results:|[[ [TXT] 1 + [[ {?{Attacker's Span} + d0}>4 ]] + 0d0 ]] -- ?? $R == 1 ?? Results:|[[ [TXT] 1 + [[ {?{Attacker's Span} + d0}=5 ]] + 0d0 ]] -- ?? $R >= 2 AND $R <= ?{Attacker's Span} ?? Results:|1 -- ?? $R >= [[ ?{Attacker's Span} + 1 ]] AND $R <= [[ ?{Attacker's Span} + 4 ]] ?? Results:|* -- ?? $R >= [[ ?{Attacker's Span} + 5 ]] AND $R <= [[ ?{Attacker's Span} + 7 ]] AND $R < 11 ?? Results:|0 -- ?? $R >= [[ ?{Attacker's Span} + 8 ]] OR $R >= 11 ?? Results:|(1) }} Of course, I'll be more than happy to answer any questions you might have about this macro. (I haven't tested this macro fully, so if you end up using it and something seems off, please don't hesitate to PM me.)
I've begun looking into programming the API now. Doesn't seem too hard once you see where it's coming from, though I found the documentation a little hard to fathom at first, since it seems to teach entirely by example, rather than laying out syntax first. I'll give PowerCards a try, thanks.