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

[Custom Sheet] Problems with on-change scripts

Intro Hello all! I'm currently working to create a custom character sheet, based on the legacy D&D 5e character sheet ( original code here ). The sheet is intended for my own homebrew setting which is based on the 5th edition OGL but expands on some of its core features, including new skills and a change to the 'race' mechanic, amongst other things. For context, I have some limited experience working in HTML and CSS, but no prior Java experience. (I do have limited experience in Ruby, Prolog and a certain C variety, so I know my way around a coding language, just not familiar to any Javascript particulars.) The Problem While I will want to make further changes down the line, the current headline changes are: Adding four new skills to the skill box Moving the global skill modifier to the skill box because I find that makes more sense Removing electrum pieces Adding a new 'Professions' box, which functions similarly to the Tools box Replacing 'race' with two seperate sections - 'genus' and 'culture' I have also removed charactermancer functionality because I would rather handle stuff analogue for now. The basic problem that I am facing is that on-change scripts don't seem to be firing. When you change a value on the character sheet (for example, changing dexterity from 14 to 16 or changing your genus), the change doesn't trigger changes in any other attribute - for example, changing dexterity fails to change your dexterity modifier, and changing the genus attribute fails to change the displayed genus. At first I thought this was just a problem with the on-change scripts I had written for the new elements I added, but it seems to be a problem across the sheet - scripts which I haven't touched, such as the Dexterity update scripts, are also not working. So it seems to be a more fundamental problem. A possibly related problem is that in both the new Professions box and the told Tools box, you can change the names of entries (and that will register when you unclick the cog), but although the proficiency setting and skill can be changed, these changes do not register once you unclick the cog. If you roll from the box, it doesn't add any modifier (it just does a straight roll). Quite possibly these are very noob problems, but I'm tearing my hair out trying to get it to work so I thought I'd check the hive mind for any ideas. The Code Trying to post all of the code here before created an error message so I think it might be too much for one forum post. Thus, you can find the full code here: link to GitHub .
1609267660
GiGs
Pro
Sheet Author
API Scripter
If there's a serious syntax error, it can break all sheet workers after it ('after' being a relative term, it depends when the broken code is called). Having a quick look at the sheet worker code, there's a LOT of stuff there, and it's going to be hard to identify a problem.  Personally I'd remove the entire contents of the script block, and add workers back in one-by-one, making sure they each work as you add them. That way you know what the code is, and what it is doing. Dont add anything back that you dont understand.
1609268552
GiGs
Pro
Sheet Author
API Scripter
Also i had a bit more of a look at the code, in a syntax checker, and it appears to be breaking in one of the _drop functions which are for compendium drag & drop. But also looking more wide ranging over the code, that is going to be a very inefficient sheet even if it works. I'd recommend looking for a different legacy D&D sheet. The problem is all the update_skills, update_saves, etc. stats scattered around. The way the code is written means there are way, way more getAttrs and setAttrs calls than there should be, which will likely cause a lot of lag once you get a few detailed characters active at once.
GiGs said: If there's a serious syntax error, it can break all sheet workers after it ('after' being a relative term, it depends when the broken code is called). Having a quick look at the sheet worker code, there's a LOT of stuff there, and it's going to be hard to identify a problem.  Personally I'd remove the entire contents of the script block, and add workers back in one-by-one, making sure they each work as you add them. That way you know what the code is, and what it is doing. Dont add anything back that you dont understand. OK, cool - I will have a look at cutting out the scripts that are currently there and working back in what seems to be essential step by step. Thanks for the advice! GiGs said: Also i had a bit more of a look at the code, in a syntax checker, and it appears to be breaking in one of the _drop functions which are for compendium drag & drop. But also looking more wide ranging over the code, that is going to be a very inefficient sheet even if it works. I'd recommend looking for a different legacy D&D sheet. The problem is all the update_skills, update_saves, etc. stats scattered around. The way the code is written means there are way, way more getAttrs and setAttrs calls than there should be, which will likely cause a lot of lag once you get a few detailed characters active at once. OK, cool, I will try to have a look at some of the other 5E sheets on the hub for ideas and see what I can do about trimming it down. Thank you!