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 20th Mar 2018 at 1:08 AM
Default Custom Career TS4Script (i.e. Python) Question
How do you write/create a career Python script? I'm working on a custom career and have all of the xml files to create a career package, but can't seem to figure out where to find/how to make a career script. Thanks!
Advertisement
Field Researcher
#2 Old 20th Mar 2018 at 2:35 PM
Quote: Originally posted by dbclayton
How do you write/create a career Python script? I'm working on a custom career and have all of the xml files to create a career package, but can't seem to figure out where to find/how to make a career script. Thanks!


Do you have Python version 3.3 installed? If so;
- Copy and paste the .py file inside the Python install directory
- Open The command line module (Command Prompt on Windows, not sure about Mac)
- Type C://Python33/Python.exe -O
-Then import the .py file by typing import followed by the file name, so for example, import gobananas_Careers_Music.py
- A .pyo file will be generated inside a _pycashe_ subdirectory folder ( it’s in the same place where you put the .py file)
- Add the .py and .pyo file to a zip file and rename the file extension from .Zip to .TS4script

Twilightsims
Test Subject
#3 Old 20th Mar 2018 at 2:54 PM
Quote: Originally posted by GoBananas
Do you have Python version 3.3 installed? If so;
- Copy and paste the .py file inside the Python install directory
- Open The command line module (Command Prompt on Windows, not sure about Mac)
- Type C://Python33/Python.exe -O
-Then import the .py file by typing import followed by the file name, so for example, import gobananas_Careers_Music.py
- A .pyo file will be generated inside a _pycashe_ subdirectory folder ( it’s in the same place where you put the .py file)
- Add the .py and .pyo file to a zip file and rename the file extension from .Zip to .TS4script


Also it is worth noting to make a .TS4script you do have to turn off known extensions in a settings menu like this.

1. Click the Start menu. ... (for PC)
2. Type "folder options" (without the quotes). ...
3. A dialog box with the title "Folder Options" will appear. ...
4. Click to uncheck the box for "Hide extensions for known file types".
5. Click the "OK" button at the bottom of the dialog box.

without turning that off your TS4script is a .TS4script . zip file and it will cause Last Exception files in your game when loading.
Field Researcher
#4 Old 21st Mar 2018 at 7:58 AM
Quote: Originally posted by snowleopard__x
Also it is worth noting to make a .TS4script you do have to turn off known extensions in a settings menu like this.

1. Click the Start menu. ... (for PC)
2. Type "folder options" (without the quotes). ...
3. A dialog box with the title "Folder Options" will appear. ...
4. Click to uncheck the box for "Hide extensions for known file types".
5. Click the "OK" button at the bottom of the dialog box.

without turning that off your TS4script is a .TS4script . zip file and it will cause Last Exception files in your game when loading.


I actually updated my pc last night and had to do this!

Twilightsims
Test Subject
Original Poster
#5 Old 23rd Mar 2018 at 2:59 AM
Aaaaaand all of this is going over my head. Probably should have given up when I had trouble with the Python "for Dummies" book. Or after I spent four hours trying to follow these steps instead of starting my paper...
Test Subject
#6 Old 27th Apr 2018 at 7:51 AM
Quote: Originally posted by GoBananas
Do you have Python version 3.3 installed? If so;
- Copy and paste the .py file inside the Python install directory
- Open The command line module (Command Prompt on Windows, not sure about Mac)
- Type C://Python33/Python.exe -O
-Then import the .py file by typing import followed by the file name, so for example, import gobananas_Careers_Music.py
- A .pyo file will be generated inside a _pycashe_ subdirectory folder ( it’s in the same place where you put the .py file)
- Add the .py and .pyo file to a zip file and rename the file extension from .Zip to .TS4script


I'm completely new to all of this so this question is probably the stupidest question ever asked, but what in the world is the Python install directory and hooow on earth do I find / get to it?? I've looked everywhere and googled everything possible and have no idea what it is or how to get to it.
Test Subject
#7 Old 27th Apr 2018 at 9:18 AM
Quote: Originally posted by hectickitty1203
I'm completely new to all of this so this question is probably the stupidest question ever asked, but what in the world is the Python install directory and hooow on earth do I find / get to it?? I've looked everywhere and googled everything possible and have no idea what it is or how to get to it.


This post has some helpful information about where to start with python.
Test Subject
#8 Old 27th Apr 2018 at 9:20 AM
Quote: Originally posted by dbclayton
How do you write/create a career Python script? I'm working on a custom career and have all of the xml files to create a career package, but can't seem to figure out where to find/how to make a career script. Thanks!


What is your reason to make a python script? For most mods xml files are sufficient.
Back to top