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

Can I roll a value, display it, then perform a math function on that value and display result?

1482067268
Garrett K.
Marketplace Creator
Example: Orc deals: 120 damage, Healing for 10% of damage dealt: 12 Hp Where the 120 damage is the rolled value, and the 12 Hp is the calculated 10% of the roll? If the calculation was done on a static field it could be an attribute, but since I want it to be dependent on a variable, do I have any options outside of API? Was considering building in a tokenmod api command into the macro as an alternative, which would set a temp stat like, "lastlifesteal" then the macro could call that attribute. But could it all be done in one single macro? Setting the attribute, and calling it?
1482068446
Silvyre
Forum Champion
Can I roll a value, display it, then perform a math function on that value and display result? Outside of the API, that could look like this: /r floor([[ 10d12 ]] / 10)
1482069420
Garrett K.
Marketplace Creator
Wouldn't that display only one result, which would be "12" in this case? I'd like it to read out, "120 / 12" Again that's outside API sidestepping, if that's necessary, then i suppose I begin my investigation for the simplest solution there through experimentation :)
1482069697
Jakob
Sheet Author
API Scripter
Yes, you'd need the API to re-use results in this manner. Powercards can probably do what you're looking for here.
1482070169
Garrett K.
Marketplace Creator
Jakob said: Yes, you'd need the API to re-use results in this manner. Powercards can probably do what you're looking for here. I've actually got Powercards open in another tab, I'll start there! Thanks
1482070481
Silvyre
Forum Champion
Using PowerCards in this way is a bit unintuitive, so, to save you some digging: !power {{ --!|[^Dmg] / [[ floor([$Dmg] 10d12 / 10) ]] }} or !power {{ --!|[! [^Dmg] !] / [[ floor([$Dmg] 10d12 / 10) ]] }}
1482076005
Garrett K.
Marketplace Creator
Silvyre said: Using PowerCards in this way is a bit unintuitive, so, to save you some digging: !power {{ --!|[^Dmg] / [[ floor([$Dmg] 10d12 / 10) ]] }} or !power {{ --!|[! [^Dmg] !] / [[ floor([$Dmg] 10d12 / 10) ]] }} ^ and $ are new to me, got powercards installed now and playing with it though. I'll be back if i can't get it!