For fun I tried this;
on('change:fortitude_tickbox', function (eventInfo) {
console.log(eventInfo);
getAttrs(['fortitude_tickbox'], function (values) {
const fortitudeTickbox = parseInt(values['fortitude_tickbox']) || 0;
let button = $20('#token1');
if (fortitudeTickbox === 1) {
button.addClass('tokenaction');
button.removeClass('token');
} else {
button.addClass('token');
button.removeClass('tokenaction');
}
});
});
Which toggles the tokenaction class fine, but it doesn't seem to affect whether the action is displayed or not. ;-( Not sure if "tokenaction" works like other css classes in this situation since it's given special handling by roll20. My guess is that although you can add/remove the tokenaction class with jQuery, the vtt only parses it when you first open the sheet, but then the class state remains regardless if tokenaction is included/removed.