PDA

View Full Version : Script Modding: How to Access The Sims 4 Python Files


Zerbu
10th Sep 2014, 9:45 PM
1. Download Python 3.3.5 from here: https://www.python.org/download/releases/3.3.5

2. Install Python, and be sure to check “Add python.exe to path” when asked what specific features you want to install.

3. Download TheHologramMan’s edited version of unpyc3 from here: http://modthesims.info/showthread.php?p=4503727#post4503727 you must download the modified version, not the original, otherwise you’ll just get a bunch of errors!

4. Place unpyc3.exe in the same install directory as Python.

5. Download darkkitten30’s Python decompiler batch file. Follow the instructions on the page on how to set it up. http://modthesims.info/t/532644

6. Ensure you have the directories in the decompiler batch file set correctly, then run the program. You may get errors with some files, but if you followed the above steps properly, the majority of the files should decompile successfully. The files that don’t decompile cannot be modded, but as far as I know there’s nothing particularly interesting in them.

7. Uncompress the resulting ZIP files, and you’re ready to enter the world of script modding. :)

~MadameButterfly~
10th Sep 2014, 10:05 PM
Thank-you, very informative!

cwurts00
10th Sep 2014, 11:46 PM
There are many links to unpyc3 in that thread - which one is the modified version? Also, in what format do I place it in the python directory? The links lead to a webpage with text on it.

Zerbu
11th Sep 2014, 1:22 AM
There are many links to unpyc3 in that thread - which one is the modified version? Also, in what format do I place it in the python directory? The links lead to a webpage with text on it.

This one: https://raw.githubusercontent.com/figment/unpyc3/master/unpyc3.py

Just place the raw .py file in the directory you install Python.

cwurts00
11th Sep 2014, 2:19 AM
I followed the instructions above, and the three zip files appeared in C:\temp, but when these files are extracted, none of them can be read. I've tried editing them in IDLE, and I just get a blank space.

jcgurango
11th Sep 2014, 4:53 AM
All these steps are already detailed in other threads, such as the one I made on the tutorials forum, which is where stuff like this belongs in the first place.

cwurts00
11th Sep 2014, 6:17 AM
I now realize that the decompiled files are available on another thread, anyway.

yolanda8604
15th Sep 2014, 12:57 AM
1. Download Python 3.3.5 from here: https://www.python.org/download/releases/3.3.5

2. Install Python, and be sure to check “Add python.exe to path” when asked what specific features you want to install.

3. Download TheHologramMan’s edited version of unpyc3 from here: http://modthesims.info/showthread.php?p=4503727#post4503727 you must download the modified version, not the original, otherwise you’ll just get a bunch of errors!

4. Place unpyc3.exe in the same install directory as Python.

5. Download darkkitten30’s Python decompiler batch file. Follow the instructions on the page on how to set it up. http://modthesims.info/t/532644

6. Ensure you have the directories in the decompiler batch file set correctly, then run the program. You may get errors with some files, but if you followed the above steps properly, the majority of the files should decompile successfully. The files that don’t decompile cannot be modded, but as far as I know there’s nothing particularly interesting in them.

7. Uncompress the resulting ZIP files, and you’re ready to enter the world of script modding. :)



Can you tell exactly how to download his edited version of unpyc3.exe? I mean do I copy and paste it? how do i download that? it just goes to a webpage with a bunch of text

yolanda8604
15th Sep 2014, 12:59 AM
"""
Decompiler for Python3.3.
Decompile a module or a function using the decompile() function

>>> from unpyc3 import decompile
>>> def foo(x, y, z=3, *args):
... global g
... for i, j in zip(x, y):
... if z == i + j or args[i] == j:
... g = i, j
... return
...
>>> print(decompile(foo))

def foo(x, y, z=3, *args):
global g
for i, j in zip(x, y):
if z == i + j or args[i] == j:
g = i, j
return
>>>
"""

^Stuff like that is all I'm seeing

plasticbox
15th Sep 2014, 1:15 AM
I'm moving this to Tutorials since it's really step-by-step instructions .. Zerbu, let me know if you've got objections =)

