MTS has all free content, all the time. Find out how YOU can help to keep it running. Tell me how...

Tuning Error Notifier v2

by scumbumbo Posted 26th Feb 2019 at 8:40 AM - Updated 22nd Apr 2019 at 6:32 PM by scumbumbo : Version2 - Added REBUILD_INVALID_XML option
23 Comments / replies (Who?) - 14 Feedback Posts, 8 Thanks Posts
This is a utility for modders and not intended for use by players.

April 22, 2019 - Version 2 released: - Added the REBUILD_INVALID_XML option. Be sure to read the documentation on that below if you're upgrading the mod to familiarize yourself with it.

Description

Tuning mods can be a complex business, and frequently small errors are introduced to the XML when it is written or occur when the game is patched and the XML syntax changes unnoticed. These errors are logged to the Tuning log file (and you can get that file using the Sims Log Enabler); however, I have found that there are so many mods that have so many errors that it is difficult to see when one of my own mods has developed an error.

Many of these errors can be easily missed and are virtually unnoticeable without extensive testing. Many don't actually affect the game play at all, but could cause problems later with a future game patch. Ideally they should all be fixed, but with the previously mentioned issue of the Tuning log file being full of errors from other mods it's easy to just ignore the minor issues until they eventually become big problems.

The Tuning Error Notifier addresses the issue by allowing you to set a filter of what tuning names to watch out for, and when it notices an error generated by one of those XML tunings it notifies you when the first lot is loaded in the game and can prepare an easily readable HTML report which includes only those errors from the mods you are watching. Once you've taken care of everything the script sits quietly in the background, unnoticed until the next error occurs when again you will become quickly aware of it from a fresh notification.

The following information is included in the ReadMe text file in the download, so you can read this here or there (but not anywhere -- I mean, you can hardly expect me to put this information just anywhere for your own convenience. I'm not about to break into your house as you sleep and slip a copy of it under the alarm clock on your nightstand for you to read bright and early when you wake up. Nor do I intend to tattoo it onto the head of that bald guy you'll be riding behind on the subway to get to work tomorrow.)

I mean those things would be illegal, or at the very least weird, time-consuming and expensive for me.

I won't put this information into the newspaper for you to read over your morning coffee.

Just be satisfied that you can read it here or there, thank you very much.

Oh, I've also included a PDF file that includes three real-world examples of some of these tuning errors from my own mods, how I located and fixed those errors, and what effect they had on the game play.

Installation

Basically, install it like any other script mod for The Sims 4.

That said, there are a couple of options you can set. To set them you will need to extract the __init__.py file from the ts4script file and edit the values near the top of that script.

I've uploaded a fairly comprehensive how-to tutorial of how to edit these values for those not familiar with Python scripting. You can find it in message 5 of the feedback thread for this mod.

After changing the options, you should replace the __init__.py file in the ts4script with your changed version. It MUST be in the same location, the tuning_error_notifier subfolder of the zip file, in order to function. Recompiling the script should be optional, as the game prefers to load script mods from the source files if both .pyc and .py files are included in a script file.

REBUILD_INVALID_XML Option

Set this to True (default) to override several game functions which parse XML input allowing them to rebuild the XML and output the portion with the error to the log files. This makes it easier to locate certain XML errors which may otherwise be difficult to locate from the game's normal error logging.

The errors which rebuild the XML include:
  • Incorrectly matched tuning types in
    • the ETreeTuningLoader
    • TunableTuples
    • TunableVariants
    • TunableCollections (e.g. lists)
  • Invalid list elements in _TunableCollections

NOTE: Although no errors with these overrides have been reported, it is possible that some rare issues could possibly occur. The code seems to work identically to the EA scripts; however, as it is based on the decompiled game code there could be a currently unnoticed error. To be absolutely safe it may be best to turn this option off except when you need it to locate an invalid tuning.

FILTER_TEXT_LIST Option

Set this to a list of strings which should be compared to tuning instance names to check. The default is a single blank string, which will match all instance names and produces a report containing all tuning errors the game reports.

The strings are not case sensitive.

For example, setting FILTER_TEXT_LIST = ['sc', 'bo'] would match instance names such as:
  • MTS_Scumbumbo_blah_blah
    'sc' and 'bo' both match
  • BOBOS_BOTCHED_Interaction
    'bo' matches
  • SCmods_buff_DingoParty
    'sc' matches
Personally, I just use FILTER_TEXT_LIST = ['scumbumbo'] myself, as I include my name in each mod tuning I write.

EXCLUDE_TEXT_LIST Option

Set this to a list of strings which should be compared to tuning instance names to exclude from checks. The default is an empty list, which will produce a report containing all tuning errors the game reports.

The strings are not case sensitive.

