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?) - 20 Feedback Posts, 5 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,479 · 26th Mar 2019
1.30 MB 28,479 26th Mar 2019
XmlInjector_v2.zip | XML Injector Version 2

Size: 13.0 KB · Downloads: 108,403 · 26th Mar 2019
13.0 KB 108,403 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 3 of 8
Deceased
Original Poster
#51 Old 24th Apr 2019 at 9:38 PM
Quote:
Originally Posted by lothlen
I think I've found an error between your injector and some custom harvestables/foods...

The LE is only mentioning XML Injector and custom harvestables mods due to those scripts being installed as part of the XML loading process, the actual error is caused by some invalid coding in another XML mod. I can't tell you which mod it is, you could use the Package Searcher if you have a Windows computer to search for the actual mod in question.

In Package Searcher, search for instance 156276 as it contains the actual error. All I can see myself as I don't have that mod is that it's altering the Sleep of the Undead. See the screenshot below for how to search for that instance.
Screenshots
Forum Resident
THANKS POST
#52 Old 27th Apr 2019 at 4:20 AM
Thank you for this mod. I am no modder, but I understand that your set filters on painting by reference mod now requires this one, so I should get it.
Deceased
Original Poster
#53 Old 28th Apr 2019 at 4:19 AM
Quote:
Originally Posted by RedMallie
Thank you for this mod. I am no modder, but I understand that your set filters on painting by reference mod now requires this one, so I should get it.

You've understood perfectly, yes that is correct.
Lab Assistant
#54 Old 9th May 2019 at 10:57 AM
Quote:
Originally Posted by scumbumbo
You've understood perfectly, yes that is correct.

Do I download 1 file or both files?
Lab Assistant
#55 Old 10th May 2019 at 5:23 PM
Quote:
Originally Posted by LaraCroftEyes1
Do I download 1 file or both files?


You should only need the XMLInjector_v2.zip file to get things up and working in your game. The second file, XMLInjector_Modders_Documentation_v2.zip is only needed if you want to learn about how the injector works and how to use it in creating your own mods. It is, AFAIK, purely documentation.
Test Subject
#56 Old 19th May 2019 at 2:34 AM
Quote:
Originally Posted by scumbumbo
The LE is only mentioning XML Injector and custom harvestables mods due to those scripts being installed as part of the XML loading process, the actual error is caused by some invalid coding in another XML mod. I can't tell you which mod it is, you could use the Package Searcher if you have a Windows computer to search for the actual mod in question.

In Package Searcher, search for instance 156276 as it contains the actual error. All I can see myself as I don't have that mod is that it's altering the Sleep of the Undead. See the screenshot below for how to search for that instance.


Turns out it was one of Brazen Lotus' harvestables, specifically the yellow tomato - beats me as to why! I'm a patron so I'll let her know.

Thanks for being so helpful! <3
Test Subject
#57 Old 26th May 2019 at 8:31 PM
i think im having an issue with the tragic clown not spawning in the world, and vampires and aliens with this mod? not 100% sure.
Test Subject
#58 Old 2nd Jun 2019 at 11:07 PM
Hello, I am currently in school for game design, and I have a question for you if you do not mind answering. I work with C# in Visual Studio, and I wanted to know does The Sims 4 takes the same language like C#? or is it a different language with Python?
Test Subject
#59 Old 10th Jun 2019 at 4:59 AM
Does not work,gives an error version of the game 1.51.77
Lab Assistant
#60 Old 24th Jun 2019 at 1:16 PM
XML Injector mod broke with the latest patch/pack. Continuously getting a prompt in-game to install it.
Removing until it ever gets updated.
Test Subject
#61 Old 25th Jun 2019 at 6:40 AM
Quote:
Originally Posted by gettp
XML Injector mod broke with the latest patch/pack. Continuously getting a prompt in-game to install it.
Removing until it ever gets updated.


Yep, it broke with the latest update. For me it hangs on the last loading screen before getting to your family.
Mad Poster
#62 Old 25th Jun 2019 at 4:16 PM
I still have this in my game for use with my Plan Career Outfit mod and it is working without any issues. It's injecting the interactions correctly and they function as they should. I have the latest patch and I also have Island Living installed.
Could it perhaps be the mod that is attempting to make use OF the injector that is the problem instead?

My deviantART, MTS Yearbook Origin ID = Alistu
Instructor
#63 Old 26th Jun 2019 at 1:40 PM
Quote:
Originally Posted by Menaceman44
I still have this in my game for use with my Plan Career Outfit mod and it is working without any issues. It's injecting the interactions correctly and they function as they should. I have the latest patch and I also have Island Living installed.
Could it perhaps be the mod that is attempting to make use OF the injector that is the problem instead?

