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

Featured upload! XML Injector version 2

by scumbumbo Posted 24th Jan 2019 at 9:22 AM - Updated 26th Mar 2019 at 11:43 PM by scumbumbo : Version 2 Released (New Features)
189 Comments / replies (Who?) - 16 Feedback Posts, 6 Thanks Posts
This is a featured upload! It showcases the best talent and creativity available on MTS and in the community.
Version 2 Released
  • Contains new features which may be required by some mods.
  • Don't forget to remove version 1 when you upgrade!

Description

The XML Injector for The Sims 4 is a mod library to allow mods that would normally require a script for simple changes to instead use a custom snippet. The library provides the scripting, and the modder can release their mod without having to concern themselves with writing, compiling and maintaining a script. Currently the XML Injector snippet handles adding interactions to game objects in a variety
of ways with a simple XML definition.

Player Info

If you just play the game then you only need to download and install this library mod if another mod you download tells you that you must have this installed. On it's own this mod does nothing, it works in the background to make other modders able to code their mods more easily.

If another mod does inform you that this mod is required for it to work, then you should proceed to download and install this. You do not need to download the Modder's Documentation file, this contains the technical information for modders to reference.

Installation is simple. The file you download will contain two files, a script named XmlInjector_Script_v2.ts4script and XmlInjector_Test_v2.package.

Extract both of these files from the download file into your game Mods folder. You should install it directly into your Mods folder, and not a subfolder, in order to ensure that it can be easily located if you need to upgrade the script to a newer version.

The current version of the XML Injector is version 2, and denoted by the _v2 in the filenames. It has been written to work with the most recent game patch, 1.50.67 (February 21, 2019).

Once both files are installed, you must also ensure that script mods are enabled in your game options. This is very important as, though the XML Injector allows other mods to eliminate their scripts, the XML Injetor does the scripting for them and so script mods must be allowed in your game.

After installing the XML Injector, you should test to make sure it is working properly. The included test package adds several test interactions to several game objects. Choosing one of these "XML Injector Test" interactions from the pie menu should display a notification that the XML Injector is working properly. If you do not see these test interactions then the XML Injector is not installed properly and will not work for mods that depend on it.

The "XML Injector Test" test interactions can be selected from any of the following six locations in the game.
  • On a household's mailbox
  • Any of the game's computer objects
  • Clicking on any Sim
  • In the "Friendly" chat choices when clicking on another Sim
  • From a Sim on the relationship panel
  • From the "Household" phone category
There is not really any need to test more than one of these choices, any single one should suffice. The test is primarily in so many places in order to serve as a useful reference for modders to see how to code their own mods.

Once you have verified that the XML Injector is working, you may remove the XmlInjector_Test_v2.package file and test interactions will no longer appear on your pie menus.

The script file should remain in your Mods folder. If the script is removed, other mods which depend on it will no longer operate properly.

You should check back here occasionally, particularly a day or two after game updates if it stops working, to see if the mod has been updated with any important additions or fixes for new game patches. In the future, a mod you download may specify that it requires features from a version newer than the one you have installed, and again this is an important reason to keep the mod installed in the main Mods folder so it can always be located easily and the version number verified.

Modder Info

The primary purpose of this mod is to eliminate the need for modder's to write, compile and maintain their own scripts for the simple tasks of modifying the game's XML tunings (e.g. _super_affordances list). It currently supports:
  • Add interactions to game objects. The game objects can be selected by instance number, an existing interaction (e.g. sink_washHands), or a partial name search.
  • Add interactions to the Sim's object.
  • Add interactions to the relationship panel.
  • Add interactions to the phone panel.
  • Add interactions to AffordanceLists ("Friendly" mixers, etc.)
  • Version 2
    • Test that XML Injector v2 or higher is installed.
    • Test that that the installed version of XML Injector supports your mod.
    • Add loot actions to LootActions and RandomWeightLoot tunings.
    • Add buffs to traits.
    • Add name and object relationship components to game object tunings.
    • Add states and state_triggers to object tunings.