Be sure, if later turning this feature off, that the list is empty [] and not an empty string [''] like you would use for FILTER_TEXT_LIST. An empty string will match everything and then all tunings will be excluded!

USE_DIALOG_ALERT_FOR_ERRORS Option

The default is False which will cause the notifier to issue a notification on the game notification wall when the first lot is loaded if any tuning errors were seen and matched. A button will be available on the notification to launch a report of errors in your system's default web browser.

If set to True, then a modal dialog alert will be issued instead. This pauses the game and forces you to make the choice whether to open the report (OK button) or ignore the errors on this game load (Cancel button).

In either case the alert will only be displayed when the first lot is loaded on a game run.

REPORT FILE

The HTML report is saved in your system's temporary files folder and removed when the game exits. If you want to retain the report for reference you can print it or use your web browser to save that file to your Desktop or another location. Don't just save a bookmark, as the file will be gone after the game exits!

COMPATIBILITY WITH SIMS LOG ENABLER

The Tuning Error Notifier is reporting the same errors that would be in the Tuning.log if you use Sims Log Enabler. It will function properly with or without the log enabler installed; however, the log enabler can disable the notifier if Sims Log Enabler loads AFTER the Tuning Error Notifier as it will overwrite the changes to the Logger.error() method that the notifier makes.

To ensure that both work properly, you should make sure that Sims Log Enabler runs FIRST. This can be fairly easily assured if you name the sub-folder for the log enabler to start with an 'A' character as scripts load in alphabetical order. I use "A Sims Log Enabler" for my log enabler sub-folder to ensure that it loads before any other mods and that logs will start working very early in the mod-loading process.

Making the log enabler load early is a good idea in any event, so that logging will begin occurring as soon as possible in the loading sequence.

Kn0WN bUGs

There are no real known bugs to be aware of; however, I am never surprised when bugs are found! If you do notice something, please let me know on this mods download thread on Mod the Sims or my Discord server in the #scumbumbo-mods channel.

https://discord.gg/29qKsBg

Credits

Thanks for the modders on my Discord server who have tested this and been highly receptive to how it works and its usefulness. In particular LittleMsSam who encouraged me to write the examples PDF documentation!

You must have the expansion, game version or stuff packs listed below installed to use this custom content. Please see the post text for any exceptions.

Sims 4
Built with Game Version: 1.51.75
Key: - File was updated after upload was posted
Filename - Tip: You can click the magnifying glass to see the archive contents Size Downloads Date
Tuning Error Notifier.zip | Tuning Error Notifier Utility for TS4

Size: 716.9 KB · Downloads: 1,853 · 22nd Apr 2019
716.9 KB 1,853 22nd Apr 2019
Don't forget to Thank the creator after downloading! Use the Thanks button located above the screenshots above.
Basic Download and Install Instructions:
1. Download: Click the File tab to see the download link. Click the link to save the .rar or .zip file(s) to your computer.
Read the upload description for installation instructions. If nothing else is specified, do the following:
2. Extract: Use WinRAR (Windows) to extract the .package file(s) (if included, ts4script as well) from the .rar or .zip file(s).
3. Cut and paste the .package file(s) (if included, ts4script as well) into your Mods folder
  • Windows XP: Documents and Settings\(Current User Account)\My Documents\Electronic Arts\The Sims 4\Mods\
  • Windows Vista/7/8/8.1: Users\(Current User Account)\Documents\Electronic Arts\The Sims 4\Mods\

Need more information?
  • Anyone can use both .rar and .zip files easily! On Windows, use WinRAR.
  • If you don't have a Mods folder, just make one.
  • Mod still not working? Make sure you have script mods enabled
 
23 Comments / Replies (Who?) - 13 Feedback Posts, 8 Thanks Posts
Hide Thanks Posts for this thread (Show only feedback)
Lab Assistant
THANKS POST
#2 Old 26th Feb 2019 at 8:47 AM
Thanks for this and to LillteMsSam for highlighting the beta version on your discord channel. Great work as always.
Deceased
Original Poster
#3 Old 26th Feb 2019 at 8:56 AM
Indeed, her feedback was most helpful - I've added her specifically to the credits now
Lab Assistant
THANKS POST
#4 Old 26th Feb 2019 at 12:08 PM
Great, thank you so much. I think this to be very useful. But:

I am a modder beginner. There are Terms that still confuse me. E.g.:

"That said, there are a couple of options you can set. To set them you will need to extract the __init__.py file from the ts4script file and edit the values near the top of that script.
After changing the options, you should replace the __init__.py file in the ts4script with your changed version. It MUST be in the same location, the tuning_error_notifier subfolder of the zip file, in order to function. Recompiling the script should be optional, as the game prefers to load script mods from the source files if both .pyc and .py files are included in a script file."

