Ok, since I have found that modifying a bar value on a token from the API does not trigger on(change:graphic) I decided to delve into creating some functions of my own using a name space. I can get this to work, however, I am having an issue when trying to grab the bar value from a token. I am passing the token id to the function when it is called. I have set up to log the value to the API console, and it shows up. but when I try to use any functions on it, nothing happens, and the rest of the script is skipped with no error logged. What am I doing wrong. Here is the code for my namespace creation and the function - var cnc = cnc || {};
cnc.tokenFunctions = function() {
this.setMarker = function(obj) {
log ('Token Id - ' + obj);
let tokenHP = obj.get('bar1_value');
log(tokenHP);
log('End');
};
};
And here is what I am using to call this - let token = new cnc.tokenFunctions();
token.setMarker(targetTokenID); This is the output in the API console - Spinning up new sandbox...
"--> Notice: Monsters creation disabled"
"-=> C&C Combat Computer v2.0 - Scott Westberg - 2020/08/20 <=-"
"Token Id - -LAAWw58Tcn-rS2caq6d"