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

Help with default template

I am trying to write up a simple summon template macro for shadowrun, I have the following so far &{template:default} {{name=?{SummonType|} Force=?{Force|0} Pool=?{SummonDice|0}}}{{[[?{SummonDice|0}D6sd>5]]Vs[[?{Force|0}D6sd>5]]}} {{Drain Resist[[(?{DrainDice|0}D6sd>5)]]}} This works pretty well but I would like to be able to save off  [[?{Force|0}D6sd>5]] 's result and then re-use that value to calculate the drain which would "SavedValue"*2- [[(?{DrainDice|0}D6sd>5)]] Any way to store that value in a variable.
1666667078
timmaugh
Forum Champion
API Scripter
Hmm. So what you're want is doable... you just have to do it in one go, then peel off the rolls you need later. Anything between template parts won't print, so you can put your grandest, totalest roll there. Then reference the component parts where you need them. Your large roll would be to use the Force roll with the drain dice roll... [[ [[?{Force|0}d6sd>5]] * 2 - [[(?{DrainDice|0}d6sd>5)]] ]] That would produce three rolls you can reference elsewhere by their roll marker ID: $[[0]] = [[?{Force|0d6sd>5]] $[[1]] = [[(?DrainDice|0}d6sd>5)]] $[[2]] =  [[ [[?{Force|0}d6sd>5]] * 2 - [[(?{DrainDice|0}d6sd>5)]] ]] So you can do: &{template:default}  [[ [[?{Force|0}d6sd>5]] * 2 - [[(?{DrainDice|0}d6sd>5)]] ]]  {{name=?{SummonType|} Force=?{Force|0} Pool=?{SummonDice|0}}}{{[[?{SummonDice|0}D6sd>5]]Vs$[[0]]}} {{Drain Resist=$[[1]]}} {{Drain Value=$[[2]]}}
That seems to do it thanks!, as a follow up any way to set the final subtraction to a 0 floor instead of going negative?
1666770358
Gauss
Forum Champion
Bulldogc said: That seems to do it thanks!, as a follow up any way to set the final subtraction to a 0 floor instead of going negative? You can use the {X, Y}kh1 to do that.  Example:  [[ {[[ [[?{Force|0}d6sd>5]] * 2 - [[(?{DrainDice|0}d6sd>5)]]]], 0}kh1 ]]
1666826989

Edited 1666827034
That also got it, awesome thanks. For anyone else interested here is the final version. &{template:default} ?{SummonType|} [[ {[[ [[?{Force|0}d6sd>5]] * 2 - [[(?{DrainDice|0}d6sd>5)]]]], 0}kh1 ]] {{name=?{SummonType|} Force=?{Force|0} Pool=?{SummonDice|0}}}{{[[?{SummonDice|0}D6sd>5]]Vs$[[0]]}} {{Drain Resist=$[[1]]}}{{Drain=$[[3]]}}
1666828565

Edited 1666828595
timmaugh
Forum Champion
API Scripter
Just make sure you're using the correct roll in each part, now, as the new formation will have 4 indexed rolls (0 - 3).