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

Adding macro results together

September 28 (6 years ago)

Is it possible to add the result of multiple macros together? 

What I am trying to do is: a (Player select dropdown +1) (times a skill roll - 8 ) (Plusitem level divided by two). I couldn't figure out how to do it in one macro but each works on its own. 

September 28 (6 years ago)
GiGs
Pro
Sheet Author
API Scripter

I'm unclear from your example exactly what you are trying to do.

You can chain multiple macros together, but they need to be written carefully to allow it, and once done, they often dont work on their own any more. So you generally have the standalone macros you need, and then write a separate macro that contains them both. It's duplication, but necessary.

Another thing: you cannot save the results of one roll as a variable to reuse later. I'm not sure if this is relevant to what you're trying, but thought I'd mention it.

September 28 (6 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Assuming that the dropdown selection is one element, the roll happens at the time the macro is run, and the item level is a given attribute on a character, it should work. It's impossible to answer more succinctly without more details, such as which sheet you are using. This is a barebones example.

[[?{Select option|1}*1d20-8+@{Bob the Barbarian|itemlevel}/2]]

It would allow the user to select "1" from a drop down, multiply it by (1d20-8), and add the value for the attribute "itemlevel" on a character named "Bob the Barbarian".

September 28 (6 years ago)

Here is what I have for the individual macros.


[[ ?{Item Tier?|1|2|3} + 1]] * [[@{Player|GeneralEducation}d6-8]] + [[ ?{item Level?|}/2]]


September 28 (6 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Ah, is this a Pathfinder calculation?

September 28 (6 years ago)

No. This is for Pokemon Tabletop United. Not sure if that makes a difference. 

September 28 (6 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Try

[[(?{Item Tier?|1|2|3}+1)*(@{Player|GeneralEducation})d6-8+(?{item Level?|}/2)]]

You should use parentheses in many of the places you have brackets. I'm not certain if this exactly models the formula you wish--I'm not familiar with the system. But it should get you on the right track. Hover over the result in chat and see if the order of operations is correct.


September 28 (6 years ago)

That worked. Thank you.