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

New to roll20: Macro Question in regards to d6 System

Hello all. I am attempting to make a macro for the Star Wars d6 system that has the ability to subtract dice rolls depending on a previous roll. Ex: (1d6!)+(5d6) The first die is a wild die. In the system, if this die rolls a 1, then the highest die roll from the second group of dice would be subtracted (along with the 1 from the wild die). I have yet to come across any if-then-else statements amongst the macros and curious if I am missing some code, or if there is any means that I can achieve my desired outcome another way.
1420740303

Edited 1420740405
Pat S.
Forum Champion
Sheet Author
Hi Jeb. <a href="https://wiki.roll20.net/Dice_Reference" rel="nofollow">https://wiki.roll20.net/Dice_Reference</a> and <a href="https://wiki.roll20.net/Macros" rel="nofollow">https://wiki.roll20.net/Macros</a> contain more info if you wish to read. I think you are looking at the possiblity of needing the API which is a mentor level feature
Thank you for the reply. I have read through both of those pages and haven't found what I was looking for. If there is no means to accomplish this task without the API, do you how to do it with the API?
1420741483

Edited 1420741533
vÍnce
Pro
Sheet Author
Hi Jeb. The gm of the game needs to be a Mentor subscriber to use API scripts. You can ask about the actual API in the API forums here.
1420742741
Pat S.
Forum Champion
Sheet Author
It boils down to the fact that the dice engine does not handle if then statements. You are wanting multiple events to happen with one roll. The API is a javascripting feature that requires the GM of the campaign to be subscribe as a mentor. There are scripts already written that either do what you want or can be tweaked to do so. You can do it the old fashion way and eyeball the results if you are the GM and don't wish to subscribe. There might be others that work with macros more then I do, dropping by to offer suggestions also.
Thank you all. I appreciate all of your replies and your help.
1420757001

Edited 1420764091
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Jeb, if you're looking for a simpler solution could could just have the 1st die set apart from the others to easily distinguish and apply the results yourself. I.E /r [[1d6!!]] + ?{Dice|1}d6
1420760899
Lithl
Pro
Sheet Author
API Scripter
Steve, as I understand it, the problem isn't getting the correct number of dice rolled, but that a 1 on the wild die drops the highest die from the rest of them.
1420764051
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Brian said: Steve, as I understand it, the problem isn't getting the correct number of dice rolled, but that a 1 on the wild die drops the highest die from the rest of them. It can't be automatically handled outside of API use. That's why I put the caveat that you'll need to distinguish and apply the results yourself. Formatting the way I suggested would make it easy to eyeball the results of a 1 and what the highest d6 was to subtract that from your roll, but otherwise the roll's total would be what you'd use.
You could break it into two macros: /me adds [[ 1d6! ]] due to the force or something. If the number is highlighted in Red or Blue, you know there's a 1 in there somewhere. /me rolls [[ ?{Added from first roll?|0} + 5d6dh?{Did you Fail?(0 or 1)|0} ]] You'll be asked to enter the results of the first 1d6! roll. You would enter whatever the roll result was(-1 if you rolled a 1). That will be added to the 5d6 roll. You'll then be asked if the first roll had any failures (1s). If no, you enter 0 and it adds the regular 5d6. If you put a 1 in, it will drop the highest roll from the 5d6. Ex1: First roll gives a 4 . "Added from first roll?" : 4. "Did you Fail?(0 or 1)" : 0. I'm then given 4 + 5d6 Ex2: First roll gives a 1 . "Added from first roll?" -1. "Did you Fail?(0 or 1) ": 1. I'm then given -1 + 5d6 (dropping the highest roll) Ex3: First roll gives 8 (6,2). "Added from first roll?" : 8. " Did you Fail?(0 or 1) ": 0. I'm then given 8 + 5d6 Does that work out at all?
Mark, that's very cool. I didn't understand it at first, but it's drop highest (1) or (0), correct? Could you use this same formula making a query for the number of dice rolled in the second macro? Or is that too many queries?
1420836638
Gen Kitty
Forum Champion
Gozer the Gozerian said: Or is that too many queries? You can pretty much have as many roll-queries as you like ^_^
@ Gozer: Yes, Roll20 only has Greater-Than-Or-Equal To and Lesser-Than-Or-Equal-To. It doesn't have just Greater-Than. It combines them into the &lt; and &gt; characters. It can throw folks off a bit if they're at all familiar with conditionals. You can use as many queries as you like (within reason; I doubt having 100 queries in a single macro will play nice). You just have to remember to keep separate queries named differently. Anytime you use exactly the same query in a macro, it will only ask the user once and use their response for all queries with the same text. Sure, you can just ask the user how many dice to roll overall, but this method is a little more automated and keeps it to a simple "Did you fail?" question so the user doesn't have to remember how many dice to take out or possible typos/confusion on what to type exactly.
You guys are going much more into depth that I expected. I appreciate all of this. Hopefully soon I will be able to afford a subscription so I can code what I need. I will post it back here when that happens. Also, to help clarify any confusion about what I was mentioning earlier with the dice rolling. Say I need to roll 5d6. One of those dice will be a wild die. On a six of the wild die I reroll the wild die and add that roll, plus the previously rolled 6, and the other 4 dice (for a total of 6 die rolled now) together for my result. Now let's say that I roll a 1 on the wild die. That would would not be adding to the total and would also cause me to subtract the highest rolled die from the other 4 dice (for a total of only 3 dice rolled now). From what I have gathered, I can't have that sort of event take place with macros.
1420956095