By offloading these tasks to a shared script, controlled by a simple XML snippet that you include in your mod package, this eliminates the need for you to include a script. In addition, if future game updates alter the method that these XML tunings must be modified in a script, this library will be promptly updated with any necessary fixes - and no changes will be required to your mod.

The majority of the documentation for the library is contained in the Modder's Documentation. This contains the following resources:
  • A PDF document with the technical details on creating an XmlInjector snippet tuning, including several examples.
  • The raw XML and STBL files contained in the test package.
  • A tuning description file for the XmlInjector snippet. If you use the TS4 Tuning Description Browser, you can place this file into your snippets folder where you have stored the EA TDesc files to view it within the browser.
  • The script source files for reference. At least one other script modder should acquaint themselves with the code (feel free to ask me any questions on how something works!) in the event that I am unable to update it myself for whatever unplanned and involuntary reason.

Once you've setup your mod to use an XmlInjector snippet, you should inform players who download your mod to obtain and install a copy of the XML Injector from this download page. Do not distribute the library with your own mod. This ensures that players have only one copy of the script installed, and that they can easily determine if they have the latest version installed and know where they can get the most recent updates if required.

The XML Injector can be extended to update other tunings. If you have any ideas, feel free to ask if they can be implemented. Ideal candidates for new features would be common tuning changes that would otherwise create the possibility of mod conflicts without a script. More complex or rare changes would not receive any priority for implementation as the mods that make those complex changes are likely to require a script for other reasons. The main goal is to allow other mods to be implemented and distributed without requiring their own scripts.

If you have any questions or run into technical difficulties, please post here on the mod library's discusion thread. In addition, some alternative methods of contacting me are given in the PDF documentation.

Thank you to all the modders who have tested, and given me ideas and encouragement for implementing this library snippet!

Thank you to Triplis for joining the development team and creating new features for future XML Injector versions!

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.50.67
Key: - File was updated after upload was posted
Filename - Tip: You can click the magnifying glass to see the archive contents Size Downloads Date
XmlInjector_Modders_Documentation_v2.zip | Documentation for Modders

Size: 1.30 MB · Downloads: 28,475 · 26th Mar 2019
1.30 MB 28,475 26th Mar 2019
XmlInjector_v2.zip | XML Injector Version 2

Size: 13.0 KB · Downloads: 108,396 · 26th Mar 2019
13.0 KB 108,396 26th Mar 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
 
189 Comments / Replies (Who?) - 123 Feedback Posts, 51 Thanks Posts
Hide Thanks Posts for this thread (Show only feedback)
Page 2 of 8
Test Subject
THANKS POST
#26 Old 7th Apr 2019 at 12:09 AM
Thanks!
Test Subject
DELETED POST
12th Apr 2019 at 8:29 PM
This message has been deleted by HugeLunatic. Reason: spam
Test Subject
DELETED POST
12th Apr 2019 at 8:31 PM
This message has been deleted by HugeLunatic. Reason: spam
Test Subject
DELETED POST
12th Apr 2019 at 8:34 PM
This message has been deleted by HugeLunatic. Reason: spam
Test Subject
#27 Old 13th Apr 2019 at 8:01 AM
Quote:
Originally Posted by Simorph
Sorry about your pc problems. Been there too. Gotta have my pc, gotta!! Anyway, thanks for the response to clear up my question. I'm not a modder, so I see a word and just assume it means what I think it means. Good luck with your pc!!


