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 17th Oct 2016 at 11:57 AM
Default Is it possible to modify an XML file without overriding the entire file?
Hey there! To my knowledge, the only way to modify an existing XML file is to completely overwrite it. This can lead to mod conflicts when two mods overwrite the same file - one will get stomped on, depending on the load order.

So:
  • Are there any techniques to simply add to a file, or overwrite a single node?
  • If not, would it be possible to implement?

The only alternative to solving conflicts I can think of is a XML merging tool, to construct a compatible file - does anything like that exist yet either?
Advertisement
Instructor
#2 Old 18th Oct 2016 at 6:28 AM
Quote: Originally posted by DLPalindrome
Hey there! To my knowledge, the only way to modify an existing XML file is to completely overwrite it. This can lead to mod conflicts when two mods overwrite the same file - one will get stomped on, depending on the load order.

So:
  • Are there any techniques to simply add to a file, or overwrite a single node?
  • If not, would it be possible to implement?

The only alternative to solving conflicts I can think of is a XML merging tool, to construct a compatible file - does anything like that exist yet either?

The "easy" way is python scripting .
You can modify, disable, append new funcions to a xml.

Merging two files is doable if they are the same instance and you know enough xml to keep the code flowing.
If they are two separate Instances, that would break the game.

Can you give a clue on exactly you want to (merge) ?
Test Subject
Original Poster
#3 Old 18th Oct 2016 at 2:36 PM
Quote: Originally posted by azoresman
The "easy" way is python scripting .
You can modify, disable, append new funcions to a xml.


Great! Don't suppose you could point me to any examples of this, could you? I'm not very familiar with the structure of the game yet, so don't want to reinvent the wheel if that's avoidable. :P

Quote:
Can you give a clue on exactly you want to (merge) ?


Nothing in particular - I just don't like knowing that some people would have conflicts with anything I make if there'd be a way to prevent it. I was thinking that an extension to, say, the mod conflict detector that could combine conflicting XML mods into one file would be a really handy tool to have. Would much rather the first method though, of course.
Instructor
#4 Old 19th Oct 2016 at 12:01 AM
Quote: Originally posted by DLPalindrome
Great! Don't suppose you could point me to any examples of this, could you? I'm not very familiar with the structure of the game yet, so don't want to reinvent the wheel if that's avoidable. :P



Nothing in particular - I just don't like knowing that some people would have conflicts with anything I make if there'd be a way to prevent it. I was thinking that an extension to, say, the mod conflict detector that could combine conflicting XML mods into one file would be a really handy tool to have. Would much rather the first method though, of course.

Problem is: even if you use python to inject a modified function to a tuning file, it will always conflict, in case another mod is modifying the same thing.
This only has advantage if you append new things.
The way I see it is append code without modifying the original content.

You need to know python coding to find a good way to do just that.
Besides the injection method, the rest is just up to you to create the new method for the desired definitions.
You could study some of the major script mods like Mc-command center.

For example if the code is testing for a trait a sim has to have, and let's say you want to add other tests without overriding the original one, you can always append new tests after that one.

Only knowing what you need to modify, I could be more specific .
Test Subject
#5 Old 28th Dec 2016 at 9:41 PM
I wanted to know this also, is there a way of editing a value set my an XML file?

It would be great if you could, not because of conflicts, but because maxis keeps adding / changing these files on major updates, perhaps I might want a toggle option for enabling and disabling configs.

For example can you add / remove recipes from fridge_CookAutonomously XML file?

Say if I wanted to add a recipe from a custom mod so sims can cook those meals autonomously but without editing the original XML and just using a python script can it be done?
Back to top