Edited 1420956127
Pat S.
Forum Champion
Sheet Author
Jeb J. said: Say I need to roll 5d6. One of those dice will be a wild die. On a six of the wild die I reroll the wild die and add that roll, plus the previously rolled 6, and the other 4 dice (for a total of 6 die rolled now) together for my result. Yes that is how it works. That is a basic addition with no qualifiers. Everything gets added. Now let's say that I roll a 1 on the wild die. That would would not be adding to the total and would also cause me to subtract the highest rolled die from the other 4 dice (for a total of only 3 dice rolled now). From what I have gathered, I can't have that sort of event take place with macros. No you can not have that happen. That is not possible macro only. It takes the API to do that.
Jeb, I've played some D6 system, and I know the mechanism you're talking about. Mark G.'s system works - if you have it as two separate macros. Basically, the first part would be a "Wild Die" macro, works exactly as written (snipped from above): /me adds [[ 1d6! ]] due to the force or something. If the number is highlighted in Red or Blue, you know there's a 1 in there somewhere. I would tweak it to say: /me rolls the Wild Die: [[ 1d6! ]] Then your second macro would be the rest of the dice. I'm actually going to tweak Mark's a little bit. Here's his description: /me rolls [[ ?{Added from first roll?|0} + 5d6dh?{Did you Fail?(0 or 1)|0} ]] You'll be asked to enter the results of the first 1d6! roll. You would enter whatever the roll result was(-1 if you rolled a 1). That will be added to the 5d6 roll. You'll then be asked if the first roll had any failures (1s). If no, you enter 0 and it adds the regular 5d6. If you put a 1 in, it will drop the highest roll from the 5d6. I would tweak it like this: /me rolls [[ ?{Added from Wild Die?|0} + ?{Number of remaining dice?|1}d6dh?{Did you Fail?(0 or 1)|0} ]] So I would say, if you roll a 1 on the Wild Die, instead of entering a -1 for the "Added from Wild Die," it should actually just be a 0, since you just discard the Wild Die if it's a one, not subtract 1 from the remaining total. Then for the "Number of remaining dice" query, you would put the number of actual remaining dice. When it queries "Did you fail?" you put in 0 if you DIDN'T roll a 1 on the Wild Die, and 1 if you DID. (I'd like to figure out a better way of asking that, but I can't right now). The 0 means you don't drop the highest die, the 1 means you drop the highest die. The total you get from the second roll is your complete total. It would be nice if you could put those all into one macro, but the queries happen before you get to see the result of the first roll, so you have to have it as two macros. The nice thing is, that this macro could work for EVERY skill roll you would make in the D6 system, which is pretty cool. You could even tweak it further, if you didn't want to do the mental math of subtracting 1 from your total number of skill dice (since the Wild Die counts as one of your dice) in the following way: /me rolls [[ ?{Added from Wild Die?|0} + (?{Total number of skill dice?|1}-1)d6dh?{Did you Fail?(0 or 1)|0} ]] Have fun! EDIT: I just realized that sometimes in the D6 System you don't have full dice in a skill, but a certain number of added pips. For example: Pistol - 3d6+2 You can also accommodate this in the Skill roll macro by simply adding a query for extra pips: /me rolls [[ ?{Added from first roll?|0} + (?{Total number of Skill Dice?|1}-1)d6dh?{Did you Fail?(0 or 1)|0} + ?{Extra pips?|0}]] Now you're making me want to run a D6 System game.... :)