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

Trying to use a "last rolled macro result" into a larger macro

November 29 (1 year ago)

Hi,

I'm trying to implement a macro for an inflation rate calculation of sale values for my players in a space campaign,


What i currently have is :

Upon arriving to a planet (roll inflation) 

[[(1+((1d100-1d100)/100))]]


When trying to roll for an item price adjusted for inflation (with a last divider for a tariff system) :

[[(((?{Enter Inflation Rate:}*?{Enter Product Price:}))/1.3)]] 

Now what i'm wondering is whether there is a way to directly pull the last "inflation roll result" instead of manually needing to enter the inflation rate for each calculation,


I hope this is clear and somebody may have an answer :)


- C.C

November 29 (1 year ago)

Edited November 29 (1 year ago)

With a Pro account, this would be possible. One way to do this would be to store the roll result in an attribute on a character sheet in the campaign. Say you have a Mule type character, you can create a new attribute on them to store the roll result. Since this is in the Mod forum, I am assuming that Mods are available in the game. So something like ChatSetAttr could be used to create the new attribute and adjust it. Then you could retrieve that attribute with @{MuleCharacter|planet-inflation} when you need it.

EDIT:

Figured I could provide a little example using ChatSetAttr like above and ZeroFrame from the MetaScript Toolbox.

!{{
  &{template:default}({)name=Inflation(})({)Inflation=[[(1+((1d100-1d100)/100))]](})
  !setattr --name MuleCharacter --planet-inflation|$[[0]]
}}

Uses ZeroFrame batching to do your Inflation roll displayed in the default roll template and re-use that inflation roll in a ChatSetAttr command to put that value into an attribute name planet-inflation on a character named MuleCharacter.

Then you can retrieve that value with @{MuleCharacter|planet-inflation}

November 29 (1 year ago)

Thank you very much !


Love this