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

Defining ability/macro in a 5e sheet weapon description

I can easily create buttons in the 5e sheet weapon description  by adding the following to the description field  [Do Next 1](~Mytoon|Next1) [Do Next 2](~Mytoon|Next2) But how do I define Next1 and Next2 so they will not be run until the buttons are clicked? Thanks...
1691968508
Gauss
Forum Champion
Hi Al G.,  The way those buttons work is they don't do anything unless you push the button. There is no "run" when they aren't pushed. 
1692021491

Edited 1692021516
Actually, when I am trying to define the action for the button, I end up having the script run when it is being defined.  They are in essence running when they are defined and not waiting until I click them.  What you are describing is actually what I want...I do not want the button to do anything until it is clicked...so how do I define the associated action in a way that it does not run until the button is clicked...
1692024844
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi Al! Could you post some screen shots of what you are actually doing, or at least detailed repro steps? I use buttons in description fields for many characters and cannot reproduce this as described?
OK...Here is an example... Using the 5e template, I have a weapon entry in the Attacks  & Spellcasting section on the Core page of the Character Sheet. Using a character named MyToon i f I place [Do Next 1](~Mytoon|Next1) [Do Next 2](~Mytoon|Next2) In the description section of the weapon attack it creates two roll macro buttons in the chat window (Do Next 1 and Do Next 2) when the weapon attack is clicked. If these buttons are clicked they attempt to run a roll macro Next1 or Next2 which have not yet been defined. When I try to define the macro in the description of the weapon attack, the definition runs immediately and does not wait for the button to be clicked.  I need to be able to enter the definition so it waits for "Do Next 1" to be clicked and not when the weapon attack is clicked.  If this has to be done in  a separate step to create the called macro, I can live with that, but I was really hoping to dynamically define the macro as part of the description.
1692122631

Edited 1692122782
Gauss
Forum Champion
Al G., What would you like each button to do?  As in, what specific output when you push the button? A dice roll? Entirely different attack? Some text? Etc.
1692122930

Edited 1692123811
Al G. said: OK...Here is an example... Using the 5e template, I have a weapon entry in the Attacks  & Spellcasting section on the Core page of the Character Sheet. Using a character named MyToon if I place [Do Next 1](~Mytoon|Next1) [Do Next 2](~Mytoon|Next2) In the description section of the weapon attack it creates two roll macro buttons in the chat window (Do Next 1 and Do Next 2) when the weapon attack is clicked. If these buttons are clicked they attempt to run a roll macro Next1 or Next2 which have not yet been defined. When I try to define the macro in the description of the weapon attack, the definition runs immediately and does not wait for the button to be clicked.  I need to be able to enter the definition so it waits for "Do Next 1" to be clicked and not when the weapon attack is clicked.  If this has to be done in  a separate step to create the called macro, I can live with that, but I was really hoping to dynamically define the macro as part of the description. Why are you trying to define the macro in the description of the weapon attack?  You need to define the macro in the Next1 and Next2 Abilities on the MyToon character, not in the weapon attack description. If you put the macro into 'Next1' as an Ability, then the macro won't run until it is clicked on in the weapon description with the [Do Next 1] or [Do Next 2] buttons.
1692123519

