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

Sheet Worker Scripts- multiple inputs?

1510595675

Edited 1510595785
Missingquery
Pro
Sheet Author
API Scripter
I would like to be able to select for one of several attributes changing, linked by OR statements. However, I'm not sure how/if to do this, since it's not outlined in the wiki. If there isn't a way to do this within the initial on(change:attr, function()) function, I could theoretically link several together using else-if statements, but given that I would need to do 68 of them, it wouldn't be particularly efficient. Please help!
1510596154
Jakob
Sheet Author
API Scripter
on('change:attr1 change:attr2 change:attr3', doSomething);
1510599947
Missingquery
Pro
Sheet Author
API Scripter
And just to clarify, these multiple conditions are OR-conditional and not AND-conditional, right?
1510601411
Jakob
Sheet Author
API Scripter
Indeed, doSomething will be run any time one of the events fire, so it's an OR. You can also mix in other event types (like sheet:opened).
1510609593
Lithl
Pro
Sheet Author
API Scripter
The callback function will also have a parameter with the event info; e.sourceAttribute will be the name of the attribute that changed (if a change event triggered the callback).&nbsp;<a href="https://wiki.roll20.net/Sheet_Worker_Scripts#eventInfo_Object" rel="nofollow">https://wiki.roll20.net/Sheet_Worker_Scripts#eventInfo_Object</a>