magical_girl_sandbox: Inner Sailor Moon senshi triumphant after another fight. Tuxedo Mask took this picture. (Default)
2021-03-14 02:31 pm
Entry tags:

Sims 2: Modding SimPE Files with AutoIT

Modding SimPE files with AutoIT – V1.0: 03/14/2020


 ***WARNING: HIGHLY EXPERIMENTAL. USE AT YOUR OWN RISK!***

***For use with Windows OS only!***


After the relative success of figuring out how to automate creating Sims 2 files in Body Shop, I set out to try to automate SimPE too. It took me several tries, but through trial and error, I managed to cobble some working codes together. Here’s how it works: AutoIT can send keypresses to a program – for example, it could type some letters in a document without a physical person having to type those letters in the keyboard.

I noticed one day that you can move from panel to panel in SimPE using the tab key, and that the up and down keys could move the selection within the panel. This meant that I could create a script that would open a SimPE file, navigate to the correct panel, and make a change to the file. For example, I could have the script open the BINX resource in a Body Shop file and edit the sort index. I could then have the script do this same task for a large number of files.

The first step to getting started with your own industrial SimPE factory is to download AutoIT. Make sure you find your Au3Info program included with your AutoIT installation. You’ll probably also want to familiarize yourself with the syntax and some example scripts. I've also made a few example scripts for you to look at. Please feel free to copy and paste anything from them into your own code!


Commands you should know:

WinActivate([Window Name]) and WinWaitActive([Window Name]) will either activate the window you specify, or wait until it becomes active. I used the first command to activate SimPE (and make sure my script was only running on that window), while the second was for waiting for an open file window to open.

If/Then commands: Start your statement with If, type your required condition, and then type Then. Go to a new line, indent, and type the results if your condition is met. End the statement on an indented line by typing EndIf.

For loops: Similar to if/then statements, start the line with For $[variable] = [start] To [end]. Indent the commands in the for loop. End the for loop with an unindented line with Next.

