(Warning: Possibly Image Heavy)
Part 05: Reimporting Your Recolors.
(Previous Parts)
Part 02: Exporting Your Packages!
Things That Are Needed for This Section.
So, although perhaps not quite as time-consuming as the recoloring process, the SimPE reimporting requires more input and thus more complex scripts in order to automate seamlessly.
You should begin this part of the tutorial with your exported, renamed package files and your recolored pngs. Make sure that the renamed packages and the pngs are in a folder together first of all. Then open both SimPE and Sikuli IDE. This section will go over using the two programs to combine the two files into a complete, nearly finished product.

Start a new Sikuli script. Hit "Click". (Make sure, as with the other two tutorials, that you actually click the things you tell Sikuli to click after adding them to the script.)

Next, hit "doubleClick" and select the name of your first recolor as it appears in the window. Make sure to sort your explorer by "list" to ensure that all of the color names are visible at the same time. Also, I should state that I'm doing Planetary here because I messed up showcasing this tutorial using Spacecraft. /o\

Next, using Sikuli, use the "click" command and highlight the "Texture Image (TXTR)" text on the left side of the screen. Don't include the little number in parentheses, as this number will change occasionally and confuse Sikuli.

Most of the time, as aggravating as it seems, your hair will contain multiple image files. Most hair creators nowadays will overwrite the image of the group they use, meaning that if their hair has a group called "hairalpha5", only the image that corresponds to that name will contain the actual hair texture. The rest, to save space, will often be small black boxes, meaning that those textures aren't actually used by the hair.
There are two ways to overcome this problem; either open the actual hair texture and overwrite all of the black boxes so that SimPE compresses them into one image (as SimPE will discard any duplicate images) or write a script that utilizes "if" and "else" commands. For the purposes of this tutorial, I will be showing you how to set up a script to use those commands.

First off, hit "click" again and select one of the "_txtr" endings. Make sure not to include any of the number to the left or any of the line underneath.

Your selection should look like this; small, but readable by the program. Now we get into the trickier stuff.

There are no shortcuts to a lot of Sikuli's commands, so you'll have to rely on previous knowledge of Python scripting, or just kind of screw around until you figure out what words do things in the command line. On line 5, put the command "if exists". Then hit enter to get down to line 6 and hit the "click" command on the left side of the program once more.

When you click on your txtr file in SimPE, it should show an image similar to this in the plugin viewer. This is the texture image with the alpha applied to make it transparent. Anyways, tell Sikuli to click on a portion of the checkered, transparent background. Don't make your selection too big, as there are some hairs have very little transparency.

The whole point of this is to just take a capture of the transparent space. You don't really want Sikuli to click on it; rather, backspace the "click" command from the script until the capture is right next to "exists" on line 5. Then, make sure that the only colon on this line is right at the end.

You should notice that pressing enter at the end of line 5 will automatically create an indent in line 6. This is because all of the proceeding lines are now a part of what is essentially a script within a script, and the lines won't be recognized as such unless they are indented a specific amount. On the indented line 6, type "rightClick" and copy the picture from line 5 so that your script looks like this.

Next, hit click again. You'll need to utilize ninja speed again to right click on the image in SimPE before the capture screen comes up, as you need to take a capture of the "Build DXT..." text.

If you have the Nvidia DDS Utilities installed properly, you should get a cute little dds window that pops up. Go back to Sikuli, hit click, and select a wide area around the blue "open" text on this window. You should try to capture a little piece of the "Image" text as well, as this helps Sikuli find "open" a little easier.

Now, copy line 2 to line 9. Make sure line 9 maintains the indent of the previous few commands.

Now tell Sikuli to click the "Build" button. On line 11, type wait(1) to make sure the program has enough time to, y'know, build.

Next, tell it to click commit to save the changes made to the package.

And finally, tell it to click the little floppy disk save button so that the changes are saved to the package itself.
The script is pretty much done, but as I talked about before, sometimes you may have trouble with a hair having multiple images, and putting in the following commands will help expand the usability of this script in case you come across one of said hairs.

On line 14, make sure that you backspace to the front of the line. Then type "else:".

The next part is simple; copy line 4 and everything between line 6 and line 14 underneath it. Do not copy the "if exists" line. Do not copy the else line itself.

The final step in this script is to add a "click" command at the end with no indentation that will click the icon that represents "new document" in SimPE. I feel like this step, although certainly not necessary, makes the whole process seem a bit cleaner.

You should end up with a script that looks, in its entirety, like this.
To explain the "else" concept, basically, like I've said, you may come across some hairs with multiple textures. This addition to the script will tell the script to first click on _txtr, then try to locate the image based on the capture of the checkered background. If this capture is found, the script will proceed as normal. If it's not found, the script will click on the other _txtr, thus proceeding normally without stopping.
As with the Photoshop Recoloring tutorial, the next step is to copy this script one time for each recolor you plan to make, and change the captures of the color names to match your other colors. See the end of the Photoshop Recoloring tutorial for specifics on this, although I feel it's pretty easy to understand. :)
Part 05: Reimporting Your Recolors.
(Previous Parts)
Part 02: Exporting Your Packages!
Things That Are Needed for This Section.
- Sikuli IDE 1.0.1. 1.1.0 will not work for this.
- SimPE with Nvidia DDS Utilities.
You should begin this part of the tutorial with your exported, renamed package files and your recolored pngs. Make sure that the renamed packages and the pngs are in a folder together first of all. Then open both SimPE and Sikuli IDE. This section will go over using the two programs to combine the two files into a complete, nearly finished product.

