Since the thread is closed, I cannot comment or ask a question there. Here is the original post . The author suggests using the character name to do it, but it is probably simpler to use character_id that is immutable. Thus, the final function would become < ! - - The visible and draggable button for the macro bar - - >
< button type = "roll" name = "roll_athletics" value = "@{athletics_action}" > Athletics < /button >
< ! - - The invisible button allowing the use of custom roll parsing - - >
< button type = "action" name = "act_athletics-action" class = "hidden" > < /button >
< ! - - The invisible field for the attribute which contains the ability call - - >
< input type = "hidden" name = "attr_athletics_action" value = "" >
[...]
< script type = "text/worker" >
on ( "sheet:opened" , function (eventInfo) {
getAttrs ([ "character_id" , "athletics_action" ], function (v) {
var attrsToChange = {};
attrsToChange[ "athletics_action" ] = "%{" + v[ "character_id" ] + "|athletics-action}" ;
setAttrs (attrsToChange);
});
});
< /script > It's a small change, but I think it might avoid triggering every time the name is changed for any reason, and it might avoid bugs due to the sheet author forgetting the second trigger. (I tested it on my side on a test sheet, if there is something I am missing please let me know)