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] Noob help

1457519554
Calistocrates
Marketplace Creator
I just can't get sheet worker scripts to work at all. Even copying elements straight from examples and only changing variable names, still nothing. So either I'm doing something fundamentally wrong, or there's a setting somewhere that I'm missing, or... Whatever else might fit in the sphere of things I have no idea of... Best as I can figure, the following should work (< > tags removed for forum display): input type="number" name="attr_TEST1" value="0" input type="number" name="attr_TEST2" value="0" <script type="text/worker"> on("change:test1", function() { getAttrs(["test1"], function(values) { setAttrs({ TEST2: (TEST1 + 1) }); }); }); </script> But nothing keeps happening. Help? Halp?
1457520700
Lithl
Pro
Sheet Author
API Scripter
on("change:test1", function() { getAttrs(["test1"], function(values) { setAttrs({ TEST2: ( values.test1 + 1) }); }); }); Bolded is the important bit. Each of the attributes you list in the first argument to getAttrs is a property of the values parameter in the callback.
1457522523

Edited 1457527736
Calistocrates
Marketplace Creator
Ahhhh, that definitely does something, it's responsive. Thanks! Now I'm just getting 2+1 as 21. Interesting. EDIT: Ah, so html numbers still have to be parsed to integer... ? Sweet...