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

Psionic Dispel checks using macros, help needed!

1413901039

Edited 1413901509
The situation is this: I'm playing a psion and I use Dispel Psionics. I use shards to boost my augmentation by a variable number (I use my character sheet for this) and I also have a variable manifester level (Again, on the sheet). I can augment this power as normal. Now I tried making a code that takes 1d20 adds my manifester level and then adds the augmentation. BUT, the augmentation bonus + the manifester level can not exceed +20 (As per the power description). This is what I got, though I admit I am new to using KL1 in my macros: [[1d20+{@{Charlie|ManifesterLevel}, 10}KL1+{(?{Augmented points?|0}*2+@{Charlie|ShardMod}*2), (20-{@{Charlie|ManifesterLevel}, 10}KL1)}KL1]] This, for some reason, does not actually roll anything. It just seems to ignore it... Anyone know why?
1413901368

Edited 1413901475
The reason it becomes so complicated, is because there's some odd cases that otherwise won't be covered by the macro. Take for example my current situation: I'm manifester lvl 9 for a +9 bonus, I use both my shards to augment the power by +4, so that's another +8 bonus. But I want the total +20 bonus, so I spend 2 power points for another +4 bonus. The total of this is +21, which is 1 too many and since the augmentation needs to give +11, I can't just limit the manifester level at 10 and then limit the augmentation bonus at +10 (Since the total would only be +20 if my manifester level is 10 or more in that case).
1413919586
Lithl
Pro
Sheet Author
API Scripter
Without checking, I believe the problem is your nested KL groups. Could you try this, and see if it works for you? [[1d20 + {@{Charlie|ManifesterLevel}, 10}KL1 + {(?{Augmented points?|0} + @{Charlie|ShardMod}) * 2, 20 - (((@{Charlie|ManifesterLevel} + 10) - abs(@{Charlie|ManifesterLevel} - 10)) / 2)}KL1]] This replaces the nested KL with the equation ((X + Y) - abs(X - Y)) / 2 , which finds the minimum value of X and Y, equivalent to using KL.
1413920623

Edited 1413921223
there is an abs function!? That alone I thank you greatly for letting me know, but this code actually does neatly solve my problem! :D Kudos to you Brian! EDIT: And now I also know not to nest KL1 functions and just use this instead ^^.
1413923941
Lithl
Pro
Sheet Author
API Scripter
Note that the above doesn't work if you need to compare two die rolls, or a die roll and a number, since both X and Y are referenced twice and you can't re-use the results of a roll.
Hmm, true. There's no way to make temporary variables or anything of the like, right?
1414001739
Lithl
Pro
Sheet Author
API Scripter
Not without the API, no.