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] GroupInitiative 0.9.20 - Trying to subtract a stat's value.

Running a 2nd Edition AD&D campaign and I use the dexreact attribute as a bonus to initiative rolls, which actually means that the character's dexreact attribute is subtracted from their initiative roll. The formula I use is [[ d10 + @{weapspeed} - (@{dexreact}) + ?{Misc Adjustments?|0} ]] The macro I have actually uses a selector query for where the above basic formula shows weapspeed and calls the first 4 weapons from the repeating list on the character sheet as well as having options for different types of unarmed actions. Using scrolls, rings, innate abilities etc. That macro is great and I intend for my players to continue using the macro in all it's coolness for their own initiative. I'm trying to get GroupInitiave set up so I can do monster initiatives quickly but I can't seem to figure out how to get the API to subtract the dexreact attribute, and the thought of going through every monster character sheet that I have set up and switching the signs is really really not appealing. Ideally I'm looking to set up a bonus group rule that adds the weapspeed of the first weapon on the monster's character sheet subtracts the dexreact attribute. Just stumped on how to write a rule that subtracts an attribute instead of adding it to the roll If it's not something that the API is capable of, could I sweet talk you into adding the capability? Thanks a bunch
1485153050
The Aaron
Pro
API Scripter
You certainly can.  Let me take a quick look... =D
I certainly can what? Sweet talk you into adding it, or do what I want and I just haven't figured out how?
1485153379
The Aaron
Pro
API Scripter
Actually, looks I've added that in my development copy, but not pushed it to the main line yet.  If you go down to line 194 and insert this block of code:             'negative': {                 func: function(v) {                     return '(-('+v+'))';                 },                 desc: 'Returns the negative version of the stat'             }, you can use --negative, where you would use --Bare and get the value subtracted. That will look like this (bold code is the addition):         statAdjustments = {             'Stat-DnD': {                 func: function(v) {                     return 'floor((('+v+')-10)/2)';                 },                 desc: 'Calculates the bonus as if the value were a DnD Stat.'             },             'negative': {                 func: function(v) {                     return '(-('+v+'))';                 },                 desc: 'Returns the negative version of the stat'             },             'Bare': {                 func: function(v) {                     return v;                 },                 desc: 'No Adjustment.'             },             'Floor': {                 func: function(v) {                     return 'floor('+v+')';                 },                 desc: 'Rounds down to the nearest integer.'             }, If you don't feel sanguine about adding code, feel free to drop me a PM with an invite to your game and subsequently GM me and I can come make the custom mod for you real quick. I'll get this pushed into the mainline as soon as I get my guild system fixed (Node/npm/gulp is a fickle mistress!). Happy Rolling!
1485153411
The Aaron
Pro
API Scripter
Elena S. said: I certainly can what? Sweet talk you into adding it, or do what I want and I just haven't figured out how? (The former)
Lol No, I don't mind adding the new code in myself at all. Thanks for having it nice and handy. Glad I didn't make you do any extra work as it was already incorporated into your dev version. ;) TYVM
1485154030
The Aaron
Pro
API Scripter
No worries!  let me know if you need anything else! Happy Rolling!
1485154757

Edited 1485154846
Elena S.
Sheet Author
So you know I had to tweak the code to             'negative': {                 func: function(v) {                     return '(-1*('+v+'))';                 },                 desc: 'Returns the negative version of the stat'             }, Having just the bare - sign before the internal set returned the error: SyntaxError: Expected [0-9] but "(" found.undefined Changing it to '(-1*('+v+'))' fixed the issue and it's working great. Thanks
1485154832
The Aaron
Pro
API Scripter
Ah, great!  Possibly I have not tested that enough yet. =D Thanks for letting me know!
Guess I  better add this to mine as well. Thanks for the question and the brainstorming!