Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[bug][API] setDefaultTokenForCharacter() triggers API change events

1496095287
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
While writing a new script, I noticed that the setDefaultTokenForCharacter() function triggers character change events in the API. This would seem to contradict the general design methodology that the API can't trigger itself (except with chat messages).
1497227724
Gid
Roll20 Team
Could you share a snippet of your API script where you're seeing this occur, Scott?
1497235251

Edited 1497235285
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Sure thing. Here's the snippet I wrote to make sure I wasn't just doing something funny in the complicated companion script: SetDefaultTokenTest.js on('chat:message',(msg)=>{     var graphic = getObj('graphic',msg.content.split(/\s+/)[0]),         character = getObj('character',msg.content.split(/\s+/)[1]);          setDefaultTokenForCharacter(character,graphic); }); on('change:character',(obj,prev)=>{     log('OBJ: '+JSON.stringify(obj));     log('PREV: '+JSON.stringify(prev)); }); Command Message: @{target|token_id} @{CHARNAME|character_id}