Macro Buttons Problem!

I want to make macro buttons for my pc's I know how to make the buttons but how do i get the code to use the weapon macros on their character sheets? I am no programmer so examples would be great!
Sheet Author
on the character sheet, click the button to do the attack. Then click your mouse cursor into the chat area on the bottom right of the screen, and press the UP arrow on yoru keyboard. This will show you the last action typed into chat, which was the attack you just made. You can copy that.
Thanks G G! I figured out what was going on. Apparently the macro button doesn't use the weapon script that is assigned to the character page. It works as it should i just have some custom stuff added that i can't live without in the code. Maybe a drop down menu would be better. I need to look into that.
Ok i went to a drop down menu instead still having the same problem. Here is my code for the weapon drop downs which works ok. [Image](}} @{Alwyn Taleraed |wtype}&{template:npcaction} {{rname=Melee Weapons}} {{name=Alwyn Taleraed}} {{description=Select your Weapon: ?{Weapons|Longsword|Longsword(TwoHanded)|HM Longsword|Longsword Colossus} When i select the first one longsword i want this code to fire when it is selected: [Image](}} @{Alwyn Taleraed |wtype}&{template:atkdmg} {{mod=+5}} {{rname=Longsword}} {{r1=[[@{Alwyn Taleraed |d20}cs>20 + 3[STR] + 3[PROF]]]}} @{Alwyn Taleraed |rtype}cs>20 + 3[STR] + 3[PROF]]]}} {{attack=1}} {{range=}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[1d8 + 3[STR]]]}} {{dmg1type=Slashing }} 0 {{dmg2=[[0]]}} {{dmg2type=Slashing }} {{crit1=[[2d8[CRIT]]]}} {{crit2=[[2d10[CRIT]]]}} 0 {{desc=}}   {{spelllevel=}} {{innate=}} {{globalattack=@{Alwyn Taleraed |global_attack_mod}}} {{globaldamage=[[0]]}} {{globaldamagecrit=[[0]]}} {{globaldamagetype=@{Alwyn Taleraed |global_damage_mod_type}}} ammo= @{Alwyn Taleraed |charname_output} ***Alwyn slashes with his longsword!*** I have specific code just like this with images for all weapons. How do i link them together with the drop down names?
Andreas J.
Sheet Author
[Image](} } Don't know where you figured that markdown-like image linking would work, never heard/seen this at least. I think you are assuming too much of ability command buttons . I'd recommend you to re-read to wiki page and seen what structures work.  &{template:atkdmg} Here you are attempting to use some specific roll template, and they are sheet-specific ,  meaning D&D5E OGL roll templates doesn't work in a game which have selected another sheet(e.g. D&D 4E). Only the default template can be universally used. Each roll template also have their own options for things that can or cannot be expressed. But can't know if it's one of your problems or not. You have to tell us what sheet your game uses so we can determine if it's one of the problems. We can take a look at the rest of the macro after you check the two above issues.  Sidenote, when you copypaste code here in the forums, it's recommended to use the code or quotes -style so we have easier time reading what's part of your macro/code.(styles can be changes from the "magic wand" icon in the forum text editor's left corner)
Sheet Author
Andreas J. said: [Image](} } Don't know where you figured that markdown-like image linking would work, never heard/seen this at least. I think you are assuming too much of ability command buttons .  You can do this. See the Stupid Tricks thread here  for a more complex example. That said, the above code has a couple of extra curly brackets on the right side that shouldn't be there. Just using the line below will put the image in chat. [Image](
Andreas J.
Sheet Author
I stand corrected, it's even mentioned on the text chat wiki page.
Just a note, with some macro and template structures you may run into problems with html replacements. I admit that I usually beat my head against these until someone really savvy comes along and gives me a hand, such as Scott C, or Silvyre. 
Andreas J There is nothing wrong with my images in this script i run my whole game with images and i even have some buttons and drop downs working in game. I am using the 5e OGL sheet. It may be keithcurtis that i may need to use html replacements but that is beyond my ability. All the code posted above except for the drop down code was made using the up arrow in the chat pane from the character sheet. I just copied and pasted it here for reference.

Edited 1537046710
Hm. You've exceeded my meager coding, and the main reason I never use drop downs. If I could make a suggestion? Put the code you want to fire into character abilities on the sheet, one ability for each attack: abilityone, abilitytwo, etc. Then create a chat menu that simple has [Attack one](~abilityone) for each attack. You can put this into a roll template to pretty it up and throw in a /w gm or /w character name at the beginning to cut down on chat pollution. The whole thing becomes very straightforward, and you never have to deal with html replacements. What you are doing can be done, it's just a headache for neophyte coders (in which category firmly I place myself)
Where is the Aaron when you need him?
The Aaron is on vacation and I will not cast the summoning circle for him ;)
Scott C. and Silvyre helped me when I was faced with a similar problem. You could try appealing to them.
All of you guys have been very helpful to me in the past i can't thank you enough. Maybe they will come to my aid?
So i will make a plea to Silvyre, Scott C. and The Aaron or any other scripting guru to look into this for me. It is probably something simple that i am missing to make this work.
Sheet Author
It's not clear to me what the problem is or what you actually need help with. can you explain in more detail?

