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

Help to create a macro

I'd be grateful if anyone could help me out. Is it possible to create a macro that will automatically roll on a table if you roll doube 1 on 2d6? Basically, it's like a critical fail and the roll on table then tells you have the crit fail is. Thanks.
1707074707
Gauss
Forum Champion
Hi Graham,  More information is needed, namely, the entire process of rolling 2d6.  Example:  I roll 2d6+5.  If the roll is a 13 I succeed, if it is a 2 I critical fail.  (Note: I don't know your game system or mechanics, this is just an example.)
Hi Gauss, This is just for a homebrew game I'm working on. There are no modifiers to this roll of 2d6. What I'm looking for from the macro is for a roll of double 1 to automatically trigger a roll on a rollable table I've created. Is there any other information you need to know? Thanks for any help you can provide. Cheers, Graham
1707082035

Edited 1707082133
Gauss
Forum Champion
Yes, do you need the 2d6 results for any other purpose?  Put another way, what happens on rolls of 3 through 12?
The main purpose of the 2d6 roll is to help provide a score for something I've called "movement points" in the game which is the average of 2d6 rounded down. The macro I have so far is just this: [[floor(2d6/2)]] But a roll of double 1 triggers a random event in the game so I was hoping to have the macro also roll on the event table when this happens.
1707082784

Edited 1707083633
Gauss
Forum Champion
Please detail everything you need the roll for.  Macros are not simply "I need it to do X". The moment you add that you also need it to do Y or Z it changes the macro and whether it is possible or not.  Put another way: Yes, a macro that checks for a 2 in a 2d6 roll is possible. But it may preclude whatever other uses you want to use the 2d6 for, so you need to elaborate on that.  Another question, why dividing 2d6 by 2? 
1707091694

Edited 1707101168
GiGs
Pro
Sheet Author
API Scripter
Graham T. said: Is it possible to create a macro that will automatically roll on a table if you roll doube 1 on 2d6? This is not possible without a Pro subscriber perk. (see below) You can have a button output with the roll, that players can manually see they rolled double 1, then click the button to roll on a table. All table rolls in Roll20 cannot use modifiers though - the table roll would need to be either unmodified, or have the exact same modifier on every roll.
1707092790

Edited 1707095492
Gauss
Forum Champion
GiGs,  Without using the API I am able to create a macro that automatically rolls on a table if you roll a double 1 on a 2d6. That is relatively straightforward actually.  The problem is the floor(2d6/2) which is why I am trying to acquire more information as to what they are using that for. Perhaps there is a workaround.  Edit:  Here is an example of a macro that does what the OP initially asked for. But it doesn't divide by 2.  &{template:default} {{name=test}} {{Table roll=[[1t[[[{[[2d6]],0}=2]]YesNo]]]}}  {{Roll=$[[0]]}} It rolls 2d6, on a 2 it outputs the result from a failure table, on a non-2 it outputs the "other table".  It also displays the result of the 2d6 roll.  However, due to reusing rolls I cannot then have it divided by 2. Perhaps a Rainbow will come along to point out a way.  I currently have the tables named as:  1YesNo 0YesNo The names can be anything, and the output of those tables can be anything (within the limits of tables). 
1707101107
GiGs
Pro
Sheet Author
API Scripter
I'd completely forgotten you could construct table names that way. Thanks for the correction.
The fact that the double 1 roll shares a final outcome with other roll results means trying to use floor(2d6/2) is a non-starter. Roll duplication of the 2d6 seems rather heavy-handed for this so I'd say a variation of skill check with text result works best. &{template:default} {{[0](" hidden)}} {{[1](" hidden)=[[1d1cs0]] Crit Fail [[ 1t[tablename] ]] }} {{[[[{2d6,0d0}>3]]](" hidden)=[[ {1,3,10,21,30,35}<[[1d35]] ]]}} {{[0](" hidden)=Movement Points}} This uses different outputs for double 1 and not double 1. As for the rather strange roll, that is simulating the remaining 35 iterations of floor(2d6/2). Since that shows when you don't roll a double 1 you cannot use a 2d6 roll as that still includes the possibility of a double 1.
1707106673

Edited 1707106706
Gauss
Forum Champion
Yup, knew Rainbow would save the day! Of course, I have no clue how it works. :)
Thanks for everyone's messages. It sounds like what I'm trying to do isn't possible then...  To answer the question, why divide the 2d6 by 2, I wanted a normal distribution for the range 1 to 6 rather than 2 to 12. So, rather than automatically rolling on the rollable event table I've created when rolling doube 1, is it possible to have a button output on that roll that the players can click on to roll on the table, or is that not possible as well?
1707124361

Edited 1707124949
Gauss
Forum Champion
Graham T.  said: It sounds like what I'm trying to do isn't possible then...  Is there something about RainbowEncoder's solution that doesn't work for you? It does what you wanted it to do (even if I don't understand how it does it, I tested it and it works). Note: RainbowEncoder is basically the top level of macro writing here. If a macro needs some arcane solution without using a Mod (API Script), RainbowEncoder is the most likely person to be able to create that.  Graham T.  said: So, rather than automatically rolling on the rollable event table I've created when rolling doube 1, is it possible to have a button output on that roll that the players can click on to roll on the table, or is that not possible as well? Regarding a button output, sure that is possible. You can make a macro then call that macro with a button. It is called a Chat Menu . If you need help setting that up I can help you with that. 
Oops, sorry. I misunderstood that message.  That macro RainbowEncoder details looks mighty impressive! Many rthanks.
Sorry about this but I now need to change the macro so that it triggers the random event on a roll 3 or less on 2d6 instead of just on a double 1. Here's the  macro posted earlier by RainbowEncoder: &{template:default} {{[0](" hidden)}} {{[1](" hidden)=[[1d1cs0]] Crit Fail [[ 1t[tablename] ]] }} {{[[[{2d6,0d0}>3]]](" hidden)=[[ {1,3,10,21,30,35}<[[1d35]] ]]}} {{[0](" hidden)=Movement Points}} In order to get the Crit Fail to occur on a roll of 3 or less, I thought all I had to do was to amend it to this: &{template:default} {{[0](" hidden)}} {{[1](" hidden)=[[1d1cs0]] Crit Fail [[ 1t[tablename] ]] }} {{[[[{2d6,0d 0}>4] ]](" hidden)=[[ {1,3,10,21,30,35}<[[1d35]] ]]}} {{[0](" hidden)=Movement Points}} But this doesn't seem to work, so I assume I need to amend the macro even more to get what I want...? I'd be very grateful if anyone could tell me how to do this. Cheers!
What you did made the crit fail roll appear more frequently as desired but you hadn't changed the awkward non-fail roll. However since you're now using a value that isn't shared between fail and success the macro can be simplified as &{template:default} {{[0](" hidden)}} {{[1](" hidden)=$[[1.computed]] Crit Fail [[ 1t[tablename] ]] }} {{[[[{[[floor(2d6/2)]],0}>2]]](" hidden)=$[[1]]}} {{[0](" hidden)=Movement Points}} This has the advantage that you can now see the actual roll.
Great, thank you so much!