Извините что пишу тут но у меня скрипт не работает пишет что сломан я несколько раз качала не помогло.
Scholar
THANKS POST
#28 Old 13th Apr 2019 at 6:20 PM
What a brilliant idea this is! Thanks so much for making it.
Test Subject
THANKS POST
#29 Old 14th Apr 2019 at 11:46 AM
ð¡ð¿ð°ñð¸ð±ð¾.ðð¾ ñƒ ð¼ðµð½ñ ð¿ð¾ñ‡ðµð¼ñƒ ñ‚ð¾ ñðºñ€ð¸ð¿ð» ð¿ð¸ñˆðµñ‚ ñ‡ñ‚ð¾ ñð»ð¾ð¼ð°ð½.
Deceased
Original Poster
#30 Old 14th Apr 2019 at 7:30 PM
Quote:
Originally Posted by nadia00030
Извините что пишу тут но у меня скрипт не работает пишет что сломан я несколько раз качала не помогло.
(Google Translation: "Sorry for writing here, but my script doesn’t work, writes that I’m broken several times, it didn’t help.")
I had to run your message through Google translate to read this. I'm not sure what you mean by "writes that I'm broken several times" possibly just due it being poorly translated. I'd like to help but being an English-only reader that could make it difficult.

I'm guessing that you are getting messages in your LastException file? If that's what is happening I'd need to see those exceptions in order to determine what could be happening. You could attach that file to your response if you like and I could take a look.

First, I would recommend ensuring that the script is set up properly. Most importantly:
  • Make sure you are running the most recent The Sims 4 game patch, version 1.50.67 from the February 21, 2019 EA update. Un-patched copies of the game are not supported.
  • Make sure that the XmlInjector_Script_v2.ts4script file is in your Mods directory, it should not be installed in a subdirectory.
  • Make sure that you have scripts enabled in your The Sims 4 game options.
If you have more information you can provide as to what exactly is causing an error, please feel free to follow up. I'll try and translate as best I can! If there are any bi-lingual translators who can help out with this, please feel free to interject!
Deceased
Original Poster
#31 Old 14th Apr 2019 at 7:32 PM
Quote:
Originally Posted by nadia00030
�������.�� � ���� ������ �� ������ ����� ��� ������.

Sorry, this message was unreadable in my web browser. Since it is a "Thanks Post" I'm hoping you've solved the problem and have gotten it working? I sure hope so, but if not I'll try to help as best I can.
Test Subject
#32 Old 15th Apr 2019 at 6:45 AM Last edited by nadia00030 : 15th Apr 2019 at 1:48 PM.
Quote:
Originally Posted by scumbumbo
I had to run your message through Google translate to read this. I'm not sure what you mean by "writes that I'm broken several times" possibly just due it being poorly translated. I'd like to help but being an English-only reader that could make it difficult.

I'm guessing that you are getting messages in your LastException file? If that's what is happening I'd need to see those exceptions in order to determine what could be happening. You could attach that file to your response if you like and I could take a look.

First, I would recommend ensuring that the script is set up properly. Most importantly:
  • Make sure you are running the most recent The Sims 4 game patch, version 1.50.67 from the February 21, 2019 EA update. Un-patched copies of the game are not supported.
  • Make sure that the XmlInjector_Script_v2.ts4script file is in your Mods directory, it should not be installed in a subdirectory.
  • Make sure that you have scripts enabled in your The Sims 4 game options.
If you have more information you can provide as to what exactly is causing an error, please feel free to follow up. I'll try and translate as best I can! If there are any bi-lingual translators who can help out with this, please feel free to interject!

hello I write with the translator I English mail do not know a couple of words so if that not so wrote excuse. At me such problem for me everything is updated a game but for exchanges вылетакт yellow windows and I checked for mistakes with the ModConflictDetector program and it showed that skripat I am broken did not understand why so but in a game when I include writes what works well but when I want to buy ingridiyenda products I buy I do not know open but they do not work all the same peeps is not present igridiyend not on one refrigerator that it and why if can be helped and the file and when I leave only MS and WickedWhimsMod and received not recognizable mistakes I do not know as well as that it help please. Thanks.and this file -2 from unrecognizable ishibky.
Download - please read all instructions before downloading any files!
File Type: txt lastException.txt (5.9 KB, 21 downloads)
File Type: txt 2-lastException.txt (25.9 KB, 12 downloads)
Test Subject
#33 Old 15th Apr 2019 at 1:27 PM
Quote:
Originally Posted by scumbumbo
I had to run your message through Google translate to read this. I'm not sure what you mean by "writes that I'm broken several times" possibly just due it being poorly translated. I'd like to help but being an English-only reader that could make it difficult.