Edited 1537161037
I am trying to make one drop down menu for my characters weapons on their sheets to eliminate all those token action buttons at the top of the screen when they select their token. I have this code for the token buttons [Image](} } @{Alwyn Taleraed |wtype}&{template:npcaction} {{rname=Melee Weapons}} {{name=Alwyn Taleraed}} {{description=Select your Weapon: ?{Weapons|Longsword|Longsword(TwoHanded)|HM Longsword|Longsword Colossus} I have this code for one of the weapons on the character sheet for a Longsword which i want to have this code below when selected from the drop down menu  [Image](} } @{Alwyn Taleraed |wtype}&{template:atkdmg} {{mod=+5}} {{rname=Longsword}} {{r1=[[@{Alwyn Taleraed |d20}cs>20 + 3[STR] + 3[PROF]]]}} @{Alwyn Taleraed |rtype}cs>20 + 3[STR] + 3[PROF]]]}} {{attack=1}} {{range=}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[1d8 + 3[STR]]]}} {{dmg1type=Slashing }} 0 {{dmg2=[[0]]}} {{dmg2type=Slashing }} {{crit1=[[2d8[CRIT]]]}} {{crit2=[[2d10[CRIT]]]}} 0 {{desc=}}   {{spelllevel=}} {{innate=}} {{globalattack=@{Alwyn Taleraed |global_attack_mod}}} {{globaldamage=[[0]]}} {{globaldamagecrit=[[0]]}} {{globaldamagetype=@{Alwyn Taleraed |global_damage_mod_type}}} ammo= @{Alwyn Taleraed |charname_output} ***Alwyn slashes with his longsword!*** I want to use this code and not a generic code because i use images in my game and i have also modified the crit damage field to reflect the proper crit damage per the players handbook. We are playing 5E Dungeons and Dragons and are using the 5e OGL sheets.
Brian, feel free to correct me if I am wrong, but I think it boils down to wanting to choose an ability to run from a list of abilities via a drop down menu. And each ability is a multi line series of chat messages including at least one roll template? So ?{pick an action|Action1| Codephrase1 ,Action2| Codephrase2 ,Action3| Codephrase3 } and Codephrase1 would be some macro language command that would call Ability1 ? and lastly Codephrase# is the part of the macro you are having trouble parsing?
Yes i think so Keith?
Good. I wanted to clarify for anyone who came by with more macro nesting knowledge, since I went down a side trail at first until I realized what you were asking. I still have no solution, other than my "do it in a completely different way" suggestion. :)
Sheet Author
Keith;s advice is the best here - doing an API button-based menu in chat would be the best way. Nesting macros within macros is fiendishly complicated, and needs a very thorough understanding of html entities as described confusingly in the wiki here . In short, you need to rewrite all the macros you want to call from the dropdown, replacing a lot of characters carefully. For instance, you'd need to replace most   but not all  of the } characters in all of your macros with a string that looks like this:  }  Identifying which characters need to be replaced and what they need to be replaced with gets mindbogglingly complex very quickly, and is beyond my ability.
Can you give me an example of the api button please

