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

Idiot needs simple Macro help - 5E

Hello, I'm getting on Roll20 due to the pandemic and I'm trying to figure out all the tips and tricks.   The latest has been macros.  I have seen videos that show all these neat things you can do with macros and they talk around macros, but they don't seem to show me how to make the stupid macro.   Probably I'm an idiot and just not seeing it.  I have also looked at website tutorials, but I don't think they account for my level of stupidity.   Example:   I want to make a macro for an attack roll.  I want it to roll the to hit and then damage.  I found this macro to use in a tutorial: %{selected|repeating_npcaction_$0_npc_action} I have taken exactly that and put it on the macro sheet: I save and click, but get this error: You attempted to use a roll command looking for a selected token ability, but the selected token does not represent a Character, and therefore has no abilities. I am sure it is something moronically simple that I am missing.   I believe that somehow the macro is not associating with something.  I do not understand. Side question: I prefer to do damage as the average damage for each it as I've killed too many characters with random rolls.   If I wanted to have it show damage in the die result, can it do that if it isn't really random?   
1585160136
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That code reads its values from an NPC as defined by a "selected" token. To use it, select a token that represents (is linked to) an NPC. Specifically, that code is built for the D&D 5th Edition by Roll20 sheet, so it must be an npc created in a game that uses that sheet. Side Answer: I don't think that is an option as the sheets are built. You would likely have to build the macro from scratch.
1585160259
The Aaron
Roll20 Production Team
API Scripter
There are two things going on here.  It's a confusing part of the system because people use the terms "Macro" and "Ability" interchangeably, but they are two different things with similar functionality.  What you have pictured above is an Ability.  Abilities are attached to Characters.  They are in the context of that character.   Macros are in the Collections tab on the right top.  They are in the context of the game.  In an ability, you can reference that character's things directly @{name} @{character_id}, %{action}, etc.  In a Macro, you must have a selector of some type: @{selected|character_id} @{target|which token|token_id} %{character_name|action}, etc. For the above, if you remove "selected|", it should call the action in question.  You could also select a token on the tabletop and it would call the action for that token's character (which might be different from the character with the ability you just added).
First off, thank you very much for your help. Second, Ugghhhh...programming.   OK.....so...if I wanted to make something happen that had a little bar show up when I click on a token that allows me to make the attack roll.....how do I do that?   Do I use the code listed there, but modified somehow?     For example, I just made up a "goblin" character and assigned it a "goblin" token.  I  drag the character onto the map and a goblin token shows up.   What do I need to do to have a button that I click and it rolls the attack for me?   Or perhaps roll initiative?
1585161217
The Aaron
Roll20 Production Team
API Scripter
You can do that with either a Macro or an Ability.  What you're looking for is the Token Action checkbox.  Token Actions show up in a button bar across the top when you select a token. Ability Token Actions only show up if the token represents the character with that ability. (breath fire makes no sense for a kobold) Macro Token Actions show up for any token that you select.  These are good for general purpose things like Initiative.
Yes!  I want to make it something on the Token Action Bar.   How the heck do I make an attack show up on that?
1585162689
Kraynic
Pro
Sheet Author
The Aaron answered that too, though you might not have known what he meant.  Whether it is a macro in your macro collection or an ability macro on a character sheet, there is a checkbox for "show as token action" (or something similar).  That makes it visible when an associated token is selected.
1585162820
The Aaron
Roll20 Production Team
API Scripter
Probably you'll want to add an Ability to the Character with the Attack, the put in it something like: %{attack-name} and select the Token Action check box. You can get the stuff to put in it pretty easily by hitting the attack, then pushing up in the chat box to see what was sent.  If that doesn't look like %{ something }, but is instead a bunch of {template:blah}{{key:value}} stuff, there's another way to find it...
1585170981
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The following Macro (not an ability) can be saved into the Collections tab. Save it under the name "Actions". Check the "Show as Token Action?" box. This will make it a universal token action for all GM-controlled characters. Any token you select will be able to use it. It creates what is known as a  Chat Menu . When you click it, you will get a chat button for the first four actions on the character sheet of the token you have selected. If you character has more than four actions, they won't show. If it has less than four, just ignore the gibberish buttons. /w gm &{template:npcaction} {{rname=Actions for @{selected|character_name}}} {{description=[@{selected|repeating_npcaction_$0_name}](~selected|repeating_npcaction_$0_npc_action) [@{selected|repeating_npcaction_$1_name}](~selected|repeating_npcaction_$1_npc_action) [@{selected|repeating_npcaction_$2_name}](~selected|repeating_npcaction_$2_npc_action) [@{selected|repeating_npcaction_$3_name}](~selected|repeating_npcaction_$3_npc_action)}} &{noerror} Here is an example with a goblin:
1585173616