Same here !
No issues whatsoever .
Test Subject
#64 Old 27th Jun 2019 at 12:14 PM
Quote:
Originally Posted by _Diana1998_
Does not work,gives an error version of the game 1.51.77

У меня такое же и тоже не работает.
Forum Resident
THANKS POST
#65 Old 3rd Jul 2019 at 5:11 AM
Great job! Thanks for sharing.
Forum Resident
THANKS POST
#66 Old 3rd Jul 2019 at 5:11 AM
Great job! Thanks for sharing.
Lab Assistant
#67 Old 9th Jul 2019 at 9:59 PM
I just tested my game and the injector no longer works for me. It causes a huge LE. I have TwistedMexi's BE which helped me.
Field Researcher
THANKS POST
#68 Old 18th Jul 2019 at 3:04 AM
Someone told me the xml injector isn't working. However I can confirm it IS working properly for automatic sunburns and automatic beards. Perhaps modders using it have not implemented it properly?
Mad Poster
#69 Old 20th Jul 2019 at 11:10 PM
Quote:
Originally Posted by flerb
Someone told me the xml injector isn't working. However I can confirm it IS working properly for automatic sunburns and automatic beards. Perhaps modders using it have not implemented it properly?

I too am assuming that it is the mods that are making use OF the injector that are the problem and not the injector itself.

My deviantART, MTS Yearbook Origin ID = Alistu
Test Subject
THANKS POST
#70 Old 8th Aug 2019 at 10:18 AM
THANKS
Lab Assistant
#71 Old 11th Aug 2019 at 3:41 AM
Default LE and conflict
I don't know what this is conflicting with, but with the injector installed, I get an LE notification on game startup and I can't select "sleep" on any beds - the option doesn't even appear. I've been 50/50-ing all day, as well as looking for anything that influences beds or sleeping, but with everything else up to day and/or removed the problem persisted until I removed this.

Mods rock my sox.
Lab Assistant
#72 Old 11th Aug 2019 at 2:11 PM
Quote:
Originally Posted by Lupusdragon
I don't know what this is conflicting with, but with the injector installed, I get an LE notification on game startup and I can't select "sleep" on any beds - the option doesn't even appear. I've been 50/50-ing all day, as well as looking for anything that influences beds or sleeping, but with everything else up to day and/or removed the problem persisted until I removed this.


I would assume a mod conflict here or a wrong installation/corrupt file, cause I don't have any of your mentioned errors in my game with the XML injector installed. Did you perform the injector test via mailbox to look if he works right? Have you tried reinstalling/redownloading it?
Lab Assistant
#73 Old 14th Aug 2019 at 6:51 PM
Same Issue
Quote:
Originally Posted by Lupusdragon
I don't know what this is conflicting with, but with the injector installed, I get an LE notification on game startup and I can't select "sleep" on any beds - the option doesn't even appear. I've been 50/50-ing all day, as well as looking for anything that influences beds or sleeping, but with everything else up to day and/or removed the problem persisted until I removed this.


I had the same issue and found it was the garden harvestables I downloaded from Brazen Lotus. Once I took them out my sims can sleep in the beds. Hope this helps!!
Field Researcher
#74 Old 22nd Aug 2019 at 11:45 PM
Default Snippets conflict?
Quote:
Originally Posted by Etta01
I had the same issue and found it was the garden harvestables I downloaded from Brazen Lotus. Once I took them out my sims can sleep in the beds. Hope this helps!!


I also got LE's on game load. Same exception appears no matter what is causing it. Very vague. Reading the errors, I was sure it was in the T-scripts somewhere. That's all that was listed in the exception. Took 3 days to one-by-one narrow the field only to find out it was the XML Injector that was clashing with something. I read the creator notes again and realized the connection to this mod and any mod that is a snippet mod? I removed all of the mods that ended with snippet (all Leniad's crafting and recipe mods) and the game works fine. I am disappointed to lose all my crafting mods however. I need XML for Flerb's Suntanning mod, which I love!!!! It really enhances EA's suntanning system. But I really love all Leniad's stuff too! Am I doing something wrong or is there a way to sync these mods to work together??
Test Subject
#75 Old 6th Sep 2019 at 11:32 AM
Hello. This mod doesn't seem to be working after today's game update. I did the test with the sample package and no interaction is showing. My script mods are enabled.Could you please tell me if there is an issue with the mod after today's patch?
Page 3 of 8