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

Trying to figure out sheetworker by logging eventinfo, but I keep getting "".

I have this HTML code in my character sheet: <td class="sheet-dotLine">     <input type="radio" class="sheet-normal sheet-zero" name="attr_Time" value="0" checked /><span></span>     <input type="radio" class="sheet-normal" name="attr_Time" value="1" /><span></span>     <input type="radio" class="sheet-normal" name="attr_Time" value="2" /><span></span>     <input type="radio" class="sheet-normal" name="attr_Time" value="3" /><span></span>     <input type="radio" class="sheet-normal" name="attr_Time" value="4" /><span></span>     <input type="radio" class="sheet-normal" name="attr_Time" value="5" /><span></span> </td> ... and the following in the Sheet Worker section at the bottom: on("change:time", function(eventInfo) {     console.log("UPDATING TIME");     console.log(eventInfo);     console.dir(eventInfo); }); (Originally, I had "change:Time", but I just read that everything gets converted to lowercase for events; same thing trying "eventinfo" vs. "eventInfo".) I've confirmed that the Sheet Worker scripts are working in general (and the first console log triggers just fine).  But when I change the Time attribute in the sheet, I get the following in my console log: UPDATING TIME sheetsandboxworker.js:438 <unavailable> sheetsandboxworker.js:439 "<unavailable>" sheetsandboxworker.js:440 No matter what I try, I can't seem to get eventinfo to work at all---even with a simple test like this.  Any help is much appreciated!
1523981613

Edited 1523985244
Dana Lexa
Sheet Author
Try this: console.log(JSON.stringify(eventInfo)); Alternatively (since the properties are documented), console.log("eventInfo.sourceAttribute = " + eventInfo.sourceAttribute + "\neventInfo.sourceType = " + eventInfo.sourceType + "\neventInfo.previousValue = " + eventInfo.previousValue + "\neventInfo.newValue = " + eventInfo.newValue + "\neventInfo.removedInfo = " + eventInfo.removedInfo); edit: Now that Roll20 is back up I tried all these on a "change:class" event I already had set up and they worked, but so did "console.log(eventInfo)" and "console.dir(eventInfo)" so it's not the logging method, it may be related to the fact that my attribute is already all lowercase. edit2: I copied the code from your post directly into the character sheet, at the top of the sheet and into the worker script, and it worked. This was in Chrome. Then I tried the sheet in Firefox, and I got <unavailable> for the object itself, but the two methods I suggested above both work. So Chrome's log function can automatically stringify the eventInfo object, but Firefox apparently needs it to be done explicitly.
Aha, stringifying the object seemed to work!  Thanks a ton!