Porting Enhanced Money Transfer mod to 3.50
I thought I would share how I ported my Enhanced Money Transfer mod over to the new system in 3.50 b1 I know most people haven't written mods that patch into the existing UI framework but it should help as a reference as how to do it in general. I won't cover the ui.xml as I think that's already fairly clear - just to reiterate that as things stand the game looks for a single ui.xml file in the mod's root folder. You can also now put your .lua files in the root folder and there's no need anymore to put them in a subst_xx.cat file or use a convoluted path in the xml file to locate them.
So, in the versions previous to 3.50 I was able to simply write a new version of the MoneyTransfer lua file and diff patch the ego_detailmonitor.xml file to replace Ego's version with my own. As of 3.50 b1 I can't do that so I now need to locate the existing (vanilla) menu and "hook" my functions into it. Here's how:
First I make a local empty table to hold a copy of the vanilla MoneyTransfer dialog:
I'm also going to make a table to store my collection of functions as this is how I like it (makes debug and cleanup a lot easier)
Now, here's the important bit (with comments):
Job Done - well almost - we still need to define our own functions below, so (without all the boring details)
Finally, call the init() function and the mod is patched into the original menu framework
Remember that if you wish to call any of the functions in the member table (Funcs) locally i.e. inside the mod then use the : operator e.g.
Hope this helps,
This post was written by wysiwyg.