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

Automating tokens, turning to rollable tables, other things

In my continuing effort to automate my mooks with macros, and if need be the API, I now turn to the rollable tables. In short, I'm running The One Ring, and mooks can be in a state of Weary, which affects their rolls, if they deplete their Hate resource. Because of the way mooks don't have a character sheet, the Hate value has to be one of the three values a Token can have. I now need to write a macro which if the Hate is equal to 0, rather than rolling like this: /r 1t[feat] + 3t[normal] > ?{Target Number|14} I need it to roll like this: /r 1t[feat] + 3t[weary] > ?{Target Number|14} If I had more places to store data about the mook, this wouldn't be a problem as I already have an API script that'll set the Weary state on characters, and there I can instead do this: /r 1t[feat] + 3t[@{selected|Weary}] > ?{Target Number|14} However on charactersheet-less tokens, that's not possible. So I was hoping perhaps I could simply point to a table, with the Hate value as the lookup value. However I'm not seeing anything like that, which makes me think it isn't possible.
1398956653
Lithl
Pro
Sheet Author
API Scripter
/r 1t[feat] + ({1,Hate}kl1) * 3t[normal] + (1 - {1,Hate}kl1) * 3t[weary] > ?{Target Number|14} If Hate is 1 or more, you'll get 1t[feat] + 1 * 3t[normal] + 0 * 3t[weary] . If Hate is 0, you'll get 1t[feat] + 0 * 3t[normal] + 1 * 3t[weary] . This breaks if Hate can be negative or fractional, though.
Fantastic!
I forgot to ask; what is that construct? {1,Hate}? I haven't seen any documentation that I can remember for it.
In the interest of future The One Ring players looking for solutions; this works, however it makes it a lot harder to parse the rolls, both for people and scripts.
1399065817

Edited 1399065992
Lithl
Pro
Sheet Author
API Scripter
{1,Hate}kl1 means (after replacing "Hate" with whatever attribute/bar/macro/etc is appropriate) "roll 1, then roll Hate, then keep the lower of the two". If "Hate" is a bar reference (eg, @{selected|bar_1}), for example, these will both be math-only rolls, and it's equivalent to using Math.min(1, Hate) in an API script. You can do the same thing with dice, for example {2d6,d10}kl1 . You can also use more than two values. You can also use kh (keep-high, instead of keep-low), and you can use values greater than 1 ( {d20,2d12,3d10,4d8,5d6,6d4}kh3 would roll a bunch of dice groups and keep the three best). If the rolls are all the same, you don't need the braces or delimited list; a D&D Next roll with Advantage could be 2d20kh1 . You can omit the H in kh# if you want, as well. It might be more difficult to parse, but as shown, it can allow some limited decision-making without requiring a Mentor subscription and an API script.
Yeah, don't misunderstand me, it's a clever solution; thank you