So, "extract the __init__.py file from the ts4script file" - is there any tutorial showing how to do this? What programs do I need to do this?
"Recompiling the script" - sorry, erm, I do not know how to do that. Or even what that is.

For me, it just could be very helpful to have some links included that help me to understand, so I can use this useful tool. :D

Thank you for reading, creating that tool and helping other Modders!!! :)
Deceased
Original Poster
#5 Old 26th Feb 2019 at 12:20 PM Last edited by scumbumbo : 27th Feb 2019 at 7:34 AM.
@helene912 - Good thoughts - I'll put together a quickie tutorial on doing just that tomorrow and edit this response to include that information.

ETA - Attached is a PDF with a quick (probably more detailed than it needs to be) how-to for editing those options.
Download - please read all instructions before downloading any files!
File Type: zip Editing Options for TEN.zip (608.1 KB, 101 downloads)
Description: PDF Tutorial for Editing the Options
Lab Assistant
#6 Old 26th Feb 2019 at 12:42 PM
Quote:
Originally Posted by scumbumbo
@helene912 - Good thoughts - I'll put together a quickie tutorial on doing just that tomorrow and edit this response to include that information.

Some real quick pointers that may get you started before I get to that -- a "ts4script" file is really just a zip archive that has had the file extension renamed from ".zip" to ".ts4script" So you can get at the files inside by renaming it back to a ".zip" file and opening it with any archive manager program (I use WinRar, but 7-zip or others will work). You can then get at the file from there which is named "__init__.py" and drag and drop it to your desktop for editing. That file can be edited with Notepad, or any other text editor. Once you've changed the file to set the options mentioned in the text to what you need, you can then drag and drop the file back into that ".zip" file in the same location and rename the ".zip" file back to a ".ts4script".

You will not need to know anything about recompiling the script, it will take the changes from that file without needing to recompile it.


Wow, you are Wonderful!!! Thank you very much, this was very enlightening. I did not know how easy it is just to rename from sims 4 script back: just vice versa, so to speak. :DDD Thank you very, very much, also for the work you promised to do.

„Erfahrung heißt gar nichts. Man kann seine Sache auch 35 Jahre schlecht machen.“ (Kurt Tucholsky)
"Experience means nothing. You can also do your thing in a bad way for 35 years." (Kurt Tucholsky)
Rabid Recoloring Renegade
staff: senior moderator
#7 Old 26th Feb 2019 at 4:09 PM
When you said this: "a "ts4script" file is really just a zip archive that has had the file extension renamed from ".zip" to ".ts4script" So you can get at the files inside by renaming it back to a ".zip" file and opening it with any archive manager program (I use WinRar, but 7-zip or others will work)" it was like a light bulb went off above my head and simply exploded. I knew that we renamed zip files for careers as ts4script, but I did not translate this to other ts4script files for some reason and always found them daunting. I wholeheartedly second helen912's comments
Lab Assistant
#8 Old 26th Feb 2019 at 5:47 PM
Quote:
Originally Posted by Simmiller
it was like a light bulb went off above my head and simply exploded. I knew that we renamed zip files for careers as ts4script, but I did not translate this to other ts4script files for some reason and always found them daunting. I wholeheartedly second helen912's comments



Exactly, thx 2 both of u!!!

„Erfahrung heißt gar nichts. Man kann seine Sache auch 35 Jahre schlecht machen.“ (Kurt Tucholsky)
"Experience means nothing. You can also do your thing in a bad way for 35 years." (Kurt Tucholsky)
Instructor
THANKS POST
#9 Old 26th Feb 2019 at 6:47 PM
Still not sure if i should hate you or love you for this tool xD But seriously thank you
Lab Assistant
THANKS POST
#10 Old 26th Feb 2019 at 8:10 PM
Again, thank you so much for this! :)
Smeg Head
THANKS POST
#11 Old 27th Feb 2019 at 6:35 PM
Hi Scumbumbo, wanted to ask something. Ages ago I noticed, that if leaving purposeful white spaces in XMLs (To stand out as the coding part edited) when doing comparisons with WinMerge, it attempts, suggests, to fill in those white spaces with what it thinks are the missing Us and Vs and what not. Would this app also see white spaces as missing code? Thanks for all you do, Scumbumbo.
Deceased
Original Poster
#12 Old 27th Feb 2019 at 8:46 PM
@coolspear1 No, the errors are as reported by EA's tuning loader, which will ignore any extra whitespace or comments. As far as the XML loader is concerned
Code:
<U><T n="something">SomeValue</T></U>
and
Code:
<U>
    <T n="something">SomeValue<!--Set this to SomeValue so that some effect happens
                              you should not change this without seriously thinking
                              about the consequences!-->
    </T>


                                   </U>
