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

Attack macro help needed

1577646823

Edited 1577646946
I am using the advanced dungeons and dragons sheet and attempting to use this macro: /w @{selected|token_name} &{template:default}{{name=ATTACKS}}{{[@{selected|weaponname}](! #ATTACK1)}}{{[@{selected|repeating_weapons_$0_weaponname}](! #ATTACK2)}}{{[@{selected|repeating_weapons_$1_weaponname}](! #ATTACK3)}}{{[@{selected|repeating_weapons_$2_weaponname}](! #ATTACK4)}}{{[@{selected|repeating_weapons_$3_weaponname}](! #ATTACK5)}}{{[@{selected|repeating_weapons_$4_weaponname}](! #ATTACK6)}}{{[@{selected|repeating_weapons_$5_weaponname}](! #ATTACK7)}} ATTACK1 &{template:2Eattack}{{title=@{selected|token_name} USES A @{selected|weapsize} SIZED @{selected|weaponname} TO ATTACK @{target|token_name}}}{{ac_hit=[[@{selected|ThAC0}-((D20?{ATTACK ROLL MODIFIER|+0})+(@{selected|attackadj})+(@{selected|strengthhit}*@{selected|strbonus})+(@{selected|dexmissile}*@{selected|dexbonus}))]]}}{{dmg_s=[[((@{selected|damsm}?{DAMAGE ROLL MODIFIER|+0}))+(@{selected|damadj})+(@{selected|strengthdmg}*@{selected|strbonus})]]}}{{dmg_l=[[((@{selected|daml}?{DAMAGE ROLL MODIFIER|+0}))+(@{selected|damadj})+(@{selected|strengthdmg}*@{selected|strbonus})]]}}{{ crit = Roll extra die for crit }} {{ fumble = You Fumble }} ATTACK2 &{template:2Eattack}{{title=@{selected|token_name} USES A @{selected|repeating_weapons_$0_weapsize} SIZED @{selected|repeating_weapons_$0_weaponname} TO ATTACK @{target|token_name}}}{{ac_hit=[[@{selected|ThAC0}-((D20?{ATTACK ROLL MODIFIER|+0})+(@{selected|repeating_weapons_$0_attackadj})+(@{selected|strengthhit}*@{selected|repeating_weapons_$0_strbonus})+(@{selected|dexmissile}*@{selected|repeating_weapons_$0_dexbonus}))]]}}{{dmg_s=[[((@{selected|repeating_weapons_$0_damsm}?{DAMAGE ROLL MODIFIER|+0}))+(@{selected|repeating_weapons_$0_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$0_strbonus})]]}}{{dmg_l=[[((@{selected|repeating_weapons_$0_daml}?{DAMAGE ROLL MODIFIER|+0}))+(@{selected|repeating_weapons_$0_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$0_strbonus})]]}}{{crit=RollCrit}} {{fumble=fumble}} ATTACK3 &{template:default}{{name=@{selected|token_name} USES A @{selected|repeating_weapons_$1_weapsize} SIZED @{selected|repeating_weapons_$1_weaponname} TO ATTACK @{target|token_name}}}{{HITS AC=[[@{selected|ThAC0}-((D20?{ATTACK ROLL MODIFIER|+0})+(@{selected|repeating_weapons_$1_attackadj})+(@{selected|strengthhit}*@{selected|repeating_weapons_$1_strbonus})+(@{selected|dexmissile}*@{selected|repeating_weapons_$1_dexbonus}))]]}}{{NORMAL DAMAGE=S/M[[((@{selected|repeating_weapons_$1_damsm}?{DAMAGE ROLL MODIFIER|+0}))+(@{selected|repeating_weapons_$1_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$1_strbonus})]] L[[((@{selected|repeating_weapons_$1_daml}?{DAMAGE ROLL MODIFIER|+0}))+(@{selected|repeating_weapons_$1_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$1_strbonus})]]}}{{CRIT DAMAGE=S/M[[(((@{selected|repeating_weapons_$1_damsm}?{DAMAGE ROLL MODIFIER|+0})+(@{selected|repeating_weapons_$1_damsm})))+(@{selected|repeating_weapons_$1_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$1_strbonus})]] L[[(((@{selected|repeating_weapons_$1_daml}?{DAMAGE ROLL MODIFIER|+0})+(@{selected|repeating_weapons_$1_daml})))+(@{selected|repeating_weapons_$1_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$1_strbonus})]]}} ATTACK4 &{template:default}{{name=@{selected|token_name} USES A @{selected|repeating_weapons_$2_weapsize} SIZED @{selected|repeating_weapons_$2_weaponname} TO ATTACK @{target|token_name}}}{{HITS AC=[[@{selected|ThAC0}-((D20?{ATTACK ROLL MODIFIER|+0})+(@{selected|repeating_weapons_$2_attackadj})+(@{selected|strengthhit}*@{selected|repeating_weapons_$2_strbonus})+(@{selected|dexmissile}*@{selected|repeating_weapons_$2_dexbonus}))]]}}{{NORMAL DAMAGE=S/M[[((@{selected|repeating_weapons_$2_damsm}?{DAMAGE ROLL MODIFIER|+0}))+(@{selected|repeating_weapons_$2_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$2_strbonus})]] L[[((@{selected|repeating_weapons_$2_daml}?{DAMAGE ROLL MODIFIER|+0}))+(@{selected|repeating_weapons_$2_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$2_strbonus})]]}}{{CRIT DAMAGE=S/M[[(((@{selected|repeating_weapons_$2_damsm}?{DAMAGE ROLL MODIFIER|+0})+(@{selected|repeating_weapons_$2_damsm})))+(@{selected|repeating_weapons_$2_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$2_strbonus})]] L[[(((@{selected|repeating_weapons_$2_daml}?{DAMAGE ROLL MODIFIER|+0})+(@{selected|repeating_weapons_$2_daml})))+(@{selected|repeating_weapons_$2_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$2_strbonus})]]}} so on and so forth reapeating all the way to ATTACK7 changing the _$#_  for each but my output is: The sheet is set up like: What am i doing wrong? Please tell me as I have lost hours to this macro.
1577655995
GiGs
Pro
Sheet Author
API Scripter
This section of your code is the issue. /w @{selected|token_name} &{template:default}{{name=ATTACKS}}{{[@{selected|weaponname}](! #ATTACK1)}}{{[@{selected|repeating_weapons_$0_weaponname}](! #ATTACK2)}}{{[@{selected|repeating_weapons_$1_weaponname}](! #ATTACK3)}}{{[@{selected|repeating_weapons_$2_weaponname}](! #ATTACK4)}}{{[@{selected|repeating_weapons_$3_weaponname}](! #ATTACK5)}}{{[@{selected|repeating_weapons_$4_weaponname}](! #ATTACK6)}}{{[@{selected|repeating_weapons_$5_weaponname}](! #ATTACK7)}} When making API buttons you need to insert the carriage return code after the !, as described in the wiki.  The above section should be /w @{selected|token_name} &{template:default}{{name=ATTACKS}} {{[@{selected|weaponname}](!
#ATTACK1)}} {{[@{selected|repeating_weapons_$0_weaponname}](!
#ATTACK2)}} {{[@{selected|repeating_weapons_$1_weaponname}](!
#ATTACK3)}} {{[@{selected|repeating_weapons_$2_weaponname}](!
#ATTACK4)}} {{[@{selected|repeating_weapons_$3_weaponname}](!
#ATTACK5)}} {{[@{selected|repeating_weapons_$4_weaponname}](!
#ATTACK6)}} {{[@{selected|repeating_weapons_$5_weaponname}](!
#ATTACK7)}} linebreaks inserted for clarity. Remove them. when you save a macro that contains html entities, you cannot reopen it after saving it . When you open a macro, all html characters will be parsed, and converted into the characters they represent. That's why your code has linebreaks in it - the macro has been reopened and the html entities have been processed and removed. Note: this doesnt happen with character sheet abilities, so if you can save this as an ability on your character sheet, you'd avoid this issue. If you're the GM, you can make a character sheet called Macros, set it as editable by everyone, and put such macros as Abilities on that sheet. Then anyone can use them. One question: is that first button (selected| weaponname ) a correct reference?
I appreciate the reply but it did not fix the issue result is exactly the same. whether i run it from a character sheet or as a macro.
and yes the first button is a correct reference as it is one of the few that work
1577750159

Edited 1577750177
GiGs
Pro
Sheet Author
API Scripter
I'd suggest trying to recreate my version of the macro, and make sure you remove the linebreaks. I just created it in a custom game, and get this: The names after the first are that way because the sheet I'm testing doesnt have a repeating_weapons section, so it just prints the text in the macro. But you can see the buttons are there, properly formed. And they work.
By line breaks what do you mean
1577750813

Edited 1577750839
GiGs
Pro
Sheet Author
API Scripter
The code I pasted above was organised so you could see the full text, because i made each section a new line: /w @{selected|token_name} &{template:default}{{name=ATTACKS}} {{[@{selected|weaponname}](!
#ATTACK1)}} {{[@{selected|repeating_weapons_$0_weaponname}](!
#ATTACK2)}} {{[@{selected|repeating_weapons_$1_weaponname}](!
#ATTACK3)}} {{[@{selected|repeating_weapons_$2_weaponname}](!
#ATTACK4)}} {{[@{selected|repeating_weapons_$3_weaponname}](!
#ATTACK5)}} {{[@{selected|repeating_weapons_$4_weaponname}](!
#ATTACK6)}} {{[@{selected|repeating_weapons_$5_weaponname}](!
#ATTACK7)}} But in your macro or ability, it should be a single line, with no manual linebreaks, like this: /w @{selected|token_name} &{template:default}{{name=ATTACKS}} {{[@{selected|weaponname}](!
#ATTACK1)}} {{[@{selected|repeating_weapons_$0_weaponname}](!
#ATTACK2)}} {{[@{selected|repeating_weapons_$1_weaponname}](!
#ATTACK3)}} {{[@{selected|repeating_weapons_$2_weaponname}](!
#ATTACK4)}} {{[@{selected|repeating_weapons_$3_weaponname}](!
#ATTACK5)}} {{[@{selected|repeating_weapons_$4_weaponname}](!
#ATTACK6)}} {{[@{selected|repeating_weapons_$5_weaponname}](!
#ATTACK7)}} In the macro box, it will wrap over several lines, which makes it look like  it has linebreaks when it doesnt. But for templates to work properly, they must be on a single line. And remember to make sure your code has these characters where they should be:  
So it works but still the weird breaks I added weapons 1 at a time and all was fine until I added the weapons in the damage section and that is when all the strangeness happens so at this point I believe it is an issue with the way the macro calls on the sheet so back to the drawing board but thanks a ton for your help
1577763691
GiGs
Pro
Sheet Author
API Scripter
The only thing i can think of is there are some weird characters in one or more of the weapon names. Nothing else in this macro directly accesses the character sheet, until you press one of the buttons. The contents of the attack macros cannot affect the way this is displayed. Is there more to the macro than you shared above? if you share the full thing, we might be able to get to the bottom of it.
ATTACK1 &{template:2Eattack}{{title=@{selected|token_name} USES A @{selected|weapsize} SIZED @{selected|weaponname} TO ATTACK @{target|token_name}}}{{ac_hit=[[@{selected|ThAC0}-((D20?{ATTACK ROLL MODIFIER|+0})+(@{selected|attackadj})+(@{selected|strengthhit}*@{selected|strbonus})+(@{selected|dexmissile}*@{selected|dexbonus}))]]}}{{dmg_s=[[((@{selected|damsm}?{DAMAGE ROLL MODIFIER|+0}))+(@{selected|damadj})+(@{selected|strengthdmg}*@{selected|strbonus})]]}}{{dmg_l=[[((@{selected|daml}?{DAMAGE ROLL MODIFIER|+0}))+(@{selected|damadj})+(@{selected|strengthdmg}*@{selected|strbonus})]]}}{{ crit = Roll extra die for crit }} {{ fumble = You Fumble }} ATTACK2 &{template:2Eattack}{{title=@{selected|token_name} USES A @{selected|repeating_weapons_$0_weapsize} SIZED @{selected|repeating_weapons_$0_weaponname} TO ATTACK @{target|token_name}}}{{ac_hit=[[@{selected|ThAC0}-((D20?{ATTACK ROLL MODIFIER|+0})+(@{selected|repeating_weapons_$0_attackadj})+(@{selected|strengthhit}*@{selected|repeating_weapons_$0_strbonus})+(@{selected|dexmissile}*@{selected|repeating_weapons_$0_dexbonus}))]]}}{{dmg_s=[[((@{selected|repeating_weapons_$0_damsm}?{DAMAGE ROLL MODIFIER|+0}))+(@{selected|repeating_weapons_$0_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$0_strbonus})]]}}{{dmg_l=[[((@{selected|repeating_weapons_$0_daml}?{DAMAGE ROLL MODIFIER|+0}))+(@{selected|repeating_weapons_$0_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$0_strbonus})]]}}{{crit=RollCrit}} {{fumble=fumble}} ATTACK3 &{template:2Eattack}{{title=@{selected|token_name} USES A @{selected|repeating_weapons_$1_weapsize} SIZED @{selected|repeating_weapons_$1_weaponname} TO ATTACK @{target|token_name}}}{{ac_hit=[[@{selected|ThAC0}-((D20?{ATTACK ROLL MODIFIER|+0})+(@{selected|repeating_weapons_$1_attackadj})+(@{selected|strengthhit}*@{selected|repeating_weapons_$1_strbonus})+(@{selected|dexmissile}*@{selected|repeating_weapons_$1_dexbonus}))]]}}{{dmg_s=[[((@{selected|repeating_weapons_$1_damsm}?{DAMAGE ROLL MODIFIER|+0}))+(@{selected|repeating_weapons_$1_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$1_strbonus})]]}}{{dmg_l=[[((@{selected|repeating_weapons_$1_daml}?{DAMAGE ROLL MODIFIER|+0}))+(@{selected|repeating_weapons_$1_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$1_strbonus})]]}}{{crit=RollCrit}} {{fumble=fumble}} ATTACK4 &{template:default}{{name=@{selected|token_name} USES A @{selected|repeating_weapons_$2_weapsize} SIZED @{selected|repeating_weapons_$2_weaponname} TO ATTACK @{target|token_name}}}{{HITS AC=[[@{selected|ThAC0}-((D20?{ATTACK ROLL MODIFIER|+0})+(@{selected|repeating_weapons_$2_attackadj})+(@{selected|strengthhit}*@{selected|repeating_weapons_$2_strbonus})+(@{selected|dexmissile}*@{selected|repeating_weapons_$2_dexbonus}))]]}}{{NORMAL DAMAGE=S/M[[((@{selected|repeating_weapons_$2_damsm}?{DAMAGE ROLL MODIFIER|+0}))+(@{selected|repeating_weapons_$2_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$2_strbonus})]] L[[((@{selected|repeating_weapons_$2_daml}?{DAMAGE ROLL MODIFIER|+0}))+(@{selected|repeating_weapons_$2_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$2_strbonus})]]}}{{CRIT DAMAGE=S/M[[(((@{selected|repeating_weapons_$2_damsm}?{DAMAGE ROLL MODIFIER|+0})+(@{selected|repeating_weapons_$2_damsm})))+(@{selected|repeating_weapons_$2_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$2_strbonus})]] L[[(((@{selected|repeating_weapons_$2_daml}?{DAMAGE ROLL MODIFIER|+0})+(@{selected|repeating_weapons_$2_daml})))+(@{selected|repeating_weapons_$2_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$2_strbonus})]]}} ATTACK5 &{template:default}{{name=@{selected|token_name} USES A @{selected|repeating_weapons_$3_weapsize} SIZED @{selected|repeating_weapons_$3_weaponname} TO ATTACK @{target|token_name}}}{{HITS AC=[[@{selected|ThAC0}-((D20?{ATTACK ROLL MODIFIER|+0})+(@{selected|repeating_weapons_$3_attackadj})+(@{selected|strengthhit}*@{selected|repeating_weapons_$3_strbonus})+(@{selected|dexmissile}*@{selected|repeating_weapons_$3_dexbonus}))]]}}{{NORMAL DAMAGE=S/M[[((@{selected|repeating_weapons_$3_damsm}?{DAMAGE ROLL MODIFIER|+0}))+(@{selected|repeating_weapons_$3_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$3_strbonus})]] L[[((@{selected|repeating_weapons_$3_daml}?{DAMAGE ROLL MODIFIER|+0}))+(@{selected|repeating_weapons_$3_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$3_strbonus})]]}}{{CRIT DAMAGE=S/M[[(((@{selected|repeating_weapons_$3_damsm}?{DAMAGE ROLL MODIFIER|+0})+(@{selected|repeating_weapons_$3_damsm})))+(@{selected|repeating_weapons_$3_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$3_strbonus})]] L[[(((@{selected|repeating_weapons_$3_daml}?{DAMAGE ROLL MODIFIER|+0})+(@{selected|repeating_weapons_$3_daml})))+(@{selected|repeating_weapons_$3_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$3_strbonus})]]}} ATTACK6 &{template:default}{{name=@{selected|token_name} USES A @{selected|repeating_weapons_$4_weapsize} SIZED @{selected|repeating_weapons_$4_weaponname} TO ATTACK @{target|token_name}}}{{HITS AC=[[@{selected|ThAC0}-((D20?{ATTACK ROLL MODIFIER|+0})+(@{selected|repeating_weapons_$4_attackadj})+(@{selected|strengthhit}*@{selected|repeating_weapons_$4_strbonus})+(@{selected|dexmissile}*@{selected|repeating_weapons_$4_dexbonus}))]]}}{{NORMAL DAMAGE=S/M[[((@{selected|repeating_weapons_$4_damsm}?{DAMAGE ROLL MODIFIER|+0}))+(@{selected|repeating_weapons_$4_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$4_strbonus})]] L[[((@{selected|repeating_weapons_$4_daml}?{DAMAGE ROLL MODIFIER|+0}))+(@{selected|repeating_weapons_$4_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$4_strbonus})]]}}{{CRIT DAMAGE=S/M[[(((@{selected|repeating_weapons_$4_damsm}?{DAMAGE ROLL MODIFIER|+0})+(@{selected|repeating_weapons_$4_damsm})))+(@{selected|repeating_weapons_$4_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$4_strbonus})]] L[[(((@{selected|repeating_weapons_$4_daml}?{DAMAGE ROLL MODIFIER|+0})+(@{selected|repeating_weapons_$4_daml})))+(@{selected|repeating_weapons_$4_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$4_strbonus})]]}} ATTACK7 &{template:default}{{name=@{selected|token_name} USES A @{selected|repeating_weapons_$5_weapsize} SIZED @{selected|repeating_weapons_$5_weaponname} TO ATTACK @{target|token_name}}}{{HITS AC=[[@{selected|ThAC0}-((D20?{ATTACK ROLL MODIFIER|+0})+(@{selected|repeating_weapons_$5_attackadj})+(@{selected|strengthhit}*@{selected|repeating_weapons_$5_strbonus})+(@{selected|dexmissile}*@{selected|repeating_weapons_$5_dexbonus}))]]}}{{NORMAL DAMAGE=S/M[[((@{selected|repeating_weapons_$5_damsm}?{DAMAGE ROLL MODIFIER|+0}))+(@{selected|repeating_weapons_$5_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$5_strbonus})]] L[[((@{selected|repeating_weapons_$5_daml}?{DAMAGE ROLL MODIFIER|+0}))+(@{selected|repeating_weapons_$5_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$5_strbonus})]]}}{{CRIT DAMAGE=S/M[[(((@{selected|repeating_weapons_$5_damsm}?{DAMAGE ROLL MODIFIER|+0})+(@{selected|repeating_weapons_$5_damsm})))+(@{selected|repeating_weapons_$5_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$5_strbonus})]] L[[(((@{selected|repeating_weapons_$5_daml}?{DAMAGE ROLL MODIFIER|+0})+(@{selected|repeating_weapons_$5_daml})))+(@{selected|repeating_weapons_$5_damadj})+(@{selected|strengthdmg}*@{selected|repeating_weapons_$5_strbonus})]]}}   the main macro calls on the above which i have set up as individual macros all visible to the players