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

D&D 5th Saving throws macro

Hopefully someone can shed some light on this as it is driving me nuts. I have a D&D 5th Ed game that I use to store maps and test things out in.  I created a saving throw macro that would bring up a characters saves as buttons in the chat menu so they could be accessed from there and would work for any character selected.  I have tried to copy the macro ready for a new 5th Ed game and it didn't work in the new game, so I went back to the orignial game to see if I could work out what was wrong, now we get to the interesting bit. If I click the macro on the macro bar it works perfectly bringing up the buttons so I can click the correct save. If I click the macro in the macro tab to activate it ,it works fine as well. If I open the macro and use the test macro button it doesn't work, it fails to bring up the menu of buttons just bringing up the header, and then rolls all the saves at once. If I shift/click on the macro in the macro bar to bring up the actual macro, and use the test macro button it doesn't work. If I copy/paste themacro either from opening it from the macro tab or by shift/clicking it from the bar, and create a new macro and add it to the bar, it doesn't work at all. The macro I am using is &{template:default}{{name=saving throws}}{{[Strength](! @{selected|strength_save_roll})}}{{[Constitution](! @{selected|constitution_save_roll})}}{{[Dexterity](! @{selected|dexterity_save_roll})}}{{[Intelligence](! @{selected|intelligence_save_roll})}}{{[Wisdom](! @{selected|wisdom_save_roll})}}{{[Charisma](! @{selected|Charisma_save_roll})}} That is a straight copy/paste, so I'm not sure if the layout has copied correctly. I am not sure if the fault is in the macro, but it seems odd that it will work fine from the macro bar or the macro tab, but not when I try and test the macro itself. I have opened and closed the macro several times, and open and closed the game several times, just to see if it would reset anything.  I've even tried rolling back the game a couple of days just in case I had changed anything when I tried to copy/paste it, it made no difference. The only API script I have running is TokenNameNumber, so I shouldn't have thought that would effect it.  I have the Stylus Browser Extention on, but the only thing on it is the script to make the menu buttons more compact.  Can anyone shed any light on why this works when activated from the macro bar, but not from the test macro option, and why it won't copy into another game.
1612887824
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You are dealing with html replacements. In your original macro, those returns you see were originally the html coding for a line feed: 
. This works because it puts the attribute call on a new line without breaking the button, which can't have a return in it. It's perfect, until you open it to edit. This is probably what you had pasted originally: &{template:default}{{name=saving throws}}{{[Strength](!
@{selected|strength_save_roll})}}{{[Constitution](!
@{selected|constitution_save_roll})}}{{[Dexterity](!
@{selected|dexterity_save_roll})}}{{[Intelligence](!
@{selected|intelligence_save_roll})}}{{[Wisdom](!
@{selected|wisdom_save_roll})}}{{[Charisma](!
@{selected|Charisma_save_roll})}} Here is a link to the wiki article on attribute replacements, but if I could suggest... Since you are a Pro user, look into the script Token Action Maker, which will do this for any selected character and much, much more. Or if you prefer chat menus, there's a solution too: Token Action Maker Universal Chat Menus 5e Menu Macros
1612890127
David M.
Pro
API Scripter
+1 for Token Action Maker. An indispensable GM utility, imo, and your players can benefit, too!
I will certainly look at Token Action Maker, and the chat menu ones,  I'm still very much a novice when it comes to the API scripts but given links and an idea of what I want them to do I can often manage. I guess what really confused me was it was the same macro, just activated in a different way.
1612895355
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Yeah. In actuality, using HTML replacements is a hack, but it is a very long-established and documented hack.
1612911660

Edited 1612911745
Oosh
Sheet Author
API Scripter
Worth noting a couple of things: 1) That's the wrong syntax for linking a character Ability Macro - it should be [Button Label]( ~charName|macroName ) 2) The syntax used is for linking Collections macros. For those, you can also use a backtick ` instead of the HTML replacement for the carriage return: [Button Label]( `#macroName )   <=== this looks nicer and also removes issues with losing your HTML escapes when copying or editing macros But yeah... just use token action maker :)
1612913526
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Oosh said: Worth noting a couple of things: 1) That's the wrong syntax for linking a character Ability Macro - it should be [Button Label]( ~charName|macroName ) 2) The syntax used is for linking Collections macros. For those, you can also use a backtick ` instead of the HTML replacement for the carriage return: [Button Label]( `#macroName )   <=== this looks nicer and also removes issues with losing your HTML escapes when copying or editing macros On the D&D 5th Edition by Roll20 Sheet, for some inscrutable reason, those saving throw rolls are saved as attributes with the roll code in them. @{selected|dexterity_save_roll} will send: @{wtype}&{template:simple} {{rname=^{dexterity-save-u}}} {{mod=@{dexterity_save_bonus}}} {{r1=[[@{d20}+@{dexterity_save_bonus}@{pbd_safe}]]}} {{always=1}} {{r2=[[@{d20}+@{dexterity_save_bonus}@{pbd_safe}]]}} {{global=@{global_save_mod}}} @{charname_output} for instance.  [Button Label](~selected|dexterity_save_roll) ... produces nothing. But [Button Label](~selected|dexterity_save) ... does. It's a madhouse, a maaaaaadhoooouse!
1612914712
Oosh
Sheet Author
API Scripter
You're totally right, I didn't read very thoroughly, did I? :) In the case of putting an Attribute in a button, instead of an Ability, I'd suggest this then: [Button Label](`@{selected|dexterity_save_roll}) It does unfortunately need an escape in it, but you need to stop it from rolling immediately somehow. I don't think it's necessary at all with the 5e sheet though - as you've pointed out, the original roll button names still work & point to the right place.