Randall S. said:
My intent is to have a button that makes a roll to hit. That roll generates a number of successes between -9 and +9. If the number is positive, it would then roll that many damage dice and select the highest one. I can't see any way to include the damage roll, since it depends on the outcome of the to hit roll, but it seems like I should be able to have it output a chat button which, when clicked, will roll the damage. I can't actually get it to work, however.
So a command like
&{template:skillRoll}{{result=3t[d-3]}}{{damageDie=8}}
would generate a result like
3 successes. Roll Damage
If you then clicked on "Roll Damage" it would roll 3d8k1. I can get all that to work fine, but I want the damage roll to output to a roll template, and that is the part that doesn't seem to work.
A rolltemplate can only use numbers if they are forced to become numbers, like so:
&{template:skillRoll}{{result=[[3t[d-3]]]}}{{damageDie=[[8]]}}
You have a call to a rollable table there, so if you are willing to create tables, just create the macros you need and call those. You don't have to do everything in the sheet. I'm not really a fan of trying to embed everything in one line of code - the api command button system is meant to work with existing macros and abilities, why not create them?
That said, roll20 macros cant save values and reuse them in following rolls, so it seems like what you're asking for isnt really possible with the approach you're using or the method I'm suggesting.
For this kind of thing you normally need the API, but it is probably possible to use the new startroll system to do what you need. But I'm only seeing a fraction of your code and what you're trying to do here, so wouldn't know where to start.