Variables: They’re declared by the $ character. For example, $i. To get lists to work with Send commands, you may have to declare the list as a global variable as in Global $list = [1,2,3,…]. Calling out one item in a variable list is done by $list[position #]. For example, the second item in the list above would be called by $list[2].

; will comment out a line. It’s probably a good idea to use this to explain what you’re doing with a particular command. I should probably use it too, but I don’t because I assume I will remember what everything means months down the line and then I am always surprised when I don’t. Don’t be me.

Sleep([# milliseconds]) will make your script wait for that many milliseconds before you move onto the next command. Useful if your computer is a dinosaur and lags a bit.

ControlClick("[Window Name]", "", "[Panel Name]", "[type of click]") will click somewhere on a panel. For the type of click, “left” will cause a left click, and “right” a rick click. The panel name can be found by using Au3Info. I had trouble getting this to work right, so I used it sparingly.

Send([“key #”]) will send a keypress to the program, with # being the number of times to press the key. You can leave out the number if you’re only pressing a key once.

                Key list:

                {TAB} is tab

{ENTER} is Enter

{DEL} is the delete key (Not the backspace key!!)

{PGUP} is page up

{PGDN} is page down

{UP} and {DOWN} are the up and down arrow keys

+ is shift

^ is control

Examples of usage:

To get the program to save, you’d use the command Send(“^s”). To move to a panel two steps backwards, you’d use the command Send(“+{TAB 2”}).

You can use a declared variable in a Send command too! If you want a key to be pressed a number of times expressed by your variable, you’d use Send("[key]" & $[variable] & "}"). If you want a variable to be typed as is in the program, you’d use Send($[variable],1).


Tips and Tricks:

I had a lot of crashes and files get changed erroneously while trying to automate SimPE. Backup your Sims files before you run any script! Also, something to consider, you might want to add something like an if command/while loop that prevents keys from being pressed if SimPE/the file open windows are not active. I might add this to my stuff in the future.


Before you start a script, open up a file in the directory you need to change things in. Theoretically, you could use your tab commands to move into different directories, but this will get complicated. For simplicity’s sake, place everything you need in one directory.

When you open up your first test file, make sure you load 3IDRs (they take a while) and then click on the very top of the Resource Tree list (above 3IDR). Close your file and you should be good to run a script. When you run a script, assume your selection will start at this top spot. If you write your own scripts, have them end back at this spot, so that the next file can be navigated in properly.

When you add in swatches or image files, make sure they are also in the same directory and are in the same order as the files they correspond to.

In my example scripts, the $i variable refers to the number of SimPE files in the directory that I want to change. $j is a variable for the items within the Resource List panel.

The number of times you have to press tab to get to panels may vary depending on if you have the Resource Actions panel or other items open or not. This also may influence the panel number seen in the ControlClick command. Also note that sometimes tab doesn’t always take you in an order that makes sense. Test out how many tab presses it takes to get to items rather than just using the same numbers I used in my examples.

Having the scripts change more than one type of resource in a file wasn’t something I looked into, I wanted to keep things as simple as possible. Your mileage may vary.


That’s it for now: Go forth and create lots of Sims things! Don’t hesitate to reach out and ask questions if you need to!


magical_girl_sandbox: Inner Sailor Moon senshi triumphant after another fight. Tuxedo Mask took this picture. (Default)
2020-06-27 07:28 pm
Entry tags:

Sims 2: Creating Files with AutoIT

Creating Sims 2 Body Shop files with AutoIT – V1.0: 06/26/2020


 ***WARNING: HIGHLY EXPERIMENTAL. USE AT YOUR OWN RISK!***

***For use with Windows OS only!***

A few months ago, I discovered AutoIT, which lets you automate mouse clicks. This was an absolute lifesaver for me. I was just about to create a metric butt-ton of Sims eyes for my eye set, and I had plans to do all of my texture importing in SimPE, which meant I just wanted a bunch of plain exported eye files. I really didn’t want to sit at my computer for a couple hours, importing Body Shop files and slowly giving myself carpal tunnel.

For some programs, AutoIT can interact with the buttons, write text in text spaces, and otherwise use the program the way a user would. This wasn’t an option for Body Shop sadly; AutoIT doesn’t recognize anything in the window as interactable. I got around this by telling AutoIT to just make a series of mouse clicks in very specific locations. I modified a script by the creator of AutoIT, Jonathan Bennett.

Let’s get started! First, you’ll need to download the AutoIT program, as well as the script. You can use the exe installer or the zip files for AutoIT, it doesn’t matter. Once that’s done, find the program in the AutoIT folder called Au3Info, and open it.

 

Use the small arrow keys on the right side to find the “Mouse” tab. This is what you’ll use to determine the locations of the buttons in Body Shop.

 

Now open up Body Shop. MAKE SURE YOU DON’T MOVE AROUND THE BODY SHOP WINDOW DURING THIS TIME!! You’re finding the location of the buttons on your screen as a whole, not within the window, so moving Body Shop around will throw everything off!

Open up the AutoIT_CreateSimsFiles script. It should open in Notepad or another text editor. $num is the number of files you want to create. You’ll likely change this often. $X1 through $X6 and $Y1 through $Y6 are the locations in x and y coordinates of the buttons you want to press on your screen.

 

Head to the “Create Parts” screen on Body Shop. Click the “Finder” tool in your Au3Info window. Drag it to your Body Shop program, and release the mouse button when it’s over the “Load Saved Project” button. You should get a set of coordinates in the position field in Au3Info. Mine are 706 and 395. Your coordinates will be different! The first number is the x coordinate ($X1) and the second number is the y coordinate ($Y1). Type this into your script file.



Now head to the Load Project screen. Use the “Finder” tool again to determine the location of your top project (Go ahead and create one if you don’t have previous projects already!). The coordinates for this button are $X2 and $Y2.

While you’re still on this screen, find the location of the “Load Selected Project” button for $X3 and $Y3. Try to drag the finder to the middle of the button for this one.

Load the project, and press the “Import to Game” button. This button is in the same location as the load button, so you don’t need to worry about it. Once it imports, use the finder to find the location of the “Accept” button that comes up. This is $X4 and $Y4.

Click accept. Now find the location of the “Cancel” button on the next screen. This is $X5 and $Y5.


Click cancel, and find the location of the “Cancel” button on this screen for $X6 and $Y6.

After you click cancel again, you’ll be back on the “Create Parts” screen. You should have values for all of your coordinates now. Go ahead and type a 1 in for the $num variable. Save your text file! You can also close out of Au3Info now too.

 

Open up the AutoIT3 program. It will prompt you to choose a script to run. Navigate to here you’ve saved the AutoIT_CreateSimsFiles script, and click open. You should get a dialogue box with a “Yes” button and a “No” button. Before you click yes, make sure the next window open underneath the dialogue box is Body Shop.

Once you’ve clicked yes, TAKE YA HAND OFF THE MOUSE! Your cursor will automatically move itself. Note that there is a pretty large delay between mouse clicks, so wait a bit before touching anything. If everything goes according to plan, you should have just created one Sims file. Yay!

If for some reason it doesn’t work, check your coordinates. If you moved the Body Shop window at any point, your coordinates and clicks will be off.

You’re done with the hard stuff! You can now use your script to create any files you want. Just change the $num variable to the amount of files you want to create, and make sure the projects you want to import are in the top of the list in the “Load Project” screen. Once again, don’t move the Body Shop window at all, and don’t move your mouse while the program is running. You won’t be able to use your computer while this is going on, which is not fantastic, but you can go do other things. Read a book, take a shower, dismantle capitalism, knit a sweater! I once set up the script to create the files for my skin sets while I ran to class. Efficiency!

Let me know if you have any questions or run into any problems! 

 

Advanced Info

AutoIT uses a “Basic-like” coding language, but is fairly similar in syntax to other languages. Semi-colons (;) are your comment out characters, and dollar signs ($) are placed in front of variables to write them to memory or call them in.

I intentionally set the delay between mouse clicks to be large because my computer is a dinosaur. If you want to change this because your computer is either from the Precambrian or you stole it from NASA, scroll through the script until you find the code chunk starting with “; Execute the loop $num times”. You’ll see three lines that start with “AutoITSetOption”. Check out the number after "MouseClickDelay" in those lines. That’s the number of milliseconds (1/1000s of a second) you want to delay the following clicks by. I’ve set it to 1000 milliseconds (1 second) for the first click, 6000 milliseconds for the second through fourth clicks, and back to 1000 milliseconds for the final three clicks. Change these to whatever numbers you want.


Back to Navigation

magical_girl_sandbox: Inner Sailor Moon senshi triumphant after another fight. Tuxedo Mask took this picture. (Default)
2020-05-14 08:41 pm

Sims 2 Height Calculation Spreadsheet


Sims Height Calculator V1.0: 05/14/20


A lot of my real-life work involves Excel formulas and lots of data, so it's no surprise it's spilled over into my virtual life as well (you should see how I keep track of sim genetics...). Here's a little project I made up to help me calculate the stretch skeleton values that correspond to real-life heights. Here's how it works:

This is the main page of the spreadsheet. On the left are spaces for inputs and some quick lookups, and on the right are tables. This sheet is in the imperial system which I hate as a scientist.

Here's where you can configure things. The topmost box highlighted in yellow is where you can decide how tall your default adult sims will be. That means that a stretch skeleton value of 1.00 will correspond to however many inches you decide to throw in the box. I decided that my default sims will be 66 inches (or 5 feet, 6 inches). You are free to keep this or choose your own value.

Next, you've got a series of boxes underneath. You can type a real world height in and get what the equivalent stretch skeleton value would be. Top box is for elder, adult, young adult, and teen sims (remember that teen sims have a default stretch skeleton value of 0.94), middle box is for child sims, and bottom box is for toddler sims. You must type your real world height either as #'#" (with your number of feet followed by an apostrophe and number of inches followed by two apostrophes), or in simple number of inches. If you don't get a stretch skeleton value in the box next to it, you may have entered a real world value too far outside the bounds of a non-deformed sim skeleton, or your formatting may be wrong.

Please don't try to type anywhere but the yellow highlighted boxes. There's invisible equations hiding around, and Excel is fussy.

Underneath your input boxes, there's a section with the default height of ages other than adults. These values are automatically calculated, they're just here for your reference.

On the right of everything is the lookup tables. You can use these to look up heights, or you can just ignore them and use the auto-calculate boxes. Either way, just don't delete the tables or everything will break and Excel will scream at you.

Finally, if you check the tabs (bottom left) of the spreadsheet, you'll see the tab for the metric calculator. You can delete whichever sheet you won't use if you want, nothing will break.

Everything is pretty much the same as the imperial calculator, except for all the inputs and outputs are in centimeters and you don't have to fuss around with feet or inches. I envy you.

Let me know if you run into any issues or have any suggestions!


Download the calculator here!


Back to Navigation

magical_girl_sandbox: Inner Sailor Moon senshi triumphant after another fight. Tuxedo Mask took this picture. (Default)
2020-01-01 12:00 am

Sims 2 Stuff For Creators


For Creators: Mesh Bits, Recolorable Accessories, and Textures!
Latest Update: 07/01/2023


It's the first anniversary of this blog, so here's a special set of downloads! I don't know who else out there is making sailor characters, but if you're a mesher and you want to play with some of the meshes I've made, here they are! All of the mesh pieces and parts are provided as Milkshape and .simpe files. I separate out each piece of my senshi meshes (gloves, collar, bows, etc.), so I can easily recombine them if another mesh calls for them. It makes making a whole bunch of different senshi meshes easy. I also included some versions of my accessory meshes as .package files that can be recolored in Bodyshop -- I usually recolor them there and then use Wardrobe Wrangler to make them into BV jewelry. You'll need the corresponding meshes in order for them to show up.

All of these mesh bits are provided as is. I think most of them should be correctly mapped, fat-morphed, and bone assigned, but sometimes (a lot of times) I make mistakes. Use at your own risk!

Other than using with caution, these as yours to do almost whatever you want with! I just request that you don't use anything for pay/donation sites. If you want to drop a link back to me after you've uploaded your creations, please do! I'll also be uploading/editing these files over time as I create more things.


Some examples of the files included in these downloads.

Downloads:
Mesh Parts
Recolorable Accessory Files

Eye textures (.png) for recoloring


Back to Navigation

magical_girl_sandbox: Inner Sailor Moon senshi triumphant after another fight. Tuxedo Mask took this picture. (Default)
2019-09-14 04:06 pm
Entry tags:

Resources: GIMP


GIMP Hue-Chroma Presets


Nothing too fancy here -- just the tints I used for my giant skin set!

These require GIMP, but you could probably recreate them in other image processing programs since they're so simple. All they do is shift the Hue and Saturation for an image. Not quite on the same level as curves, but they work well for Sims skins. Included is Sienna (saturated red tint), Minium (desaturated red tint), Umber (desaturated tint), Orpiment (saturated orange tint), Aureolin (saturated gold tint), Ocher (desaturated gold tint), and Azurite (blue/purple tint).



New: 4/30/2021 -- Diatomite Tint!

I use this for my blonde hair default on Volatile.

To use: Download the file(s) and extract to somewhere on your computer that you can browse to easily. Open up GIMP, and go to Colors > Hue-Chroma.



Click the little arrow in a box on the far right of the pop-up window. Then choose "Import Current Settings from File".



Browse to where you put the tints, select the one you want, and you're good to go! You can also save your own preset version of the tint in the same pop-up window (click the plus to the left of the arrow in the box). 


Download the skin tints here!
Download Diatomite Hair Tint here!


Back to Navigation

magical_girl_sandbox: Inner Sailor Moon senshi triumphant after another fight. Tuxedo Mask took this picture. (Default)
2019-09-14 03:38 pm

Sims 2 Streamlining Skin Defaults Tutorial


Streamlining Skin Defaults – V1.1: 08/09/20


*** Note: This tutorial is for folks who have done skin defaults before and are familiar with SimPe. Check out this tutorial if you are just starting out with defaults!
*** Note 2/Disclaimer: Backup the files you’re working with before starting this tutorial – there’s a chance you can delete the wrong file part and things can get borked.
*** Note 3: This has been done similarly here, but with the TXMTs pointing to the TXTRs for another file entirely (which means you have to have non-defaults for the defaults to work correctly). Mine doesn’t have this requirement, but it’s the same method.

Alright, so I’ve been playing about with skin defaults for the past few days, and I’ve managed to find a way to reduce the number of images you need in your files. Let’s start by taking a look inside a typical skin default file…



You’ve got your TXMTs and your TXTRs. Some skin default files don’t have TXMTs included – if that’s the case, find yourself a different default set to use as a base.

Now consider what image files you are using to build your own default. For my defaults, I had all my ages share a face (except babies and elders), and I had teens (and elder men) share textures with the respective adults. Everybody also shares a hair texture. However, when I look at the TXTRs in this default file, I see that teens have their own bodies and every age has their own face. That seems a bit redundant.

Start fixing this by going into a TXMT. I’ll use amface_s1_txmt:



You’ll notice that under the stdMatBaseTextureName property (Properties tab, Plugin View section) you’ve got a “value” of amface-s1. That’s the name of the TXTR that is being used for adult male sims’ faces. If we want all adults, regardless of gender to share a face, we can set this value to point to the afface-s1 TXTR (it isn’t essential that it be afface, I just chose it because it’s the first face in the list). Simply change amface-s1 to afface-s1 and commit the TXMT.



Next, go into your File List tab. You’ll see amface-s1 there as well, so change that to afface-s1 too, and commit.



Now no TXMT is using the amface-s1 TXTR. You can safely delete it from the file.



Repeat for every age and gender that you would like to have pointing to a different TXTR. Note that there’s a TXMT for tops, bottoms, and full bodies. All three of these will automatically be pointing to the same TXTR. Change all of them if you need to change one! Also note that tfface is already pointing to afface, and there’s no TXTR for tfface (which is how I figured this whole thing out!).



Another note:  if for whatever reason you want to change the name of a TXTR, (idk, I changed my afface, which was being used by all ages to be named uuface) make sure to press fix TGI! You’ll get the dreaded missing texture alphabet soup of doom if you don’t!




Once you’ve set the TXMTs to point to the correct TXTRs, you are set to start importing your image files as normal. Hopefully, this technique will help you reduce redundancy and your file size!

*** Misc. things: You can use this technique with Phaenoh’s correlated skin defaults to a degree. For Blond, Black, and Red hair defaults, everything works pretty much as stated above, just ignore the 3IDRs and all that and remember you don’t have TXTRs for elders. For Brown hair defaults though, this doesn’t work as there’s few TXMTs in the files. I tried creating some, but it didn’t work.

Edit - August 2020: If you go spelunking in the Catalog/3D files, you can sometimes find extra TXMTs to add to the file. Adding them in and then doing the rest of the tutorial as usual will work!
Also confirmed: You can add in extra TXTRs. Don't forget to fix TGI!


Don’t be afraid to experiment!! (after backing up your files!!)


Back to Navigation