atavisticbunny
New Member
I don't really use s4s because I honestly forget half the time
Posts: 5
|
Post by atavisticbunny on Jun 13, 2023 12:44:09 GMT -5
Nothing Opened how it says and somethings aren't the same its required to have a JB account which is only free for 30 days. I have to be doing something wrong could some explain this better to me. I want to learn to make script mods sort of like (how when you give birth it teleports you to the hospital) I want to make an attachment mod like that but not using that if anyone knows what I'm talking about.
|
|
|
Post by tadala27 on Jun 22, 2023 20:43:24 GMT -5
anyone to help me. I've been struggling with this error Traceback (most recent call last): File "D:\projects\Sims 4 Python Script Workspace\My Script Mods\Example Mod\example_mod.py", line 1, in <module> import sims4.commands ModuleNotFoundError: No module named 'sims4'.
I'm not sure where i went wrong
|
|
|
Post by waterbottle12 on Aug 2, 2023 1:28:13 GMT -5
If the code runs for you but nothing happens, it's most likely a path/naming problem. In my case, in settings.py the game_folder part was outdated. In the path from 'Program Files (x86)' it goes to 'Origin Games' but that doesn't even exist anymore lol, so I just made a folder in 'Program Files(x86)' named 'Origin Games' and copied 'The Sims 4' from 'EA Games' to the origin games file I made. There's of course other ways to solve this but this was just the simplest way for me. It's also probably obvious but I haven't seen anyone explain it here yet. ¯\_(ツ)_/¯
|
|
|
Post by o19 on Aug 2, 2023 6:19:42 GMT -5
Interesting approach to fix problems which are caused by unknown issues. It doesn't matter where the game is installed to and if you copy game files the copy will be outdated soon and cause other issues. Either code can be loaded and then it will run or one can find the issue in lastexception.txt. There is only nop() and/or sleep() code which runs and does nothing. If 'import sims4.commands' fails something is broken and one should repair the game, do a fresh installation or setup the IDE properly (if it is an IDE error) until it works. PS: As a new dev one may really want to use a script reloader (e.g. github.com/Oops19/TS4-ScriptReloader ) which allows to modify and/or add new code and execute it without restarting the game.
|
|
|
Post by waterbottle12 on Aug 3, 2023 15:14:10 GMT -5
Interesting approach to fix problems which are caused by unknown issues. It doesn't matter where the game is installed to and if you copy game files the copy will be outdated soon and cause other issues. Either code can be loaded and then it will run or one can find the issue in lastexception.txt. There is only nop() and/or sleep() code which runs and does nothing. If 'import sims4.commands' fails something is broken and one should repair the game, do a fresh installation or setup the IDE properly (if it is an IDE error) until it works. PS: As a new dev one may really want to use a script reloader (e.g. github.com/Oops19/TS4-ScriptReloader) which allows to modify and/or add new code and execute it without restarting the game. Hi, 'import sims4.commands' has been failing for me too as well as every other 'import' command and every other reference to the files. I get a "ModuleNotFound" error every time I try to run anything from the template. I assumed this was because of the way that I just made a new file named 'Origin Games' to try to replace it, but it uses the exact same path and everything is named exactly the same, so I'm not sure what the issue is? I tried downloading everything freshly and redo the entire process from the tutorial and still nothing changed. I would greatly appreciate some advice. BTW the script reloader you linked says 'Page not found' when you click it. At least for me!
|
|
|
Post by o19 on Aug 4, 2023 16:32:12 GMT -5
Did you run the decomppile_all.py script? Did you right-click on the 4 folders in EA folder with `Mark Directory as > Sources Root`? If the folders are not 'blue' PyCharm will not search for files in them. The image below '9.' shows them as blue while the text seems to be missing. You might need to delete 'enum.py' from one of these 4 folders if you get strange compile errors later. I'll punish the closing bracket for breaking the link to github.com/Oops19/TS4-ScriptReloader later. To use a script reloader create in 'The Sims 4/Mods' a folder 'waterbottle12'(or any other name) with a sub-folder 'Scripts' and place there 'example_mod.py' which should you should be able to reload with 'r example_mod'. If you compile the mod and create a .ts4script file you can't reload them. This is fine for final releases.
|
|
|
Post by waterbottle12 on Aug 5, 2023 3:32:35 GMT -5
Did you run the decomppile_all.py script? Did you right-click on the 4 folders in EA folder with `Mark Directory as > Sources Root`? If the folders are not 'blue' PyCharm will not search for files in them. The image below '9.' shows them as blue while the text seems to be missing. You might need to delete 'enum.py' from one of these 4 folders if you get strange compile errors later. I'll punish the closing bracket for breaking the link to github.com/Oops19/TS4-ScriptReloader later. To use a script reloader create in 'The Sims 4/Mods' a folder 'waterbottle12'(or any other name) with a sub-folder 'Scripts' and place there 'example_mod.py' which should you should be able to reload with 'r example_mod'. If you compile the mod and create a .ts4script file you can't reload them. This is fine for final releases.
Hi thank you so much for responding! Yes, decompile_all works fine. After I made the replacement file, it has no problem decoding and all the files are there it just can't seem to find them. I am very new to Python and importing files so I've never done this before. The four EA folders were grey so I tried adding them to the source root and it didn't change anything, I still got a "ModuleNotFound" error. This is what it says: ModuleNotFoundError: No module named 'Utilities'. I tried adding 'Utilities' to the source root as well and still nothing. I deleted the enum files, still nothing. The ones I got rid of had other things at the end of them so I assume it has to be exactly like 'enum.py'?? Which I didn't find any like that. Thank you so much for an explanation on how to use the script reloader!! I will definitely be using it once I get this to work! Like I mentioned I'm new to all this, is it possible that the issue has more to do with an unspoken step that most people know to do when importing files? Like with having to right-click the files and adding it to the root source?? I followed the tutorial exactly without changing or adding a single thing since I'm new, which is why I didn't do the source root step (I didn't even know you had to!!). I tried looking into if maybe I need to add the files somewhere else in PyCharm or even pip but I didn't really find anything. No step is too obvious, I really don't know!!!! I appreciate your help very much!!
|
|
|
Post by o19 on Aug 5, 2023 8:48:30 GMT -5
You might try to restart the IDE and/or choose 'File > Invalidate caches ...'.
If you click on EA > simulation > adoption and open adoption_commands.py - Does it display fine or does it also complain about missing imports? The adoption folder (all other folders in the source folders as well) should have a dot (color depending on View>Quick Switch Theme) as seen in picture below '9.'. My 'EA' folder doesn't have a dot, not sure why the image shows one.
The enum file is 'EA/core/enum.py' which should be deleted if compile errors occur.
|
|
|
Post by waterbottle12 on Aug 5, 2023 16:28:27 GMT -5
You might try to restart the IDE and/or choose 'File > Invalidate caches ...'. If you click on EA > simulation > adoption and open adoption_commands.py - Does it display fine or does it also complain about missing imports? The adoption folder (all other folders in the source folders as well) should have a dot (color depending on View>Quick Switch Theme) as seen in picture below '9.'. My 'EA' folder doesn't have a dot, not sure why the image shows one. The enum file is 'EA/core/enum.py' which should be deleted if compile errors occur. I did invalidate caches, nothing changed I still got a ModuleNotFoundError. But I wasn't sure which things to pick when it asked for specifics so I didn't pick any. All files say ModueNotFoundError No module named followed by the first one it sees. All the source files have dots on them, except for my EA folder as well. I found the enum file you meant and deleted it but still no change at all! Could the error maybe have something to do with the base files? Like the way I downloaded the sims or something? I really don't have a single clue what the issue is. Still, I appreciate your help!!
|
|
|
Post by o19 on Aug 6, 2023 3:49:32 GMT -5
The de-compile script should detect the TS4 install location properly (via windows registry while on Mac the default path is used) and copy 4 ZIP files into the project. There is little which can go wrong. Especially as de-compiling worked and the folders have been created. So the files are there but not found by PyCharm for unknown reasons. I tried it today again with W10/PyCharm 2023.2 (Community Edition): File > New Project Location "C:..\pythonProject123" [x] Previous interpreter: Python 3.7 (c:\...pyton37\python.exe) - Use Python 3.7 or you will encounter other issues. I use codeload.github.com/ColonolNutty/s4cl-template-project/zip/refs/heads/master (which is more recent than Andrews stuff and supports de-compiling of other mods, so you may download it). It will neither download S4CL nor install it. It was brought to my attention that some Discord owners ban users without notice if they have S4CL installed. Most of my mods use it as an abstraction layer as I have not too much ideas how TS4 handles things internally and I don't want to repair my mods all 4 weeks. My oldest mod is 2+ years old and didn't break for such a long time. It's up to use to use a documented API or to inject directly into TS4 methods. Open the zip file and the s4cl-template-project-master folder in it. Extract everything (5 files, 7 folders) to "C:..\pythonProject123" from above. In PyCharm run decomplie_scripts.py The 4 (base, ..., simulation) folders should already be blue. In Scripts/s4cl_sample_mod_scripts/ create test.py with the contents of 'Your first script mod'. I should not complain about missing imports. The supplied sample mod requires s4cl so it will complain about missing imports.
|
|
|
Post by waterbottle12 on Aug 7, 2023 17:30:59 GMT -5
The de-compile script should detect the TS4 install location properly (via windows registry while on Mac the default path is used) and copy 4 ZIP files into the project. There is little which can go wrong. Especially as de-compiling worked and the folders have been created. So the files are there but not found by PyCharm for unknown reasons. I tried it today again with W10/PyCharm 2023.2 (Community Edition): File > New Project Location "C:..\pythonProject123" [x] Previous interpreter: Python 3.7 (c:\...pyton37\python.exe) - Use Python 3.7 or you will encounter other issues. I use codeload.github.com/ColonolNutty/s4cl-template-project/zip/refs/heads/master (which is more recent than Andrews stuff and supports de-compiling of other mods, so you may download it). It will neither download S4CL nor install it. It was brought to my attention that some Discord owners ban users without notice if they have S4CL installed. Most of my mods use it as an abstraction layer as I have not too much ideas how TS4 handles things internally and I don't want to repair my mods all 4 weeks. My oldest mod is 2+ years old and didn't break for such a long time. It's up to use to use a documented API or to inject directly into TS4 methods. Open the zip file and the s4cl-template-project-master folder in it. Extract everything (5 files, 7 folders) to "C:..\pythonProject123" from above. In PyCharm run decomplie_scripts.py The 4 (base, ..., simulation) folders should already be blue. In Scripts/s4cl_sample_mod_scripts/ create test.py with the contents of 'Your first script mod'. I should not complain about missing imports. The supplied sample mod requires s4cl so it will complain about missing imports. I solved the problem???! I downloaded the template you sent and was going into PyCharm to open it, and I noticed while I was looking at all the files that I might've chosen the wrong version of Andrew's template?? The one I had opened originally was the one with 3.7 at the end of it, so I opened the one without it. While PyCharm was indexing it prompted me about the interpreter and I set it to 3.7. These were the only things I did at all, so I tried to compile this time and there were no issues! You were right about the sims that I copied to the folder being outdated so I just copied the recent version to the folder, tested it in the sims and everything worked perfectly!! It was all just an issue on my part and I feel so silly that I really didn't realize I had opened the wrong one. I'm sorry for any trouble I might've caused you, I still learned a lot through this and I especially learned to pay more attention to small details lol. Thank you so much for all your help regardless!! I greatly appreciate you helping me through this and being so patient, I was a little intimidated to ask for help at all lol. Today was my first day of senior year so I'm going to be really busy now, but if I ever make/upload anything I would love to credit you in some way if you'd like. I absolutely wouldn't have caught it without your help!!
|
|
|
Post by dorsalaxe on Nov 12, 2023 9:39:47 GMT -5
I'm looking to increase the level limit in the game so more floors can be built on a lot. I've found the below code in build_buy.py which I assume controls this. Am I on the right track? Any pointers on how I go about changing this to larger value? I've looked at tutorials, but mostly can only find stuff focusing on altering Sims or interactions which isn't proving to be super helpful for this task.
@staticmethod def get_highest_level_allowed(*_, **__): return 4
|
|
|
Post by sillehbee on Mar 24, 2024 17:46:43 GMT -5
Can anyone help me? 😭 I've read through as many of the replies as I can, and I still can't figure out how to resolve my issue.
I'm at the compile stage, and I get the error when trying to run compile.py that it's not finding Utilities.
PS C:\Users\Natalie\Documents\VS Code\Sims 4 Python Script Workspace> & C:/Users/Natalie/AppData/Local/Programs/Python/Python37/python.exe "c:/Users/Natalie/Documents/VS Code/Sims 4 Python Script Workspace/My Script Mods/Example Mod/compile.py" Traceback (most recent call last): File "c:/Users/Natalie/Documents/VS Code/Sims 4 Python Script Workspace/My Script Mods/Example Mod/compile.py", line 1, in <module> from Utilities import compile_module ModuleNotFoundError: No module named 'Utilities' So I attempted to follow what other users have said, and I moved settings.py and the entire Utilities folder into the mod folder, and then running compile.py. The issue is that even though the compile works afterward, it generates the script file as "sillehbee_Sims 4 Python Script Workspace.ts4script" inside of the root folder and the script also doesn't work in game.
Since the script file didn't work in game, I tried changing the extension to .zip to see what was inside it, and it was empty?
Can anyone help me? ):
|
|
|
Post by johnnyzest on Jun 23, 2024 21:02:31 GMT -5
Pycharm did not compile anything. I thought this may be a path issue, but cannot figure out how to change the path ad hoc, and there is also the possibility that the paths are fine, because they looked fine when I started the program. Why was no decompiling done?
|
|
|
Post by robotguy4 on Jul 9, 2024 1:14:03 GMT -5
Pycharm did not compile anything. I thought this may be a path issue, but cannot figure out how to change the path ad hoc, and there is also the possibility that the paths are fine, because they looked fine when I started the program. Why was no decompiling done? Did you buy the game on Steam? If so, the path for game_folder is different. Change the last line in settings.py to: game_folder = os.path.join('C:', os.sep, 'Program Files (x86)', 'Steam', 'steamapps', 'common', 'The Sims 4')
|
|