Ordering swatches for a TS4 CAS Part

This tutorial is not outdated. s4s does clothing swatch ordering automatically now so this is not needed.

Ordering swatches - for the creator with borderline OCD like me
This is a quick and basic method for ordering multiple swatches in a new standalone CAS part. I want to give special thanks to Snaitf and plasticbox from Mod the Sims for clearing up some of the mystery (since I am still such a newb when it comes to actually messing with resources).


  • Confidence editing package files
  • S4pe
  • Basic knowledge of how to use s4pe
  • Pen and paper
  • Easy access to screenshot folder (if you have dropbox, I highly recommend getting dropbox to save screenshots to a folder in that directory. Very helpful)

What this doesn’t teach you

  • how to create cc
  • how to use S4S
  • how to use s4pe

So lets get started

1. Make your recolours. I use S4S for this, but Color Magic also works for this method. Note the order you want your recolours in for later. Go in-game and find your creation. Take screenshot so you know what order the swatches show up in.

2. Open A COPY (in case you mess something up) of the package file. Filter by Instance then by Tag by clicking the top of the list once. This will order the instances from lowest to highest, and group by type. You will know that this is done when the CASP files start with 0x80 and the value increases as you go down the list.

3. Using screen shot as a guide, find the thumbnail for your first item and note down the instance number. In my case it is 0xA37777C70334AA56.

4. Go to your first CASP file and scroll down until you find “VariantThumbnailKey”. Make sure the instance number is the same as your first thumbnail. In my case they line up, corresponding to the order seen in CAS.

5. Check the second CASP file now and find the “VariantThumbnailKey” again. Take down the instance number. In my case it is 0xCA32CCDCE12200C1.  Look at the IMG tags and find the instance number. For me it is the orange, blue and white strip thumbnail with shows up second in CAS.

6. Now we know where to look for the thumbnail as reference, we can start editing the order. Click and highlight the first CASP file again. Click the grid button at the bottom and it opens the Data Grid window. Fifth from the top is the entry “SecondarySortIndex”. This determines the order in which CASP files show up in CAS. However, when we clone items, this entry is all the same for each CASP file (in this case it is 0x000F). When this happens, the CASP file order is then determined by the CASP instance number which is why we are able to sort and find the items that way and why the items appear randomly in-game. It is an easy fix, if you know what you are doing.

You cannot replace the value with any number. The Sims games use hex values, and we need to do the same. They also need to be incremented (from low to high). We need to enter a number 0-9 or A-F, with numbers having a priority over letters. So, according to the method used to order items in the package file, we would use:
0x002(A-F)……… and so on

As Snaitf puts it, “So 0x0000000A is one higher than 0x00000009, and 0x00000010 is one higher than 0x0000000F.” That is the basic numbering order you need to know, now that is out of the way, let us continue.

7. So with the first CASP file, change 0x000F to 0x0000. Commit to the change which closes the popup.

8. Find the CASP for the clothing item you want in the second spot, highlight it by clicking on it, and then press the Grid button again. I know from the picture I took from CAS that the item I want to appear second is listed as the third CASP file. I want to move it to the second so I change the SecondarySortIndex to 0x0001. Commit to the change. 
You could also change the CASP files in order as you go down, using the screenshot we took initially as a guide, having the order you want them written down on paper with the corresponding value next to it. That helps when you have a lot of CASP files like me.
Continue until all of your SecondarySortIndex values are edited for your items. Save and exit s4pe. Place the edited file in TS4 mods folder and start up your game. Man, I love the fast load time for TS4.

9. Check your clothing item in CAS. They should all be ordered (and if they aren’t you need to go back and repeat for any that are not moved around). Now your inner perfectionist can breathe a sigh of relief and no longer torture you about swatches not being in order.


  1. Does this still work? I really want to do this some hair cc.

    1. Ordering hair is different to ordering clothing. This tutorial is also outdated as its not advisable to use s4pe for cas items as it can corrupt them. You best bet is to use s4s and look at the secondary swatch order number for the different hair colours and match them to yours. They need to be those specific numbers so the game can register the hair colour it is.