Edited 1537172041
Sheet Author
See the tip listed here: Chat Menus Using the default rolltemplate, it would look something like: [Image]( {{name=Alwyn Taleraed's Melee Attacks}} {{ [Long Sword](#Longsword macro)=[Longsword Colossus](#Longsword Colossus Macro) }} You might want to use one of the rolltemplates built into your sheet. You might also want to whisper the API button macro to yourself, so you dont clutter up the chat.
Additionally, if all your macros are built on the sheet (i.e. Character abilities), the syntax becomes: [Long Sword](~Longsword_macro) Again, this works if your controlling macro and the called macros are built on the same sheet. If the controller macro is built in the collections tab, you'll need to identify the character the macro lives on: [Long Sword](~Character_name|Longsword_macro)
So when you say #Longsword macro is that where the Longsword code goes or do i have to name that code Longsword_macro so it will fire?
Sheet Author
Create a macro or ability containing the longsword attack code. Put its name in that place.
So the code would look like this? [Image]( {{name=Alwyn Taleraed's Melee Attacks}} {{ [Long Sword]( [Image](} } @{Alwyn Taleraed |wtype}&{template:atkdmg} {{mod=+5}} {{rname=Longsword}} {{r1=[[@{Alwyn Taleraed |d20}cs>20 + 3[STR] + 3[PROF]]]}} @{Alwyn Taleraed |rtype}cs>20 + 3[STR] + 3[PROF]]]}} {{attack=1}} {{range=}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[1d8 + 3[STR]]]}} {{dmg1type=Slashing }} 0 {{dmg2=[[0]]}} {{dmg2type=Slashing }} {{crit1=[[2d8[CRIT]]]}} {{crit2=[[2d10[CRIT]]]}} 0 {{desc=}}   {{spelllevel=}} {{innate=}} {{globalattack=@{Alwyn Taleraed |global_attack_mod}}} {{globaldamage=[[0]]}} {{globaldamagecrit=[[0]]}} {{globaldamagetype=@{Alwyn Taleraed |global_damage_mod_type}}} ammo= @{Alwyn Taleraed |charname_output} ***Alwyn slashes with his longsword!*** )=[Longsword Colossus](#Longsword Colossus Macro) }}
Not quite. Abilities are macros built on the character sheet and saved with the character. You will need one macro that functions as a menu, and an Ability for each attack. I have only built the one Ability here, and just repeated its name in the menu to illustrate the technique.
Here is what the output looks like: And here is the code for the menu: /w gm &{template:default} {{=[Macro1](~Longsword2H) [Macro2](~Longsword2H) [Macro2](~Longsword2H) }} And the code for the ability (your code): [Image]( @{Alwyn Taleraed|wtype}&{template:atkdmg} {{mod=+5}} {{rname=Longsword}} {{r1=[[@{Alwyn Taleraed|d20}cs>20 + 3[STR] + 3[PROF]]]}} @{Alwyn Taleraed|rtype}cs>20 + 3[STR] + 3[PROF]]]}} {{attack=1}} {{range=}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[1d8 + 3[STR]]]}} {{dmg1type=Slashing }} 0 {{dmg2=[[0]]}} {{dmg2type=Slashing }} {{crit1=[[2d8[CRIT]]]}} {{crit2=[[2d10[CRIT]]]}} 0 {{desc=}}   {{spelllevel=}} {{innate=}} {{globalattack=@{Alwyn Taleraed|global_attack_mod}}} {{globaldamage=[[0]]}} {{globaldamagecrit=[[0]]}} {{globaldamagetype=@{Alwyn Taleraed|global_damage_mod_type}}}ammo= @{Alwyn Taleraed|charname_output} ***Alwyn slashes with his longsword!*** NOTE: Close/save the ability editing windows before testing, or you may get spurious results.
If you click the button on "Choose-attack "that says "Save as token ability" you will get a button that will appear at top right whenever the character token is selected.
Ok so you are saying that my code for the different weapons on the character sheet is fine but i need to alter this code: [Image](} } @{Alwyn Taleraed |wtype}&{template:npcaction} {{rname=Melee Weapons}} {{name=Alwyn Taleraed}} {{description=Select your Weapon: ?{Weapons|Longsword|Longsword(TwoHanded)|HM Longsword|Longsword Colossus} To make the buttons work for each of the weapons selected and this code needs to be on the character sheet as well? Also this code needs to be changed to something like this in order for it to work? Which i like but i want it to whisper to the player instead so it doesn't clutter up the chat window with the selection. So how would you alter my code (above) to get it to work like yours not changing any of the templates to default  because i don't want that? /w gm &{template:default} {{=[Macro1](~Longsword2H) [Macro2](~Longsword2H) [Macro2](~Longsword2H) }}
Ok so i did it like you said and made the code look like this: [Image](}} @{Alwyn Taleraed |wtype}&{template:npcaction} {{rname=Melee Weapons}} {{name=Alwyn Taleraed}} {{description=Select your Weapon: {{= [Longsword] (~Longsword) [TH Longsword] (~TH Longsword) [HM Longsword] (~HM Longsword) [Longsword Colossus] (~Longsword Colossus)}}
I get an error in chat that looks like this: Melee Weapons Alwyn Taleraed Select your Weapon: {{= [Longsword] (~-L4JR-JG8uwP5yzgfDdq|Longsword) [TH Longsword] (~-L4JR-JG8uwP5yzgfDdq|TH  Longsword) [HM Longsword] (~-L4JR-JG8uwP5yzgfDdq|HM Longsword) [Longsword Colossus] (~-L4JR-JG8uwP5yzgfDdq|Longsword Colossus)

Edited 1537308305
You are inserting spaces all over the place. There cannot be a space between [buttonname] and (macroname) for instance. You are also putting spaces behind the character name. That will cause failure when looking for attributes and abilities. Also, I'm not familiar enough with @{Alwyn Taleraed|wtype}. Is that specific to the OGL sheet? Finally, you are putting spaces in the names of the Abilities. Check your ability name. Roll20 automatically replaces spaces with hyphens. ~HM Longsword should be ~HM-Longsword, both in the name of the ability and its reference in the macro. Finally, all of these are being built on the character, not the macro collections tab, correct? You are also missing the }} after the description section, and have an extra set after your image code. Try: [Image]( @{Alwyn Taleraed|wtype}&{template:npcaction} {{rname=Melee Weapons}} {{name=Alwyn Taleraed}} {{description=Select your Weapon:}} {{=[Longsword](~Longsword) [TH-Longsword](~TH-Longsword) [HM Longsword](~HM-Longsword) [Longsword Colossus](~Longsword-Colossus)}} Or perhaps: [Image]( @{Alwyn Taleraed|wtype}&{template:npcaction} {{rname=Melee Weapons}} {{name=Alwyn Taleraed}} {{description=Select your Weapon: [Longsword](~Longsword) [TH-Longsword](~TH-Longsword) [HM Longsword](~HM-Longsword) [Longsword Colossus](~Longsword-Colossus)}}
Ok so i got it working here is the final code now all i need is this to whisper to the player! [Image](}} @{Alwyn Taleraed |wtype}&{template:npcaction} {{rname=Melee Weapons}} {{name=Alwyn Taleraed}} {{description=Select your Weapon: [Longsword](~Longsword)[HuntersMLongsword](~HuntersMLongsword)[TwoHandedLongsword](~TwoHandedLongsword)[ColossusLongsword](~ColossusLongsword)}}
There can be no spaces in the name of the buttons!
Button names can have spaces. Ability names cannot. [Text that displays on the button](~Name-of-Ability-to-Run)
For whispers, put in a whisper on each separate line (don't worry about line breaks in the description tab), also, you put a space back in after the wtype attribute call, and put the extra }} back in. I have removed those: /w Alwyn Taelraed[Image]( /w Alwyin Taelraed @{Alwyn Taleraed|wtype}&{template:npcaction} {{rname=Melee Weapons}} {{name=Alwyn Taleraed}} {{description=Select your Weapon: [Longsword](~Longsword)[HuntersMLongsword](~HuntersMLongsword)[TwoHandedLongsword](~TwoHandedLongsword)[ColossusLongsword](~ColossusLongsword)}}
Thanks Keith for all your help!
Hope it's all working now! :)
Everything is working perfectly Thank You so Much!!!!