breeluv
1st Oct 2014, 9:07 PM
"""
Decompiler for Python3.3.
Decompile a module or a function using the decompile() function

>>> from unpyc3 import decompile
>>> def foo(x, y, z=3, *args):
... global g
... for i, j in zip(x, y):
... if z == i + j or args[i] == j:
... g = i, j
... return
...
>>> print(decompile(foo))

def foo(x, y, z=3, *args):
global g
for i, j in zip(x, y):
if z == i + j or args[i] == j:
g = i, j
return
>>>
"""

^Stuff like that is all I'm seeing

Did you ever get an answer? I have the same problem.

Gardan
3rd Oct 2014, 6:49 PM
Did you ever get an answer? I have the same problem.

Guys, if you see that it means your browser is opening the file and displaying the text (like it does with HTML or text files). What you'll want to do is right-click the link to the file and select "Save as..." or "Save target as..." depending on your browser.

KeyEnPeyDee
28th Jan 2015, 7:49 PM
This one: https://raw.githubusercontent.com/figment/unpyc3/master/unpyc3.py

Just place the raw .py file in the directory you install Python.

How Can I download this? I don't get it :| :rofl:

plasticbox
28th Jan 2015, 7:56 PM
Have you tried reading the post directly above yours?

(Also, no offense, but if downloading a text file is already a challenge for you, I imagine you will find script modding a little .. unrewarding. Maybe try something more approachable first.)

BluebellFlora
4th Mar 2015, 5:40 PM
Just in case anyone wanted to do this for the Mac version of the game, EA used Python 2.7.9. At least that's the only version I could open without any error messages.

I'd love to delve into the Mac files but I just don't understand enough about Python to even attempt it.

federa
10th May 2015, 7:48 PM
I'm experiencing this error: AttributeError: 'SuiteDecompiler' object has no attribute '<69>'
My resulted .py files all only have a single line " *** Warning: file has wrong magic number *** "

What am I doing wrong? I am using TheHologramMan’s edited version of unpyc3...

Edit: OK, it turns out to be a Python version problem... I installed the newest 3.4, which seemed not to work. Now I'm mortified; I wasted a whole morning trying to figure this out...

tycox94
17th Jul 2015, 5:27 AM
A good note to be made here is that you need to run the batch file as an administrator...

bootoons
25th Mar 2017, 11:05 PM
I'm currently taking on online course to teach myself Python, but the Python version I have installed is 2.7. What would be the best way for me to go about this?

icemunmun
28th Mar 2017, 10:56 PM
I'm currently taking on online course to teach myself Python, but the Python version I have installed is 2.7. What would be the best way for me to go about this?

I think Python 3.3 is the version being currently used for sims 4 modding (if thats what you are interested in! ). Python 2.x is legacy but 3.x is the current one in development.

Link for Python 3.3 (https://www.python.org/download/releases/3.3.0/)

huong.le
16th Apr 2020, 11:24 AM
Hi guys!

May thanks for the informative post. I followed the given instructions, and at the end saw lots of files being generated. However, they are all PYC files and not the Python code. I also saw the core_src, base_src, and simulation_src, but the zips are all empty, with only folders and not a single Python file :-/ In addition, this error showed up often during the process: "\tmp\key: The system cannot find the file specified".

Could somebody tell me what I did wrong, please?

MizoreYukii
16th Apr 2020, 3:25 PM
Hi guys!

May thanks for the informative post. I followed the given instructions, and at the end saw lots of files being generated. However, they are all PYC files and not the Python code. I also saw the core_src, base_src, and simulation_src, but the zips are all empty, with only folders and not a single Python file :-/ In addition, this error showed up often during the process: "\tmp\key: The system cannot find the file specified".

Could somebody tell me what I did wrong, please?
This tutorial is really outdated. Follow this instead: http://sims4studio.com/thread/15145/started-python-scripting

huong.le
16th Apr 2020, 6:49 PM
This tutorial is really outdated. Follow this instead: http://sims4studio.com/thread/15145/started-python-scripting

Oh my god thanks a lot for the link! It worked like a charm for me! <3 <3 <3