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

Macro help (Deadlands Classic)

So in Deadlands you roll a number of differen't dice d4 up to d12 with the results exploding if you roll the highest number on the die, you have a difficulty number which ranges from 3 5 7 9 11 you also have modifiers to the dice roll then even 5 over the target number you get a raise. With this macro I want it to work it all out for me and my players. Is that possible (I have pro so I can use API) I am not sure if this macro is working right.  !power {{ --Roll|[! [^Dice.base] !] --Raises|[[ [$Dice] floor((?{Number of Dice|1}?{Dice type|d4|d6|d8|d10|d12}!!k1+?{Modifier|0} - ?{What's the Difficulty?|1}) / 5)]] }}
1596517355
Oosh
Sheet Author
API Scripter
What is the k1 for after the exploding dice? I don't think that will do anything. I don't have API, so I've just turned this into a template and added some tags. The mouseover kind of seems to show it's all working as intended, apart from the keep highest one operator, which I don't really understand - if the die has exploded it's already rolled max value. Even if the kh1 operator worked here, it would always keep the max die value, wouldn't it? &{template:default} [[floor(([[?{Number of Dice|1}?{Dice type|d4|d6|d8|d10|d12}!!k1[Roll] + ?{Modifier|0}[Mod]]] - ?{What's the Difficulty?|1}[DC])/5)]] {{Roll=$[[0]]}}{{Raise=$[[1]]}} Anyway... this seems to be doing what you want it to apart from that, I think? All I've done is add some extra [[ ]] brackets to isolate the dice roll + modifier.
k1 as in keep 1
1596545410

Edited 1596546989
Oosh
Sheet Author
API Scripter
EDIT - for clarity, there are two operators that start with "KEEP": KL1 (keep lowest 1) and KH1 (keep highest 1). K1 is an abbreviation of KH1. "k1" saves a keypress, but "kh1" makes it easier to read code! Yep, I know what the operator does... I'm confused about what you're trying to do with it.Is the "keep highest" applied after the explosion?Or is it only applied in the case of "2d4" <--- kh1, then "explode"?Where you have it now, it isn't doing anything. Try this: /r 100d1!!kh1 I'll bet your result isn't "1" My question is: what are you trying to achieve with the "k1/kh1" (same thing) operator? If it's an important part of the math, it's currently not doing anything useful. Never mind, turns out I'm not familiar with compounding dice and the k1 does actually work there, after I rolled a bunch of numbers... I thought the !! was just infinitely exploding and kept the last result... which is just stoopid. So.... Everything is working fine then I think? :) As far as you've described it, the math seems solid. So if someone rolls 10d4, and the results are: {3 | 3 | 1 | 2 | 2 | 4 + 4 + 1 | 3 | 1 | 4 + 2 | 2}kh1 then the result should be 9 (6th result, compounded total)... is that right?
Looks right to me, seems to behave. I do have two more macros that could do with help on. They're not far removed from what we have so far. So first we have range damage that a number of dice that can explode and you add them up. the total is then divided by the size of the target which is usually 6 to get a total of wounds. For example, I'm shooting with Colt Peacemaker that does 3d6 damage and say I rolled a 20 the target size is 6 (It can be different) 20/6 would equal 3 wounds, so a way of manually entering the size of the target and dice would be cool with a modifier as well just in case.  Then there is Melee damage that works similarly but differently they make a STR check like the standard roll as before (there is no difficulty) and that's added to the weapon damage which works the same way as the shooting damage.
Oosh said: What is the k1 for after the exploding dice? I don't think that will do anything. I don't have API, so I've just turned this into a template and added some tags. The mouseover kind of seems to show it's all working as intended, apart from the keep highest one operator, which I don't really understand - if the die has exploded it's already rolled max value. Even if the kh1 operator worked here, it would always keep the max die value, wouldn't it? &{template:default} [[floor(([[?{Number of Dice|1}?{Dice type|d4|d6|d8|d10|d12}!!k1[Roll] + ?{Modifier|0}[Mod]]] - ?{What's the Difficulty?|1}[DC])/5)]] {{Roll=$[[0]]}}{{Raise=$[[1]]}} Anyway... this seems to be doing what you want it to apart from that, I think? All I've done is add some extra [[ ]] brackets to isolate the dice roll + modifier. Having worked with a bit of the rolltemplate and going over the docs, I haven't seen [[##]] used before. I assume this uses a previous result -- correct?
1596655289
GiGs
Pro
Sheet Author
API Scripter
Baledin said: Having worked with a bit of the rolltemplate and going over the docs, I haven't seen [[##]] used before. I assume this uses a previous result -- correct? Just to be clear, its not [[##]], its $[[##]]. The $ at the start is vital. $[[0]] gets the value of the first inline roll in the line; $[[1]] refers to the second, and so on. The purpose of that first inline roll (with another nested inside it) thats not inside {{ }} brackets means it doesnt get passed to the rolltemplate, but the $[[##]] sections inside {{ }} ensure that they are passed to the rolltemplate where you want them.
Thanks GiGs. Is that in the documentation somewhere? Super useful to know but it's the first I'm seeing it.
1596660837
GiGs
Pro
Sheet Author
API Scripter
Its a recently discovered hack, so there's no official documentation. It's described in the Stupid tricks thread, under Reusing Rolls.
I had reviewed the stupid tricks thread awhile ago so either missed it or it came later. Always helpful, GiGs. Thanks again!
1596665428
GiGs
Pro
Sheet Author
API Scripter
Baledin said: I had reviewed the stupid tricks thread awhile ago so either missed it or it came later. Always helpful, GiGs. Thanks again! You're welcome! It's one of the newer tricks in the thread, so it's not surprising to miss it.