Start a new Sikuli script. Hit "Click". (Make sure, as with the other two tutorials, that you actually click the things you tell Sikuli to click after adding them to the script.)

Next, hit "doubleClick" and select the name of your first recolor as it appears in the window. Make sure to sort your explorer by "list" to ensure that all of the color names are visible at the same time. Also, I should state that I'm doing Planetary here because I messed up showcasing this tutorial using Spacecraft. /o\

Next, using Sikuli, use the "click" command and highlight the "Texture Image (TXTR)" text on the left side of the screen. Don't include the little number in parentheses, as this number will change occasionally and confuse Sikuli.

Most of the time, as aggravating as it seems, your hair will contain multiple image files. Most hair creators nowadays will overwrite the image of the group they use, meaning that if their hair has a group called "hairalpha5", only the image that corresponds to that name will contain the actual hair texture. The rest, to save space, will often be small black boxes, meaning that those textures aren't actually used by the hair.
There are two ways to overcome this problem; either open the actual hair texture and overwrite all of the black boxes so that SimPE compresses them into one image (as SimPE will discard any duplicate images) or write a script that utilizes "if" and "else" commands. For the purposes of this tutorial, I will be showing you how to set up a script to use those commands.

First off, hit "click" again and select one of the "_txtr" endings. Make sure not to include any of the number to the left or any of the line underneath.

Your selection should look like this; small, but readable by the program. Now we get into the trickier stuff.

There are no shortcuts to a lot of Sikuli's commands, so you'll have to rely on previous knowledge of Python scripting, or just kind of screw around until you figure out what words do things in the command line. On line 5, put the command "if exists". Then hit enter to get down to line 6 and hit the "click" command on the left side of the program once more.

When you click on your txtr file in SimPE, it should show an image similar to this in the plugin viewer. This is the texture image with the alpha applied to make it transparent. Anyways, tell Sikuli to click on a portion of the checkered, transparent background. Don't make your selection too big, as there are some hairs have very little transparency.

The whole point of this is to just take a capture of the transparent space. You don't really want Sikuli to click on it; rather, backspace the "click" command from the script until the capture is right next to "exists" on line 5. Then, make sure that the only colon on this line is right at the end.

You should notice that pressing enter at the end of line 5 will automatically create an indent in line 6. This is because all of the proceeding lines are now a part of what is essentially a script within a script, and the lines won't be recognized as such unless they are indented a specific amount. On the indented line 6, type "rightClick" and copy the picture from line 5 so that your script looks like this.

Next, hit click again. You'll need to utilize ninja speed again to right click on the image in SimPE before the capture screen comes up, as you need to take a capture of the "Build DXT..." text.

If you have the Nvidia DDS Utilities installed properly, you should get a cute little dds window that pops up. Go back to Sikuli, hit click, and select a wide area around the blue "open" text on this window. You should try to capture a little piece of the "Image" text as well, as this helps Sikuli find "open" a little easier.

Now, copy line 2 to line 9. Make sure line 9 maintains the indent of the previous few commands.

Now tell Sikuli to click the "Build" button. On line 11, type wait(1) to make sure the program has enough time to, y'know, build.

Next, tell it to click commit to save the changes made to the package.

And finally, tell it to click the little floppy disk save button so that the changes are saved to the package itself.
The script is pretty much done, but as I talked about before, sometimes you may have trouble with a hair having multiple images, and putting in the following commands will help expand the usability of this script in case you come across one of said hairs.

On line 14, make sure that you backspace to the front of the line. Then type "else:".

The next part is simple; copy line 4 and everything between line 6 and line 14 underneath it. Do not copy the "if exists" line. Do not copy the else line itself.

The final step in this script is to add a "click" command at the end with no indentation that will click the icon that represents "new document" in SimPE. I feel like this step, although certainly not necessary, makes the whole process seem a bit cleaner.

You should end up with a script that looks, in its entirety, like this.
To explain the "else" concept, basically, like I've said, you may come across some hairs with multiple textures. This addition to the script will tell the script to first click on _txtr, then try to locate the image based on the capture of the checkered background. If this capture is found, the script will proceed as normal. If it's not found, the script will click on the other _txtr, thus proceeding normally without stopping.
As with the Photoshop Recoloring tutorial, the next step is to copy this script one time for each recolor you plan to make, and change the captures of the color names to match your other colors. See the end of the Photoshop Recoloring tutorial for specifics on this, although I feel it's pretty easy to understand. :)
tags: