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

Macro - Initiative and Unique Roll in a Template

1693667755

Edited 1693672252
Zaron
Plus
Hello, I am using the following macro for initiative: %{selected|INITIATIVE} The game is very combat-heavy, and with multiple creatures on each side, I created this as a token action to make it easier for players and myself (DM) to quickly roll initiative.  It already works great.  However, in the near future, there is an entire dungeon where the PCs will have to roll initiative, and THEN roll a 1d4 for an extra result that happens.  In order to not take up time with the rolling, my thought was to move the macro into a Template form, i.e. one row will be the Initiative roll, the second row will be the 1d4 rolled separately.  I tried to do the following: &{template:default} {{name=Initiative}} {{Initiative Roll=%{selected|INITIATIVE}}} {{Unique Roll=[[1d4]]}} However, it won't work because it only shows like this: Please note, when the macro is used, the character's initiative DOES roll and adds to the turn order, but neither the Initiative Roll nor the Unique roll are shown.  I spent ~45 minutes looking through other forum posts and tried other methods instead, but those got even less far.  I am hoping someone can help me identify what is wrong with the template format. (Depending on how easy this proves to be, I will also eventually explore adding another row that evaluates the roll of the 1d4 and mentions something happens.) Thank you!
1693668081

Edited 1693668250
Gauss
Forum Champion
Hi Zaron, Your image did not post. My guess is you tried to copy/paste it. Please save the image to your computer then upload it to post it.  With that said, my guess is that you cannot put the %{selected|INITIATIVE} command into a template because that is effectively putting a template into a template. Instead you will have to put the roll syntax in there.  Click %{selected|INITIATIVE}, then go to your Chat Tab. Click the chat window (where you type) then hit the up arrow on your keyboard.  Copy the code in the chat window, then pull out the section that is the roll you need.  Example:  @{Testing|wtype}&{template:simple} {{rname=^{init-u}}} {{mod=@{Testing|initiative_bonus}}} {{r1= [[@{Testing|initiative_style}+@{Testing|initiative_bonus}@{Testing|pbd_safe}[INIT] &{tracker}]] }} {{normal=1}} @{Testing|charname_output} I bolded the relevant section in my example. Yours may look different. 
Hi Gauss, Thank you for the note on the image.  I've edited the original post. After I use the regular " %{selected|INITIATIVE} " macro, when I hit the Up Arrow on the keyboard, it just returns the name of the macro (i.e. "#Roll-Initiative").  I do not get a code.  Any advice?
1693673588

Edited 1693673617
Gauss
Forum Champion
I apologize for not being more clear. Hit the button on the sheet itself. If you are using the command it just wants to repeat the command (it can be frustrating, but there are reasons for this). 
1693674343
GiGs
Pro
Sheet Author
API Scripter
When you make a roll, like this &{template:default} {{name=Initiative}} {{Initiative Roll=%{selected|INITIATIVE}}} {{Unique Roll=[[1d4]]}} roll20 does not immediately perform the roll. The first thing that happens is that this %{selected|INITIATIVE} is treplaced by its contents, so you end up with &{template:default} {{name=Initiative}} {{Initiative Roll=WHATEVER THE ABILITY CONTAINS}} {{Unique Roll=[[1d4]]}} And then the macro is run. I'd suggest you need to look at that ability and see that it works in a rolltemplate. The rolltemplate is breaking at that point, so it's likely something isn't right there.
Hi all, Using Gauss's suggestion, I've included the code part I would need.  Now it looks like this: &{template:default} {{name=Initiative}} {{Initiative Roll=[[@{selected|initiative_style}+@{selected|initiative_bonus}@{selected|pbd_safe}[INIT] &{tracker}]]}} {{Unique Roll=[[1d4]]}} It's working, thank you!  The only thing I wish it would do is factor in advantage/disadvantage, whether that be query, toggle, or always (D&D 5e sheets), but I'm happy this far is working :) I'll also start looking up how to add text underneath if a certain outcome is rolled on the Unique Roll, but any suggestions are appreciated. Thanks again!
If you explain the mechanics  of what you are trying to accomplish, then someone might be able to help you out. Explain what you are looking for as though you’re not playing on Roll20 and not using macros and just using physical dice in person. 
Sorry if I was unclear - my original question was answered, and I was just going to do research on some other things.  (Using i f/else statement on rolls to have outcomes is only available in Pro / API, and  getting advantage/disadvantage to work in the macro works when you update the Initiative style to normal/adv/disadv.) No further questions.   Thank you!
Zaron said: Hi all, Using Gauss's suggestion, I've included the code part I would need.  Now it looks like this: &{template:default} {{name=Initiative}} {{Initiative Roll=[[@{selected|initiative_style}+@{selected|initiative_bonus}@{selected|pbd_safe}[INIT] &{tracker}]]}} {{Unique Roll=[[1d4]]}} It's working, thank you!  The only thing I wish it would do is factor in advantage/disadvantage, whether that be query, toggle, or always (D&D 5e sheets), but I'm happy this far is working :) I'll also start looking up how to add text underneath if a certain outcome is rolled on the Unique Roll, but any suggestions are appreciated. Thanks again! You can get the roll to query you for advantage by adding this bolded part: &{template:default} {{name=Initiative}} {{Initiative Roll={{r1=[[?{Roll Initiative with advantage?|Normal Roll,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1}+@{selected|initiative_bonus} [[@{selected|initiative_style}+@{selected|initiative_bonus}@{selected|pbd_safe}[INIT] &{tracker}]]}} {{Unique Roll=[[1d4]]}} I'm not sure how to get it to recognize the sheet settings for advantage toggle or query, though.