Are functionally identical.
Quote:
Originally Posted by coolspear1
Hi Scumbumbo, wanted to ask something. Ages ago I noticed, that if leaving purposeful white spaces in XMLs (To stand out as the coding part edited) when doing comparisons with WinMerge, it attempts, suggests, to fill in those white spaces with what it thinks are the missing Us and Vs and what not. Would this app also see white spaces as missing code? Thanks for all you do, Scumbumbo.
Lab Assistant
#13 Old 28th Feb 2019 at 7:10 PM
Quote:
Originally Posted by scumbumbo
@helene912 - Good thoughts - I'll put together a quickie tutorial on doing just that tomorrow and edit this response to include that information.

ETA - Attached is a PDF with a quick (probably more detailed than it needs to be) how-to for editing those options.


Thank you very, very much, great!!!

„Erfahrung heißt gar nichts. Man kann seine Sache auch 35 Jahre schlecht machen.“ (Kurt Tucholsky)
"Experience means nothing. You can also do your thing in a bad way for 35 years." (Kurt Tucholsky)
Lab Assistant
THANKS POST
#14 Old 2nd Mar 2019 at 10:35 PM
Thank you for your tools! I really need them.
Test Subject
THANKS POST
#15 Old 3rd Mar 2019 at 7:27 AM
so there is no option to exclude strings?
like I want to exclude all TURBODRIVER:WickedWhims
that mod from some noob generate a lot of errors and I can't find something that is mine!
just kidding, I love TURBODRIVER
but srsly some animation for WW generate tons of strings
ofc I can remove mods that cause errors just for testing my mod... but man, is time consuming
Deceased
Original Poster
#16 Old 3rd Mar 2019 at 4:37 PM Last edited by scumbumbo : 3rd Mar 2019 at 5:19 PM.
Quote:
Originally Posted by Illume
so there is no option to exclude strings?

Didn't really think that'd be necessary, but it wouldn't be difficult to add that. Is there no unique string (like author name) in your own mods that you can use for filtering? Seems like it would be a good enough feature to add if there's others who have that same issue, and I can resist the urge to say you really should follow best practices and include that unique name in your tuning names.

ETA - Updated to include an EXCLUDE_TEXT_LIST option.
Test Subject
#17 Old 3rd Mar 2019 at 5:57 PM Last edited by Illume : 3rd Mar 2019 at 6:23 PM.
Quote:
Originally Posted by scumbumbo
Is there no unique string (like author name) in your own mods that you can use for filtering?

yes
for now I just made some small tuning here and there for myself
so there is no new stuff if that is what you mean
thanks for update! worked like a charm!
Deceased
Original Poster
#18 Old 22nd Apr 2019 at 8:02 AM
Version 2 adds a new option which will rebuild the XML for certain types of errors to make the invalid XML much easier to locate in your tuning. The rebuilt XML is nicely reformatted with "pretty" indentation regardless of how the input XML was formatted. See the screenshot attached to this message for an example.
Screenshots
Lab Assistant
#19 Old 22nd Apr 2019 at 11:49 PM
Does the REBUILD_INVALID_XML option actually fix the invalid XML it finds???

I run a Discord server dedicated to assisting Mac Simmers. Come join me here: https://discord.gg/6sjegZD

"It wasn't long ago that I was just like you." -- "Emenius Sleepus" by Michael Ryan Pritchard
Deceased
Original Poster
#20 Old 23rd Apr 2019 at 11:17 AM
Quote:
Originally Posted by Athena Apollos
Does the REBUILD_INVALID_XML option actually fix the invalid XML it finds???

LOL - I wish! No, that would be entirely too difficult as there are countless errors that could be in the XML so trying to guess what it should be would be impossible, or at least highly improbable.

It just takes the binary processed XML node that Python sees and regenerates the human readable XML from that so you can see what the source that has an error looks like. In other words instead of just saying "Here's what kind of error you have" it says "Here's what kind of error you have and here is the actual XML code that contains that error."
Lab Assistant
#21 Old 23rd Jun 2019 at 1:10 AM
One of the methods you patch in this mod, sims4.tuning.tunable._TunableCollection.load_etree_node , changed enough in the last Sims 4 version that your mod is causing crashes when REBUILD_INVALID_XML is set; a few attributes from that object, which are used in the previous version of the method, don't exist anymore.
Lab Assistant
THANKS POST
#22 Old 6th Dec 2019 at 12:33 AM
So sorry Scumbumbo desapeared
Test Subject
DELETED POST
6th Dec 2019 at 1:24 AM
This message has been deleted by Katilynn822.
Lab Assistant
#23 Old 10th Dec 2019 at 10:02 AM
Quote:
Originally Posted by Valdesca
So sorry Scumbumbo desapeared
um read the creator news https://simsvip.com/2019/12/09/the-...nthly-mod-news/