Edited 1692123720
I created a sample character named 'MyToon'. Here is what the Attacks and Spellcasting item and Ability Macro looks like: And here is the output into chat: the first roll had 'Don't Auto Roll Damage and Crit' selected; the second one had 'Auto Roll Damage and Crit' selected. I clicked on the 'Do Next 1' button for the first roll, and the 'Do Next 2' button for the second roll to get the output into chat. Please clarify if that's what you're looking for.
1692134060
GiGs
Pro
Sheet Author
API Scripter
Al G. said: Using a character named MyToon i f I place [Do Next 1](~Mytoon|Next1) [Do Next 2](~Mytoon|Next2) If these buttons are clicked they attempt to run a roll macro Next1 or Next2 which have not yet been defined. When I try to define the macro in the description of the weapon attack, the definition runs immediately and does not wait for the button to be clicked.&nbsp; I need to be able to enter the definition so it waits for "Do Next 1" to be clicked and not when the weapon attack is clicked.&nbsp; If this has to be done in&nbsp; a separate step to create the called macro, I can live with that, but I was really hoping to dynamically define the macro as part of the description. If you put code in the description, it is not in the button and so will run automatically. If want your buttons to run code, you have two choices: Create an ability or macro to be run when the button is clicked. These are completely separate from the way buttons are sent to chat. They are separate things (and abilities need a character defined too, though you can use selected or target . Include the code in the button itself. If the roll isn't too complicated you can do that, preceded by a backtick, as shown here: <a href="https://wiki.roll20.net/Chat_Menus#Roll_Command" rel="nofollow">https://wiki.roll20.net/Chat_Menus#Roll_Command</a> Creating an ability or macro is easier.
Gauss said: Al G., What would you like each button to do?&nbsp; As in, what specific output when you push the button? A dice roll? Entirely different attack? Some text? Etc. Yes.... I would lie to be able to do inline dice rolls with descriptive text and/or an entirely different attack and/or present a template with template data defined... Is there a significant difference between how these are done?
1692169929

Edited 1692170006
Jarren said: Al G. said: OK...Here is an example... Using the 5e template, I have a weapon entry in the Attacks&nbsp; &amp; Spellcasting section on the Core page of the Character Sheet. Using a character named MyToon if I place [Do Next 1](~Mytoon|Next1) [Do Next 2](~Mytoon|Next2) In the description section of the weapon attack it creates two roll macro buttons in the chat window (Do Next 1 and Do Next 2) when the weapon attack is clicked. If these buttons are clicked they attempt to run a roll macro Next1 or Next2 which have not yet been defined. When I try to define the macro in the description of the weapon attack, the definition runs immediately and does not wait for the button to be clicked.&nbsp; I need to be able to enter the definition so it waits for "Do Next 1" to be clicked and not when the weapon attack is clicked.&nbsp; If this has to be done in&nbsp; a separate step to create the called macro, I can live with that, but I was really hoping to dynamically define the macro as part of the description. Why are you trying to define the macro in the description of the weapon attack?&nbsp; You need to define the macro in the Next1 and Next2 Abilities on the MyToon character, not in the weapon attack description. If you put the macro into 'Next1' as an Ability, then the macro won't run until it is clicked on in the weapon description with the [Do Next 1] or [Do Next 2] buttons. I am trying to define the macro in the description for the maintainability of the solution.&nbsp; If I have to make changes in twenty different locations of the sheet it will be far more difficult to maintain, and far more likely to get screwed up when I make changes in the future and I have forgotten where I put all the pieces.&nbsp; But as I said, if that is the only way to get it to work, well then I will go that route... Your solution looks awesome...
GiGs said: Al G. said: Using a character named MyToon i f I place [Do Next 1](~Mytoon|Next1) [Do Next 2](~Mytoon|Next2) If these buttons are clicked they attempt to run a roll macro Next1 or Next2 which have not yet been defined. When I try to define the macro in the description of the weapon attack, the definition runs immediately and does not wait for the button to be clicked.&nbsp; I need to be able to enter the definition so it waits for "Do Next 1" to be clicked and not when the weapon attack is clicked.&nbsp; If this has to be done in&nbsp; a separate step to create the called macro, I can live with that, but I was really hoping to dynamically define the macro as part of the description. If you put code in the description, it is not in the button and so will run automatically. If want your buttons to run code, you have two choices: Create an ability or macro to be run when the button is clicked. These are completely separate from the way buttons are sent to chat. They are separate things (and abilities need a character defined too, though you can use selected or target . Include the code in the button itself. If the roll isn't too complicated you can do that, preceded by a backtick, as shown here: <a href="https://wiki.roll20.net/Chat_Menus#Roll_Command" rel="nofollow">https://wiki.roll20.net/Chat_Menus#Roll_Command</a> Creating an ability or macro is easier. Thanks Gigs...I will try to put a little more time into learning the capabilities of the roll commands, as that might be a way to keep all this code together in one place... Thank you so much to everyone for taking the time to offer suggestions and help a newb understand roll20, the 5e template and macro capabilities...&nbsp; I do not use this often enough and I find I end up starting all over again when I create a new character several years later... Your help is most appreciated!
1692170763

Edited 1692170808
Gauss
Forum Champion
Al G. said: Gauss said: Al G., What would you like each button to do?&nbsp; As in, what specific output when you push the button? A dice roll? Entirely different attack? Some text? Etc. Yes.... I would lie to be able to do inline dice rolls with descriptive text and/or an entirely different attack and/or present a template with template data defined... Is there a significant difference between how these are done? Specific examples are needed to answer your question.&nbsp; An attack could be a simple dice roll, or it could be a template. So if you could post a specific "what I want to put into the button" I or others could give a specific answer.&nbsp; With that said, most likely you need Ability macros to link your buttons to, as discussed previously.