I'm guessing that you are getting messages in your LastException file? If that's what is happening I'd need to see those exceptions in order to determine what could be happening. You could attach that file to your response if you like and I could take a look.

First, I would recommend ensuring that the script is set up properly. Most importantly:
  • Make sure you are running the most recent The Sims 4 game patch, version 1.50.67 from the February 21, 2019 EA update. Un-patched copies of the game are not supported.
  • Make sure that the XmlInjector_Script_v2.ts4script file is in your Mods directory, it should not be installed in a subdirectory.
  • Make sure that you have scripts enabled in your The Sims 4 game options.
If you have more information you can provide as to what exactly is causing an error, please feel free to follow up. I'll try and translate as best I can! If there are any bi-lingual translators who can help out with this, please feel free to interject!

files 2
Download - please read all instructions before downloading any files!
File Type: txt 2-lastException.txt (25.9 KB, 19 downloads)
Deceased
Original Poster
#34 Old 15th Apr 2019 at 7:00 PM
Quote:
Originally Posted by nadia00030
hello I write with the translator I English mail do not know a couple of words so if that not so wrote excuse.

Hello again. The script errors you are seeing do not have anything to do with the XML Injector. It is difficult to say for certain which mod you have is causing issues, there appear to be at least two issues with one or more mods.

One issue is caused by a mod you have which contains a resource with the instance Id of 15561817960004736728.

The other issue is caused by an invalid test event, and it's not clear what mod could be causing that. It could possibly be the same mod as the issue above, or a completely separate mod.

I would suggest first trying to track down what mod you have that has that invalid resource 15561817960004736728. You can find this by using the TS4 Package Searcher. Enter that number into the Instance field and click Search. (See the attached screenshot) It will search all the package files in your Mods folder for the one that contains that invalid value. Update or remove that mod and then try running the game again to see if things work better

If you are lucky the same mod causes that second error. If not then you may need to do some "50/50" testing by removing and adding mods in to see which specific mod is causing you problems.

Hopefully this helps you out, despite the language barrier. But it is clear that the issue is not caused by the XML Injector itself, you will need to contact the author of the mod or mods which are actually causing the problems.
Screenshots
Test Subject
#35 Old 16th Apr 2019 at 6:35 AM Last edited by nadia00030 : 16th Apr 2019 at 10:43 AM.
Quote:
Originally Posted by scumbumbo
Hello again. The script errors you are seeing do not have anything to do with the XML Injector. It is difficult to say for certain which mod you have is causing issues, there appear to be at least two issues with one or more mods.

One issue is caused by a mod you have which contains a resource with the instance Id of 15561817960004736728.

The other issue is caused by an invalid test event, and it's not clear what mod could be causing that. It could possibly be the same mod as the issue above, or a completely separate mod.

I would suggest first trying to track down what mod you have that has that invalid resource 15561817960004736728. You can find this by using the TS4 Package Searcher. Enter that number into the Instance field and click Search. (See the attached screenshot) It will search all the package files in your Mods folder for the one that contains that invalid value. Update or remove that mod and then try running the game again to see if things work better

If you are lucky the same mod causes that second error. If not then you may need to do some "50/50" testing by removing and adding mods in to see which specific mod is causing you problems.

Hopefully this helps you out, despite the language barrier. But it is clear that the issue is not caused by the XML Injector itself, you will need to contact the author of the mod or mods which are actually causing the problems.

