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

Rolling 2 Macro's and adding the sum up.

Is there a way to Roll two macro's and add them together automatically? I.e. I want my player to be able to do something cool and give a bonus die.. Let's say they usually roll 2d12!  and I want to give them an additional 1d6! Is there a way to create a macro that is like /roll macro XYZ +Macro PDF = Sum?
1560388307
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
It pretty much has to be one continuous macro. They don't have memory or decision logic. Macros are basically a calculated statement that gets sent to the chat and is immediately forgotten. You could do it with the API however. A dedicated script would probably be best, but you might be able to write a value to an attribute with ChatSetAttr, and then later reference that attribute with another macro. I haven't really run any tests on it, so I don't know if there might be a timing issue.
1560391619

Edited 1560391636
GiGs
Pro
Sheet Author
API Scripter
If your macros just contain the dice rolls, you can do that. If macro1 contains just the text 2d12! and macro2 just contains 1d6! then /roll #macro1 + #macro2 will roll 2d12! + 1d6! The main reason for doing it that way would be if you regularly change macro2's contains to handle varying modifiers.  If your players macros end in a + you dont need two macros. Say the player has a macro called myAttack which contains the text /roll 2d12!+ You could then add a macro called #bonus with 1d6! like so #myAttack #bonus. Probably the best way for something like this though would be to have a bonus macro permantly included in the attack, and just change its value on the fly, like player's macro text: /roll 2d12! + #bonus then you could change bonus to 0, to 1d6! or whatever you wanted and it would be included automatically. And even better would be to create a character, called it GM. When setting up the character, set it as Controlled by All Players but leave Visibility empty. Give that character an attribute named Bonus, then the macro text above would look like this players macro text: /roll 2d12! + @{GM|bonus} What makes this the best approach is you can create a token linked to this character, and link one of its token bars to the bonus attribute. Then in play you can change the bonus on the fly just by editing that token bar. It's fast!
1560395782
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That might be Stupid Trick worthy, since it's not really a documented procedure. Nice!
1560396178
GiGs
Pro
Sheet Author
API Scripter
Good idea, I'll write it up tomorrow. 
Thank you I think this will help immensely! 
Ok that works Brilliantly Now to ask a further question which may not work...  I see and can get how to get a input in there, is there a way to create a macro that does the following..  /roll (user input another macro) +1d6!   What I'm working with is a game like earthdawn that has the step system so each step has a die code.. like 4 is a d6, 5 a d8, 14 2d12 etc.  I've created macro's just to roll those. What I want to do is basically nest the input of another macro into a macro.  Click it, I get a pop up, enter Macro number #4, it rolls that macro. Is this asking too much of the macros? 
1560449059

Edited 1560450208
GiGs
Pro
Sheet Author
API Scripter
You could do that, but if you are just having 1d4, 1d6, etc as choices, you could include them in the macro itself like so: /roll ?{choose Die|d4|d6|d8|d10|d12} + 1d6! or if they are exploding dice /roll ?{choose Die|d4|d6|d8|d10|d12}! + 1d6! These will give the player a dropdown menu to choose the die type. The first bit "choose die" is the prompt the players see, and then you create a list of options players can select, separating them with |. If you want to have a visible number 4, linked with a d6, you can do it like this /roll ?{choose Die|3,d4|4,d6|5,d8|6,d10|7,d12}! + 1d6! (I'm guessing what the numbers should be) Each | represents a separate row in the dropdown box. The value before the comma is what the players see, the value after the comma is what gets rolled. If you want players to type a macro name in manually, you can use something like /roll #?{Enter MacroName|here} + 1d6! Here the players are given a box to enter text. Note the # at the start for the macro, then the query syntax:  ?{Enter MacroName|here} . Whatever the players enter here will be replaced in the roll. So if they entered 4, roll20 would see that as /roll #4 + 1d6! And then would replace the #4 with your macro named 4, so roll20 would actually roll /roll 1d6! + 1d6! (assuming the #4 macro contains the text 1d6! Allowing players manual text entry means they will sometimes make typos. It's unavoidable, so I prefer using the dropdown approach. But if all your macros are simply named 4, 5, etc, it might be quicker than the dropdown though.
Could this be done   /roll ?{choose Die|d4|d6|d8|d10|d12}! + 1d6!    and instead of die type choose another Macro? 
1560450542
GiGs
Pro
Sheet Author
API Scripter
Yes, what are your macros named? Just put the macro calls in place of the d4, d6, etc.
So  /roll ?{choose Macro|#Step-4| #Step-5 | #Step-6 | #Step-7 | #Step-8 }! + 1d6!   etc? Is there a limit on # of variables?  BTW thank you so much this has been super helpful.
Here is what I'm trying but I'm getting an error       /roll ?{Step |#Step4|#Step5|#Step6|#Step7|#Step8} +1d6! ideally if this works is I'd like to set it up to go from step 4-25
1560455797

Edited 1560455844
GiGs
Pro
Sheet Author
API Scripter
Try putting the # before the query like I did in an example above. /roll #?{Step|Step4|Step5|Step6|Step7|Step8} +1d6!  However this wont work well if your macros themselves include anything with complex formatting. What do those macros contain? Also what are the names of the macros?
1560456263

Edited 1560456542
2d6!, just dice codes like d8!+d6! etc. or 2d8!+d6!  names are Step4 - 25, e Step4 , Step5, etc.
1560457907
GiGs
Pro
Sheet Author
API Scripter
It looks like you need to include the # inside the query, and include a space before the | . Like this /roll ?{Step|#Step1 |#Step2 |#Step3 |#Step4 } +1d6!  or this /roll ?{Step|Step 1,#Step1 |Step 2,#Step2 |Step 3,#Step3 |Step 4,#Step4 } +1d6!  The first version above will show the roll in the macro, not the words #step1 in the dropdown. The second version: you can use any text before each comma, but the bit after the comma must be the macro call, with the # and a space after it.
That worked perfectly! 
Thank you so much! 
1560462597
GiGs
Pro
Sheet Author
API Scripter
Happy to help :)