Mod Tool: Introducing SHAM XML Editor
Added 2021-03-30 07:56:59 +0000 UTCNote: This is a mod tool update. If you're only looking for updates to mods themselves, you can safely skip this. I'm posting it here for better visibility for modders, or those who might be interested in modding. :)
I've been working hard to bring a key addition to my modding tool SHAM: An XML Editor. The goal of this addition is to improve modding for those who mod by hand, using a plaintext editor such as Notepad++. I am one of those people who does, so I tried to design it as much to meet my own qualifications as any imagined ones.
You can get it here: Sims Hash Assistant to the Modder (SHAM)
Some highlights of what it can do beyond plaintext editing are as follows:
Insert Template
Insert an example of a tuning (such as a Trait or Buff) into the editor, so you don't have to hunt down something like what you want. Currently, this covers a limited selection of "templates," but you can add to the tuningTemplates folder yourself with any XML file. So you can expand it as much or as little as you want. I could have included a lot more templates with the program itself, but I opted to keep it small because the templates are essentially just examples of tuning files and future syntax changes could cause them to break in little ways.
Insert Template puts control in your hands to set up and maintain an environment where copying in entire tuning examples, or just snippets of XML, such as a particular tuning, is easy to do and can save lots of time when working with large numbers of files. This is kind of an experimental feature and I'm open to feedback on ways it could be more useful.
Save As Hash
The companion to Insert Template, this will offer to save the file based on its n= name, with a generated hash and complete file name. It will also offer to update the internal s= hash to match what's generated, if desired.
Link Tuning
If you right-click in an area where a tuning reference is (ex: a reference to a Buff file), there'll be a Link Tuning option in the menu. This will bring up a dialog where you can paste in a file path or select it from the dropdown file dialog. It'll then extract the tuning reference from that file, piece it together into reference ID + XML Comment with its Tuning Name, and replace the existing reference with the new one.
The result is a quick way to set up references in tunings, without having to stare hard at the screen to make sure you've entered everything correctly. I wouldn't know, I have definitely never stared hard at the screen and started questioning my life choices while making sure tunings match up.
Project View
The Project View is a kind of filesystem view. You select a "project" (folder location) and it'll populate with the XML files in there. You can then open files from it by double-clicking, or right-click and copy a file's path. It can also show/hide internal Tuning Name. This is shown by default, along with arrow buttons to allow you to more quickly scroll to file name (Name) or internal tuning name (Tuning Name). The goal of this is to make it easier to see what files you're working with at a glance, since the file names themselves may be long and unwieldy with all that S4_E882D22F_00000000_A8322168125B1E3A type mumbo jumbo.
Note that if you don't like the Project View taking up screen space, or don't like the amount, you can hide it entirely, or change how much of the screen it takes up compared to the XML Editor, in Preferences > XML Tuning
In Conclusion
You may be surprised to know, or not surprised at all if you're familiar with programming, that the bulk of the work on this was just getting the XML Editor up to speed on some standard stuff. Qt takes care of a lot out of the box with its widgets and examples, but I still had to do quite a lot to get it on the same level with some of the more basic features people expect out of any text editor.
That said, I did quite a lot beyond those basics, too, and some of that detail can be found on the website. I've not covered every detail here, though it's safe to say I've covered all of the major features that I think are most important for making modding easier.
Incidentally, the Social Powered Reward Trait mod was made using this, to test out the program and look for issues. That testing resulted in some tweaks and additions, so you can be assured I've put this to use, not just made it for hypothetical theoretical imagined modding in a dreamworld. Not that there is anything wrong with imagination or dreamworlds. They are just not very relevant here and I don't know why I keep mentioning them.