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

on change, but not?

1720476636

Edited 1720477336
I've got a variable called SkillRatingBody that updates every time either the Body or SkillTitleBody variables change. I'm trying to replicate this for another section that is exactly the same in every way, but the names of the variables are different. But this copy and paste of the first function only updates on refreshing the roll20 page. Here's the code- <a href="https://pastebin.com/h5t0NX0v" rel="nofollow">https://pastebin.com/h5t0NX0v</a> I can only assume I've done something wrong. Can anyone see what I've done wrong? The code that works is in a div class called "sheet-experience". The one that does not work is in the next div, called "sheet-org". I know there's more than one sheet-org. If that's the problem, then I'll have another question after that.
1720480932

Edited 1720481105
vÍnce
Pro
Sheet Author
Hi Tuck, I assume this is the input that works? &lt;input type="number" STYLE="color: #1C2833; font-family: Verdana; font-size: 12px; background-color: #F9EBEA;" name="attr_SkillRatingBody" value="@{Body} + @{SkillTitleBody}" disabled&gt; What is the input that isn't working exactly?&nbsp; If it's another html auto-calculated attribute, can you successfully get values of each component attribute on their own.&nbsp; ie call each component-attribute in chat and get the current value. side-note (probably unrelated to this problem, but...) I saw a couple oddities in the code that I'll mention. &lt;input type="hidden" name="attr_expspent" value="@{skilltitlebody + 1} + @{skilltitlemind + 1} + @{skilltitleeq + 1} + @{skilltitlequick + 1}"&gt; Seems like those attribute names are most likely malformed and should actually be... &lt;input type="hidden" name="attr_expspent" value="@{skilltitlebody} + 1 + @{skilltitlemind} + 1 + @{skilltitleeq} + 1 + @{skilltitlequick} + 1"&gt; and something else that caught my eye; &lt;td bgcolor="#F5B7B1"&gt; &lt;!--input type="number" STYLE="color: #1C2833; font-family: Verdana; font-size: 12px; background-color: #F9EBEA;" name="attr_SkillProgressBody" value="0" min="0"--&gt; &lt;/td&gt; &lt;td bgcolor="#F5B7B1"&gt; &lt;!--input type="number" STYLE="color: #1C2833; font-family: Verdana; font-size: 12px; background-color: #F9EBEA;" name="attr_SkillProgressMax" value="(@{SkillTitleBody} + 1) * 10" disabled--&gt; &lt;/td&gt; The commented out code is "odd" to me.&nbsp; As-in, comments used to nullify code should wrap the actual code and not be part of it. &lt;td bgcolor="#F5B7B1"&gt; &lt;!-- &lt;input type="number" STYLE="color: #1C2833; font-family: Verdana; font-size: 12px; background-color: #F9EBEA;" name="attr_SkillProgressBody" value="0" min="0"&gt; --&gt; &lt;/td&gt; &lt;td bgcolor="#F5B7B1"&gt; &lt;!-- &lt;input type="number" STYLE="color: #1C2833; font-family: Verdana; font-size: 12px; background-color: #F9EBEA;" name="attr_SkillProgressMax" value="(@{SkillTitleBody} + 1) * 10" disabled&gt; --&gt; &lt;/td&gt; Technically, both accomplish the same thing in this example, but I've never seen it done quite like that and I could see how this could easily lead to breaking the html if/when it was ever un-commented.&nbsp; Just thought I should mention it.&nbsp; This was just in the immediate vicinity of your SkillRatingBody attribute. I'm totally not meaning to be a coding gatekeeper here. lol ;-)
You're not gatekeeping, you're helping, and I thank you for it. I'll look into that. Thanks.
1720497398

Edited 1720497408
GiGs
Pro
Sheet Author
API Scripter
There's nothing wrong with commenting out code like that - especially if you want to keep the table structure unchanged. (You shouldnt be using tanles, but that is another issue). I agree with the comments about the earlier attributes: + 1} should definitely be } + 1
Vince, First off thanks for pointing out where the code is messed up with the +1 things. I'll fix that. Second, if you go one major div down from the first paste you made, you'll see this- &lt;input type="number" STYLE="color: #1C2833; font-family: Verdana; font-size: 12px; background-color: #F9EBEA;" name="attr_MethodRatingForce" value="@{orgforce} + @{MethodTitleForce}" disabled&gt; This is the line that is not updating like the one above does. It's a copy/paste of the above section, with the variable names changed. But clearly I messed up. I'd appreciate any insight.
1720552355
GiGs
Pro
Sheet Author
API Scripter
That line looks fine, I'd try wrapping the calculation in square breakets like value="[[@{orgforce} + @{MethodTitleForce}]]" If that's still not updating properly, you'd need to check the orgforce and&nbsp; MethodTitleForce attributes, and then if necessary, check all the attributes that make them up, and so on till every attribute is working properly. Also put round brackets ( ) around every value in the chain - you probably dont need them but it's a brute force solution to some problems. Personally, I'd replace that calculation with a sheet worker (remembering that sheet workers annot change disabled attributes).
Thanks GiGs, I'll try that.
I've solved the problem by deleting the entire div and starting over. I copied and pasted the working version from Experiences, then changed one variable name at a time, testing each change. Tedious, but it worked. I wish there was a way to live-test these changes.
1720563215
GiGs
Pro
Sheet Author
API Scripter
There is a way to live test changes. Use the Custom Sheet Sandbox Also, there's another way - open the dev console (click F12), and edit whatever is shown there. These changes last only until a refresh.
1720571698
vÍnce
Pro
Sheet Author
and to add to this; you can also use Scott's chrome extension: Roll20 API and Sheet Autoupdater that will update your roll20 dev sandbox as you edit your local html/css/translation files.&nbsp; Very handy.
Thanks for the tips. I'll try them.