Edited 1585173731
OK....I'm dense, but maybe I am trying to do Macros in the Abilities section (and I understand what that means).   So, I took what @keithcurtis put in there and I made a Macro with exactly that.  I did check the "in bar" check.   I see something in the Macro Bar at the bottom (any way to get it in the Token Bar?).  I click it and get: argh, can't paste the image.    selectedrepeating_npcaction_$0...... All in red.
1585173947
The Aaron
Roll20 Production Team
API Scripter
You need to have a token selected.  When you have a token selected, if you enabled Token Action for that macro, you'll see it at the top of the screen.
1585177004
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Make sure you click that "Show as Token Action?" button while editing the macro. That will put it up in the Token Action bar. You probably don't want it down in your regular bar (so you can unclick "in Bar" in the compendium tab), since it only has value while you have a token selected.
1585248570

Edited 1585254224
OK!!!!!    I found an old thread that talks about it, but I still don't quite get it.    Here is what I got: You didn't set that token as the default token for the character sheet or you didn't actually link it back to the sheet (or both).  Setting the selected token as the default is not enough.  You have to link it to the sheet and also set it as the default token (in that order too!). It's exactly the same thing that is happening to me.   I just don't know how to fix it.  I have to "link it (the token) to the sheet and also set it as the default token".    I have opened the character and added the token to the character.  I don't know what else to do or what order to do it in.
I FIGURED IT OUT!!!!!!     I just opened the token and used the pull down menu to associate it with the character sheet!   Dang, that took me a week.  I was getting pretty bent about it on my end here.     Once I got that figured out, everything has worked!   All the "macros" that are really Abilities now work! Thanks for the help.
1585253792
The Aaron
Roll20 Production Team
API Scripter
Great!!!
1585255368
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Here is the wiki article on Linking Tokens to Journals Here is a video which demoes the procedure. Basically, it's like a word processing document. After you have made changes, you have to save your work so that it will still be there when you open it next time. If you make a change after you save and close without saving, those changes are lost. Setting the Default token is like saving your work. It's the last step.
I hope my errors will help someone else on these forums.
1585275693
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I know mine did. Thanks for reporting back, it helps other people to see when users successfully solve a problem.
Jim C. said: I FIGURED IT OUT!!!!!!     I just opened the token and used the pull down menu to associate it with the character sheet!   Dang, that took me a week.  I was getting pretty bent about it on my end here.     Once I got that figured out, everything has worked!   All the "macros" that are really Abilities now work! Thanks for the help. OMG! Thank you so much!!!! Thank you for posting the solution and not just saying "I figured it out" and never saying what the solution is which people often do. Trying to solve this problem when you have barely any idea what you are doing is so painful and confusing and overwhelming. I just want to help further clarify for other people who get stuck on this. Steps to connect a token to a character sheet: click on the token click the settings cog button to the bottom left of the Token Under the "Basic" tab, click the "Represents Character" select box Select the character that you want the token to represent Click "Save Changes" You have now connected the token to the character sheet but you probably still need to fix the default token in the character sheet Select the token that you just connected to the character sheet using the previous steps Go to the Journal tab Click the character you want to update Click "Edit" Hover over the "Default Token (optional)" box Click "Remove" Click "Yes, Delete" Click "Use Selected Token" Click "Save Changes" Now when you drag the tokens out, they will already be connected to their character sheet :)
Dan said: Jim C. said: I FIGURED IT OUT!!!!!!     I just opened the token and used the pull down menu to associate it with the character sheet!   Dang, that took me a week.  I was getting pretty bent about it on my end here.     Once I got that figured out, everything has worked!   All the "macros" that are really Abilities now work! Thanks for the help. OMG! Thank you so much!!!! Thank you for posting the solution and not just saying "I figured it out" and never saying what the solution is which people often do. Trying to solve this problem when you have barely any idea what you are doing is so painful and confusing and overwhelming. Maddening, isn't it?   I spent a week, myself, trying to figure it out.   I was really bent out of shape!   All the tutorials were just shooting past things, but the most basic things weren't covered well enough.    So glad my stupidity can help you!