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

Is there a simple way to sort attributes by name?

July 15 (7 years ago)
Ravenknight
KS Backer

Hiya,

As the title really. I have some shopkeeper characters with a stupid amount of attributes and I need a good way to sort them. I was hoping for something like the Transmogrifier sorter by the Aaron by I haven't seen anything like it.

July 15 (7 years ago)
The Aaron
Pro
API Scripter

This should work:

javascript:$('.attributes div.body.editable.ui-sortable').children().sort( (a,b)=>{ let name1 = $(a).find('.attrname').text().toLowerCase(), name2 = $(b).find('.attrname').text().toLowerCase(); return name1.localeCompare(name2); }).each((i,c)=>$(c).parent().append(c));

July 15 (7 years ago)
Ravenknight
KS Backer
Thank you, Aaron! That was amazingly fast! Not that I complain. ;)
July 15 (7 years ago)
The Aaron
Pro
API Scripter

=D  Well, would have been faster if I wasn't up till 3:00am playing Skyrim... =D

That's amazing. And going to save a lot of time for a lot of people I expect.
Any chance we can get a version for abilities as well? The fact that attributes and abilities randomly rearrange themselves at times has been my anathema for months now, so this is really such a huge timesaver.

July 17 (7 years ago)
The Aaron
Pro
API Scripter

yup.

javascript: $('.abilities div.body.editable.ui-sortable').children().sort( (a,b)=>{ let name1 = $(a).find('.abilname').text().toLowerCase(), name2 = $(b).find('.abilname').text().toLowerCase(); return name1.localeCompare(name2); }).each((i,c)=>$(c).parent().append(c));
Just to be clear, these only adjust the presentation to be alphabetical, not the actual listing, meaning if you close and open it again, it will be in the original order again.

I realised :p
But honestly I'm still hoping that whatever bug causes the Attributes and Abilities to randomly rearrange themselves will get fixed one day, and in the meantime this is still an absolute godsend.

Just a theory, but I think as Attributes are created or updated (even if re-evaluated to the existing value), they go to the bottom of the list.

July 18 (7 years ago)
The Aaron
Pro
API Scripter

Yeah, probably something to do with sheetworkers. My guess is that some sheets delete and recreate some attributes instead of updating them. 

July 18 (7 years ago)

Edited July 18 (7 years ago)

I'm not sure honestly, since I've found that EVERY TIME my sheets re-order themselves, it's always to the same (incorrect order).
For example, my current characters sheets are meant to have Attributes such as Resolve, HP and TempHP at the top. Every single time roll20 adjusts the order however, seemingly of its own accord, Weapon, Base Damage and STR scaling move to the top of the sheet. Every time without exception.

Frankly it's as though roll20 recognises some default order of its down, that unfortunately does not align with the actual intended default order :p

Additionally the sheets frequently re-order themselves even when they haven't been touched or used. I've at times edited one sheet, gone to edit another sheet, then returned to the first to find its rearranged itself once more before a single change has been made or a single ability/macro rolled.

July 18 (7 years ago)
The Aaron
Pro
API Scripter

Ah,  It's probably ordered by id, which is based on creation time.  That is kind of strange.  Are you using a character sheet, or just attributes?

Ahhhhhh. I'll tell you what, I think you may actually be right there. I'll have to do some more testing later to make sure, but that might very well be correct.
And no character sheet, just attributes.

July 18 (7 years ago)
The Aaron
Pro
API Scripter

Morgan said:

And no character sheet, just attributes.

In that case.. check your PMs. =D