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

API script to fix duplicate attributes

1616124202

Edited 1616124598
Chris D.
Pro
Sheet Author
API Scripter
Compendium Curator
I have several times had characters get into a state where wonky things are happening. It is not very common, but happens several times per year.  The specific problem I am talking about is where one character has two copies of an attribute, and the sheet seeing / changing one, and the API and/or the sheetworkers seeing / changing the other. Thus the user changes something, but the API proceeds as if it was unchanged, or the API changing something, but the user continues to see the old value.  I find that the fix for this is to go to the Attribute & Abilities tab and look at the Attributes that are problematic and seeing if perhaps there are multiple copies of the same name (possibly with the same or different capitalization). and removing all except one.  Once after my internet went down and I had that red bar that warns that connection has been lost, and that changes might not update, I had one attribute in the attribute list 4 times! Has anybody else occasionally had this problem? Anyway, I am seriously considering writing an API utility that reads all a characters Attributes and Abilities, Alphabetizes them in a non-case-sensitive way, and detects duplicates, asking the user which ones ought to be deleted.  Has anybody else already done anything like this? Does this seem like something people would want?
1616126564

Edited 1616126580
vÍnce
Pro
Sheet Author
Here's some code you might be interested in Chris. <a href="https://gist.github.com/Magik11" rel="nofollow">https://gist.github.com/Magik11</a>&nbsp; It was written by Magik(helped code some of the PF sheet) when we were doing quite a bit of work on the PF Community sheet.&nbsp; I believe this was "injected" into the debugging console. It's not written as an API... so I'm not sure if it will help or not.
1616191635
GiGs
Pro
Sheet Author
API Scripter
This used to be a very common problem, but I havent seen it happen for years. Vince's link should be decent for handling individual characters, but if its a common recurring problem, your API approach would be a better solution. I dont know of any such API already written though.
1616202781
Chris D.
Pro
Sheet Author
API Scripter
Compendium Curator
It has been called to my attention about 3 times in the last few months. Once I saw it on my table, and twice by people using my sheet. Like I said, it seems to be associated with loosing internet connection while updating things.&nbsp;
1616207882
GiGs
Pro
Sheet Author
API Scripter
Yeah, I wasnt saying that it doesnt happen any more, just that I havent seen it for a while. Losing connection makes sense as the reason.