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

Requesting a Dice Macro

1432835082
B Simon Smith
Marketplace Creator
So, sorry to make the request, but it takes me a considerable amount of time to reverse engineer coding (I'm more of an artist type), and I have a weekly game that I play in (and I don't believe anyone else knows how to write code in the game either). It took me several weeks to figure out how to make a similar macro work in Maptool, but I've since "upgraded" to Roll20. The Macro needs to allow a selection of multiple dice of different sizes, roll them all simultaneously, adjust for Explosive dice, and spit out the rolls of each die along with the final sum. Doing it the hard way of rolling each die separately is sure to be time-consuming and problematic. For Example: Player A starts the macro by selecting 2d10 and 1d6. The macro runs, and the die results are 8, 5, and 6. The 6 was on the d6, so it rolls again and the result is a 3. The macro adds all the results together and shows "(8+5+6+3)=22" or similar. If possible, could the macro also be set to multiply the final result? For example if the above was selected with a "x3" multiplier then the final result would be 66. Thanks to anyone that can understand what I just said and to anyone that is capable of providing such coded goodness.
1432836276
The Aaron
Roll20 Production Team
API Scripter
(moving to Specific Use Questions, API is for the Javascript API) Does this fit your needs? /r (2d10+1d6!) * ?{Multiple|1}
1432837758
Diana P
Pro
Sheet Author
How about /r (?{d12s?|0}d12! +?{d10s?|0}d10! +?{d8s?|0}d8! +?{d6s?|0}d6! +?{d4s?|0}d4!) * ?{Multiplier|1} that assumes they all can explode and asks how many of each die you want. You can remove a +?{d#s?|0}d#! to remove a query for a die size, remove the '!' if that die size does not explode, or add another +?{d#s?|0}d#! if you need another die size.
1432842833
B Simon Smith
Marketplace Creator
Thanks, "The Aaron", you always rock. I'll try out both permutations tonight and see if they work.
Diana, with your macro, can it be set up so that a set equation can be attached to a token and when press the "?" brings up a space for you to input a number, then make the roll? What I would like to do is set a button maro that rolls a d20 + (4 or 8) + a variable chosen at the time of rolling.
1433004223

Edited 1433004329
Diana P
Pro
Sheet Author
Any macro can be added to a character sheet if one is attached to your token; it goes as an 'Ability' on the 'Attributes and Abilities' tab and you can set it to 'Show as Token Action' to have it show up on the token. You can also set macros up on your 'My Settings' tab (in the chat pane area) and those can be set to show as Token Actions as well. You can add any queries you want ?{some question} is a basic query. ?{some question|default answer} is the form I normally use because I prefer to have a default answer in there so I can just hit return if I don't need to change it. :) so... /r 1d20 + ?{4 or 8?|4} +?{Other value?|0} works. It could also be run inline: [[1d20 + ?{4 or 8?|4} +?{Other value?|0}]] however, you cannot choose a sheet variable using a query. @{[[?{agi or str|agi}]] } does not work because the @{} substitution happens first. If you want to reuse the query later in the same macro, you can: [[d20+?{weapon bonus|0}]] to hit ; [[d8+?{weapon bonus}]] damage will only ask for the weapon bonus once. If the macro is going to be used on tokens which have character sheets, you can query the character sheet for a value: [[d20 + @{selected|initiative}]] but it will error if the token does not have an 'initiative' value set in an associated character sheet. Hope that helps.
1433017662
Gen Kitty
Forum Champion
Just a sidenote: You can do [[d20+?{weapon bonus|0}]] to hit ; [[d8+?{weapon bonus|0}]] damage and it will still only ask for the weapon bonus once. This is very useful when crafting macros because you don't have to remember to edit the query when copy-pasting it around! :>
Thanks Diana, that macro worked :-) Using the "Laying Waste Crit Alternative" in my pathfinder game and the macro will make it easier to click button and select the random values needed to get a final output.
1433044009
Diana P
Pro
Sheet Author
Excellent. Happy Gaming!
1433068391
B Simon Smith
Marketplace Creator
I have to say thanks to The Aaron, Diana P, and GenKitty. The macros worked very well and after looking at them for awhile I was able to reverse engineer them for even more functionality in the campaign.
1433084918
Diana P
Pro
Sheet Author
Very good. :) Happy Gaming!