Many thanks helped how to me to find a resource with the identifier?
Deceased
Original Poster
#36 Old 16th Apr 2019 at 8:47 PM
Everything appears to be fine with the latest game patch and XML Injector v2, but we'll be keeping an eye on it. Let us know if you encounter any issues.
Lab Assistant
THANKS POST
#37 Old 17th Apr 2019 at 2:24 PM
thank you for such a useful mod
Deceased
Original Poster
#38 Old 18th Apr 2019 at 12:24 AM
Just a reminder folks, after already having to help two players who couldn't upgrade to version 2 of the mod properly due to not reading instructions:
  • Install only one copy of the XML Injector. You do not need a copy of it for each mod that requires it.
  • Keep it in a location you know, either directly in your Mods folder, or in a dedicated sub-folder (e.g. "Mods/XML Injector").
  • It cannot be installed into a sub-folder more than one level deep (e.g. "Mods/Scripts/XML Injector" will NOT work)
Test Subject
THANKS POST
#39 Old 18th Apr 2019 at 1:42 AM
Awesome. Thanks.
Lab Assistant
THANKS POST
#40 Old 18th Apr 2019 at 3:10 PM
Scumbumbo, you are "da man"! I truly don't know how you come up with these cool things.
Test Subject
#41 Old 18th Apr 2019 at 4:25 PM
Hey Scumbumbo, I tried to download XmlInjector_v2.zip | Description: XML Injector Version 2, but every time I try to extract the file it tells me it's empty.
Deceased
Original Poster
#42 Old 18th Apr 2019 at 4:30 PM
Quote:
Originally Posted by amber_troyer
Hey Scumbumbo, I tried to download XmlInjector_v2.zip | Description: XML Injector Version 2, but every time I try to extract the file it tells me it's empty.

The file is fine on Mod The Sims. I'd suggest trying another web browser, or sometimes your Internet provider may have issues with their "cache" which causes some things to not be downloading properly, the file gets stuck in an incomplete state, and all you can do is wait an hour or two and try again once their issue has hopefully cleared up.
Lab Assistant
#43 Old 21st Apr 2019 at 1:34 AM
Is there a way to determine which mod I have requires the XML Injector? I'm sure it's only one, but I'd like to document which one it is for future reference. Any tool I can run against my mods folder to determine that?
Deceased
Original Poster
#44 Old 21st Apr 2019 at 11:38 PM
Quote:
Originally Posted by TrueAI
Is there a way to determine which mod I have requires the XML Injector? I'm sure it's only one, but I'd like to document which one it is for future reference. Any tool I can run against my mods folder to determine that?

Well, it should have told you the requirement where you downloaded the mod, but if you forgot then there isn't really any easy way to tell which mod(s) are using it - you'd have to scan for any packages that use the snippet XML type, and then look at the contents of those packages in Sims 4 Studio or S4PE to see if those snippets are of the "XmlInjector" type.
Lab Assistant
#45 Old 22nd Apr 2019 at 7:57 PM Last edited by TrueAI : 22nd Apr 2019 at 10:07 PM.
Quote:
Originally Posted by scumbumbo
Well, it should have told you the requirement where you downloaded the mod, but if you forgot then there isn't really any easy way to tell which mod(s) are using it - you'd have to scan for any packages that use the snippet XML type, and then look at the contents of those packages in Sims 4 Studio or S4PE to see if those snippets are of the "XmlInjector" type.


Thank you. I should have started looking at your mods first! It was your 'Set Filters on Paintings by Reference' mod. Thank you for all you do for the modding community!
Test Subject
#46 Old 23rd Apr 2019 at 1:44 PM
Quote:
Originally Posted by scumbumbo
The file is fine on Mod The Sims. I'd suggest trying another web browser, or sometimes your Internet provider may have issues with their "cache" which causes some things to not be downloading properly, the file gets stuck in an incomplete state, and all you can do is wait an hour or two and try again once their issue has hopefully cleared up.


That worked! Thank you for getting back with me.
Test Subject
#47 Old 24th Apr 2019 at 1:33 PM
I think I've found an error between your injector and some custom harvestables/foods filed, and EG on the MCC Discord convinced me to bring this LE to you, in case it's something you should check.

http://modthesims.info/m/9787728 (mentioned in the LEs)

Thanks for all your hard work!
Download - please read all instructions before downloading any files!
File Type: txt lastException.txt (3.8 KB, 12 downloads)
Page 2 of 8