This feature is only available in v3.2.0 and higher
In order to sort item groups in a non-alphabetical order in Text-Based Actors, you must use a little bit of Javascript to configure the order (for now). This guide will walk you through how to do that step-by-step.
Any item groups that do not have a manual sorting order will appear in alphabetical order after all of the manually sorted groups.
Attribute groups cannot be sorted at all, they are always alphabetically sorted.
Step 1 - Group Collection
Collect the names of all groups you want to sort, take a note of them. These will need to be spelled exactly the same as what you write in the "Group" for the items.
Step 2 - Create a Macro
You will need to create a Script macro in order for the rest of these steps to work. The name of the macro doesn't matter, just name it whatever you want.
You can also use the browser dev tools if you know how, but this guide will assume everything is being done in a Script macro.
Step 3 - Getting the Current Order
This step might be more important than you think. If you're editing the group order you already have, you MUST provide the full group ordering, you cannot just provide the new groups.
You can retrieve the list of existing item groups by running this snippet in your macro, which will pop the current order into a notification that won't go away until you click it.
ui.notifications.info(
JSON.stringify(game.settings.get(`taf`, `itemGroupOrder`)),
{ permanent: true }
);
If you do not have any existing group order saved, the notification will have []
and nothing else in it.
Step 4 - Choosing the Order
In order to tell the system what order you want, we have to put the group names from Step 1 into a list.
As an example, if you have the groups:
- Weapons
- Equipment
- Armour
- and, Magic Items
In order to make that into a list we want to type it out like this, in the desired order you want them to appear on the sheet.
["Magic Items", "Armour", "Weapons", "Equipment"]
Note: the square brackets, and quotations are important; they cannot be ignored.
Step 5 - Saving the Order
Once you have the order of the groups you want, we need to save it so that the system knows what to do. In the macro you made, put the following code snippet into it:
const order = []; // REPLACE THE [] WITH YOUR LIST OF GROUPS FROM STEP 4
game.settings.set(`taf`, `itemGroupOrder`, order);