To do this, you'd need to use custom roll parsing, action buttons, and sheetworkers. Something like: <input type="number" name="attr_health"><!-- Changed this to just health so that you can use the roll20 max syntax for the max health and have it link to the token correctly -->
<input type="number" name="attr_health_max"><!-- the max health attribute -->
<fieldset class="repeating_magic">
<input type="number" name="attr_dmg_equipment">
<input type="number" name="attr_magic"><!-- Lowercased your attribute names as capitalized attribute names cause problems for sheetworkers -->
<input type="number" name="attr_channel_cost">
<button type="action" name="act_damage"> MagDmg </button><!-- Switched the damage attribute name to be a little simpler with the repeating section -->
</fieldset>
<script type="text/javascript">
// Listen for a click on the action button
on('clicked:repeating_magic:dmgmag',(event) => {
const row = event.sourceAttribute.replace(/(repeating_.+?_.+?)_.+/,'$1'); //Extract the row info from the attribute name.
getAttrs(
['health',`${row}_dmg_equipment`,`${row}_magic`,`${row}_channel_cost`],
// We're going to use async so that we can use the custom roll parsing functions more easily
async (attributes) => {
const roll = await startRoll(`/roll ${attributes[`${row}_dmg_equipment`]} + ${attributes[`${row}_magic`]}`);//Send the roll to the parser
finishRoll(roll.rollId); //Tell roll20 to release the roll to chat
const setObj = {}; //Object to accumulate our changes in.
const health = +attributes.health;//Convert the health to a number instead of a string
setObj.health = health - attributes[`${row}_channel_cost`];//Calculate the new health
setAttrs(setObj,{silent:true});//Apply the health change.
}
)
})
</script> I assumed that your magic stats are actually in a repeating section.