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 .
×

not API, sheet worker send CHAT

1635727425
죽화
Pro
Sheet Author
Hi. This has long been considered impossible. <rolltemplate class="sheet-rolltemplate-text"> <div> {{text}} </div> </rolltemplate> <script type="text/worker"> var oldlife = ""; var oldsan = ""; var oldcredit = "";     on("change:life", function() {     getAttrs(["life"], function(values) {     startRoll("&{template:text} {{text=``LIFE`` "+oldlife+"▶"+values.life+"}}", (results) => {});         oldlife = values.life;     });     });     on("change:san", function() {     getAttrs(["san"], function(values) {     startRoll("&{template:text} {{text=``SAN`` "+oldsan+"▶"+values.san+"}}", (results) => {});     oldsan = values.san;     });     });     on("change:credit", function() {     getAttrs(["credit"], function(values) {     startRoll("&{template:text} {{text=``CREDIT`` "+oldcredit+"▶"+values.credit+"}}", (results) => {});     oldcredit = values.credit;     });     }); </script> Make a rolltemplate, and use startRoll. but it's too late.  API is not copied in the game. Please let me know if there is a better way.
1635727969
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yep, this is a newish sheet feature that was launched a few months ago. It allows many things that were once thought impossible. A few small critiques: you need to call finishRoll on the rollId of the results or you will have a large amount of lag before your message shows up in chat. I personally find using the async method of startRoll much easier as it avoids a little bit of callback hell