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

Read the result of a button or read a value from the chat

Hi everyone, I'm trying to create a Character Sheet for my GDR and I need to read the button's result or read the value in the chat, using the API script. You can find my code below on("chat:message", function(msg) {   if(msg.type == "api" && msg.content.indexOf("!sr ") !== -1) {        var Test_read = JSON.parse (ops [0] .content) .total   }         setAttrs({                                          rollresult: Test_read             }); }); Thanks to all.
1589186327
GiGs
Pro
Sheet Author
API Scripter
What is the purpose of the script you are trying to make? Not the read chat one, but the eventual purpose this will allow you to do. It looks like you;re creating a sheet worker. Sheet workers cant read chat. They can only read attribute values on the character sheet, and respond to action button clicks, What do you want to be able to do?
Hi there,  Thank you for your tempestive answer. I’m sorry if my explanation wasn’t clear enough. I want to be able to use the result of the roll of the dice, to change the value on the character sheet automatically. For instance, if I roll the dice to attack and to defense, I wish that the result of the difference between the two numbers would automatically appear in the character sheet. I just wanted to know if or how I could do it using the API.