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][SHEETWORKERS] API generated events don't pass newValue or previousValue to the sheetworker

1555121306
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
So, the event that is created on an attribute change is different if the change is triggered by a player/sheetWorker or an API script. If the change is from an API script, there is no newValue or previousValue passed. I've checked this behavior using a small test sheet and script: HTML <input type='number' name='attr_trigger' value='0'> <span>newValue: </span> <span name='attr_newValue'></span> <span>previousValue: </span> <span name='attr_previousValue'></span> Javascript <script type='text/worker'> on('change:trigger',(event)=>{ console.log(JSON.stringify(event)); setAttrs({ newvalue:`${event.newValue}`, previousValue:`${event.previousValue}` },{silent:true}); }); </script> I used Jakob's chatsetAttr script as the API script to modify the attribute. Here's what the sheet looks like after a player initiated change: Here's what it looks like after a script triggered change:
1555128158
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Did you set the "Use Sheetworkers" option from ChatSetAttr?
1555160611

Edited 1555160648
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yep, it's on by default, the event fires, it just doesn't have all the information it should.