Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Test Subject
Original Poster
#1 Old 15th Sep 2014 at 4:41 AM Last edited by ThatUsernameGuy : 21st Sep 2014 at 4:25 AM.
Default Python Script Decompiler (Version 1.1) (Written in Python)
This is a Python decompiler for Sims 4, run it in the same folder as the python code you wish to decompile and it will decompile it. If any further help is needed refer to the readme or leave a comment below. (You should read the readme regardless.)

Requirements:
Python 3.3

WARNING: I recommend you make backups of any files sharing a directory with this script. I am not liable for any damage caused.


Version 1.5.6 includes a folder called compileBox, which will compile an .py files inside it when the "compile.py" script is ran.
- Make sure not to leave important .pyo files in there or they will be erased.
- As for now, files with more than 15 characters (Not including the extension.) in their name will be cut to that point. (Don't know how this works or how to fix it, Python's decompileall module works in silly ways.)

Version 1.5.6 (As of 3:12 on Sunday, September 21, 2014 - UTC) has fixed the first bug. Previous to this patch I had forgotten to put input() at the end of the script, meaning the Python window would close when the script finished, preventing you from seeing the variables listed and any errors the program encountered.
- The script should have a fair few scripts that didn't decompile, this is due to "unpyc3.py" not being able to decompile them and cannot be fixed within my own script.
Attached files:
File Type: zip  pyDecompileVer1.5.5.zip (16.0 KB, 196 downloads) - View custom content
File Type: zip  pyDecompileVer1.5.6.zip (16.6 KB, 1468 downloads) - View custom content
5 users say thanks for this. (Who?)
Advertisement
Test Subject
#2 Old 15th Sep 2014 at 5:46 AM
While I cannot say for sure, you are not doing anything with the output of the unpyc3.decompile string. unpyc3 does not write to any files by default and when run from command line just outputs to stdout. Maybe you want to open a file and write the string to it? What would be useful in general if you are going to do this is probably read the zip files directly; get the file structure from that and output the contents to a folder . Or use os.walk and recursively walk through the pyo files and write the py files or something.
Scholar
#3 Old 20th Sep 2014 at 10:31 AM
I used your script and decompiled successfully. Now I found an interesting thing in file Simulation\Sims\Housholds.py:

MAXIMUM_SIZE = Tunable(int, 8, description='Maximum number of Sims you can have in a household at a time.')

I like to increase the number of sims on a lot from 8 to 10. How do I do that? Lots of tutorials on decompiling but compiing but not the opposit.

Found this but.....?
https://docs.python.org/3/library/p...l?highlight=pyo
Mad Poster
#4 Old 20th Sep 2014 at 1:43 PM
There is an XML on that. I might suggest tuning the Xml number first, and see if it works or not. It's ten times simpler than using Scripting to do the exact same thing.

MedievalMods and Sims3mods: Dive Cave Reset Fix, Resort Revamp, Industrial Oven Revamp, Will O' Wisp fix, UI Sounds Disabled, No Cars, Gnome Family Planner, Townies Out on the Town, No Martial Arts Clothes, Fast Skilling, etc. http://simsasylum.com/tfm/
Scholar
#5 Old 21st Sep 2014 at 12:13 AM Last edited by Morphar : 21st Sep 2014 at 12:30 AM.
Quote: Originally posted by Shimrod101
There is an XML on that. I might suggest tuning the Xml number first, and see if it works or not. It's ten times simpler than using Scripting to do the exact same thing.


I was just out for the correct syntax of the compile command so a bad example by me. I found an answer in another thred. Someone just asked the same thing:
http://modthesims.info/showthread.php?t=535142

So if I compile that .py file, zip it and place the zip-file in the Mods directory will override the orginal funktion?
Test Subject
Original Poster
#6 Old 21st Sep 2014 at 2:20 AM
Quote: Originally posted by Morphar
I was just out for the correct syntax of the compile command so a bad example by me. I found an answer in another thred. Someone just asked the same thing:
http://modthesims.info/showthread.php?t=535142

So if I compile that .py file, zip it and place the zip-file in the Mods directory will override the orginal funktion?


Sorry for not getting back to very quickly. If you check, the newest update comes with a compile script. It may be of use as is, or to dissect for it's code. As for how Sims 4 handles mod code, I'm not entirely sure. I have no experience with the game itself yet. You might have luck asking some of the script modders on the site, as can be found here: http://modthesims.info/browse.php?f...gameOrig=1&gs=4
Test Subject
#7 Old 27th Sep 2014 at 7:51 PM Last edited by Gh0st_wires : 27th Sep 2014 at 9:34 PM.
it doesn't seem to decompile anything useful. i only got 2 .py files out of it and there is nothing interesting i can derive from them. This may seem weird but im just running it in a virtual env on my linux machine. I haven't look at the code yet i just ran it. Is there something in your code that would prevent me from running it in the way im running it.
Test Subject
Original Poster
#8 Old 2nd Oct 2014 at 2:58 AM
Quote: Originally posted by Gh0st_wires
it doesn't seem to decompile anything useful. i only got 2 .py files out of it and there is nothing interesting i can derive from them. This may seem weird but im just running it in a virtual env on my linux machine. I haven't look at the code yet i just ran it. Is there something in your code that would prevent me from running it in the way im running it.


Not that I know of, but I don't run Linux or a virtual OS, so I wouldn't know. The script was written so as not to exclude any particular operating system or file system, but testing is limited to my personal computer, which runs Windows 7.
Back to top