Jump to content

Adding compatibility between two sorting mods


FriedStephen

Recommended Posts

Since I've been working on my modlist for New Vegas, I've been researching how to make minor tweaks to existing mods (mainly older ones) to maintain full compatibility with newer ones.

 

In this case, I've been wanting Glenstorm's Mobile Auto-sorter to be able to properly sort the new items added my other mods (in my case the only mod I have that adds some conflicting items is the JSawyer Ultimate mod, with its Armor Repair Kit, Expired Stimpaks, and Homemade Stimpaks being classified as Food by the Auto-sorter.)

Opening up Mobile Auto-Sorter in GECK, I can see that its script is essentially using type codes to separate items for sorting, and uses a formlist exception (referencing a custom formlist that only includes vanilla/DLC chems+magazines) to prevent chems+magazines from being sorted with the rest of the "AlchemyItem" types. Now, since I have the interest of utmost compatibility in mind, I figured that modifying the auto-sorter script to instead use PushTheWinButton's Universal Item Sorter's categories to sort through items would be the optimal way to move forward.

 

This is where my lack of GECK knowledge fails me. I think the simplest solution would be to replace MAS's formlist exception with UIS's formlists that cover the same categories (chems and magazines), except I have no idea how or if I can add multiple formlists to that one line of code, or if I would have to add several lines, one for each exception (would that inefficiency be trouble?), and even If I managed to come up with good code, how can I ensure that the script would properly recognise formlists from another plugin? I ask that because the first thing I tried to do was simply drag and drop JSawyer UE's appropriate new items into MAS's exception formlist, but once it was saved and loaded into FNVEdit, I could see that those new items were not being recognised as I had hoped.

 

Anyway, I feel that there is a need for a mod with this function I'm describing, but this probably goes way beyond the scope of what I'm able or willing to do. If anyone can either help me, or possibly pick up the burden of making this happen (which I don't think would be very difficult for someone already familiar with modding this game,) that would be hugely appreciated.

Thanks!

Link to comment
Share on other sites

  • Replies 42
  • Created
  • Last Reply

Top Posters In This Topic

Please post the script you would like to edit so that I can think of how to keep compatibility in mind. Frankly, I don't like the idea of using form lists and would prefer to use arrays made at run-time, but I'm not sure I have the time right now to make a refined script that does this without any oversights or unforeseen flaws that need to be ironed out through testing and all that.

 

Maybe you can try yourself for now by using this function:

https://geckwiki.com/index.php/ListAddForm

 

Make a quest script that goes like this:

Begin MenuMode 4
    If GetGameRestarted
        ListAddForm FormListYouWishToAddStuffTo BaseIDofStuffYouWantToAdd
    EndIf
End

That won't account for modded items but at least you can play your game the way you want.

 

You may want to use this at some point in that quest script if you were having trouble merging the plug-ins:

https://geckwiki.com/index.php/GetFormFromMod

Link to comment
Share on other sites

Thanks for responding. This is the script from Mobile Auto-sorter that sorts items by removing each category one by one and sending them to their assigned containers. As you can see, the "food" category is left for last, and split into two by including an exception which is a formlist containing only vanilla chems and magazines. which are then sorted in the next line.

scn gszQScript

ref		contMain;
ref		contAmmo;
ref		contWeap;
ref		contArmor;
ref		contJunk;
ref		contFood;
ref		contMagDrug;
BEGIN GameMode
	;Adding Perk if needed
	if Player.HasPerk gszItemMarker == 0
		Player.AddPerk gszItemMarker;
	endif

	if	contMain != 0
		if	contAmmo != 0
			contMain.RemoveAllTypedItems contAmmo 1 0 41
		endif
		if	contWeap != 0
			contMain.RemoveAllTypedItems contWeap 1 0 40
		endif
		if	contArmor != 0
			contMain.RemoveAllTypedItems contArmor 1 0 24
		endif
		if	contJunk != 0
			contMain.RemoveAllTypedItems contJunk 1 0 31
		endif
		if	contFood != 0
			contMain.RemoveAllTypedItems contFood 1 0 47 gszDrugMagList
		endif
		if	contMagDrug != 0
			contMain.RemoveAllTypedItems contMagDrug 1 0 47
		endif
	endif
END

Now, the Universal Item sorter mod doesn't do any physical sorting like MAS, it just recognises each item's category and assigns their name an appropriate custom prefix, but it's much more efficient than MAS because it can dynamically categorise new modded items. The scripts in the mod are too adavanced for me to understand, but it seems to me that it uses premade formlists with vanilla items, which are then dynamically updated using some other scripts. Maybe I'm completely wrong about how it really works, as it seems to be using arrays in some manner, but I don't really understand what they are. Nonetheless, my goal is to replace the "gzsDrugMagList" exception with UIS's own equivalent formlists, which are "UISxAAidLIST", "UISxAChemLIST", and "UISxAMagLIST".

 

Assuming those lists really are being updated dynamically (I don't even know if that's actually possible,) then I believe that this would be the most easy way of combining the functions of both mods to play well with all other item mods, (in my case simply JSawyer UE.) If really need be, I'll try your suggested method by simply crafting a script to my needs, but I was hoping that a more dynamic mod could be useful for the whole community in a variety of contexts.

Link to comment
Share on other sites

Update:

Does this do what you want?



Edit: To clarify, I had initially thought that you wanted new containers for each UIS form list, but then I realised that you probably just wanted all the mod-added magazines and chems to go in the MagDrug container. That's why I initially thought this would be more complex.


-------------- Original Post --------------

I know what to do. Do me a favour and give me the FormID of UISxAAidLIST, UISxAChemLIST, and UISxAMagLIST from Universal Item Sorter.esp. This is where the Form ID is if you don't know:



That column will probably be completely shrunken, so just expand it to the right and it should give you the column I have there. I'll work on the script in the meantime.


Edit: Is the above script a quest script? I'm assuming it is. These variables must be set to something at some point. This is probably going to become complicated. Do you know what script determines what the variables store and when that script is called?


So that I understand what I'm trying to do here, you just want the above script to take whatever is in UISxAAidLIST for ContFood, and for contMagDrug, you want it to take any items from UISxAChemLIST and UISxAMagLIST?

Edited by EPDGaffney
Link to comment
Share on other sites

Sorry I couldn't respond sooner. I just got back from work, and I've checked your script. It seems you misunderstood me just a bit, in that I actually want all three of those Universal Item Sorter lists to be sorted into the same container. They cover the same range of items as the original Mobile Auto-sorter's script's exception formlist. All chems and magazines are covered by those lists, and then all that's left are food/drinks/poisons, which are all sorted into the food container.

 

However, it wasn't a complicated issue so I just made the necessary tweaks:

https://pastebin.com/xV2KrHTi

 

Here I simply made the Aid list also go to MagDrug container, and then I readded the RemoveAllTypedItems command for the Food category, but this time it doesn't need the exception because it's the last step, since the new formlists should have removed all the appropriate items beforehand.

 

Now correct me if I'm wrong, but I believe that they way you edited the script there is a logic check to see if the Universal Item Sorter.esp is loaded, and if it is it will run the newly added commands, otherwise if the plugin isn't loaded it will fall back to the old method? That's not a problem, I was just wondering if that's how it's working. It got me thinking about if the whole mod were rewritten to fully integrate UIS's system with the Auto-sorter, perhaps with new containers dynamically being generated depending on a config file, but that would obviously be very complicated, so I think keeping the original functionality intact is best for now.

 

I'm about to test the script out, so fingers crossed. I'll let you know how it goes.

Link to comment
Share on other sites

Made it slightly neater:

https://pastebin.com/vJF3dNmM

It was my fault for being in a rush when I wrote that and forgot to combine the conditions. It will function exactly the same. Removed the commented instructions as well now that you've already added the form IDs.

 

Glad you were able to extrapolate and make adjustments yourself. Good man.

 

Now correct me if I'm wrong, but I believe that they way you edited the script there is a logic check to see if the Universal Item Sorter.esp is loaded, and if it is it will run the newly added commands, otherwise if the plugin isn't loaded it will fall back to the old method?

Precisely. So, you load both mods and it adds the functionality if you do, but prevents anything being required, so you can change your load order any time with no problems.

 

Regarding the next thing, about integrating the two, you're welcome to try and I'll answer questions, but I haven't much time to comb through the mods and analyse the way they work and write all the scripts to do this.

 

Just keep the wiki handy:

https://geckwiki.com/index.php/Main_Page

 

And here's every single function in one place, for convenient browser finds:

https://geckwiki.com/index.php/Complete_List_of_Function_in_Fallout_New_Vegas

 

I expect it will go fine, but let me know what happens when you test this script.

Link to comment
Share on other sites

Success! It seems that the script functions exactly as I had hoped. Thank you so much for your help!

 

About the integration, the idea of dynamically creating container categories based on a config is way beyond my capability, but if I'm feeling bold I may try manually adding some more categories based on the lists available with UIS. That should be possible even for me by simply copying the framework of the existing code. Perhaps separate containers for Drinks/Food, Chems, Magazines, and Alcohol, or for each class of weapon and armor. The weapon and armor categorisation is actually quite interesting, as they don't seem to use any manual entries at all, instead they seem to share the same 7 formlists (7 categories each for Armor and Weapons), so if I were to use those formlists to separate all those items into 14 containers, I would somehow have to distinguish which items in each list are weapons or armor.

 

Anyway, that's not really in my interest at the moment, so I'm perfectly happy with what I have now. The one question I have left is what is the proper way to distribute this for sharing? For now I've directly edited the original Mobile Auto-sorter plugin's script, but I'm sure I can't simply upload the whole plugin to the nexus as I'd be redistributing someone else's code. If I save the script alone to a fresh plugin, would it override the same script in the original plugin and work properly? I'm concerned that separating the script will break any references to the original plugin, and I wouldn't know how to fix that. What you mentioned about the relevance of it being a quest script comes to mind, and I can see that the gszDrugMagList formlist doesn't need to be referenced in the script because it already has a global reference, but those are things I don't really understand.

 

For now though, I'm ready to simply start playing New Vegas again. Thanks!

Link to comment
Share on other sites

Not sure about the distribution. Had a look and that mod author isn't active for a while, but at least it's only 2017 (unlike his mod). Just message him and hope he gets back to you I suppose. He almost certainly wouldn't mind, or he may agree to uploading your version of the .esp as an update and crediting you for the addition. I don't think you need to contact PushTheWinButton, just Glenstorm.

 

I don't think there's a statute of limitations but all his mods are from 2011 and I just kind of doubt he'd really care what anyone did with any of them (his permissions say as much, except he wants to grant permission on an individual basis, unfortunately for you), so I hope he gets back to you.

 

Haha, funny enough, I may actually want to use this now. I used to use UIS with my old installation and bypassed MAS and similar mods because they didn't account for mod-added items. Seems sorted out now, though.

Link to comment
Share on other sites

Okay, I'll contact Glenstorm before trying anything else. I did just get thinking though about wider mod compatibility though. This whole time I was really only focusing on the Aid categories, but since I don't have any mods which add weapons and the such, I realised I don't know for certain if the Auto-sorter works with those by default. I assumed that even modded items still use the type codes, but if that's not the case then the script would need some modification to remove all cases of the "RemoveAllTypedItems" function and entirely replace them with alternative functions that use the more reliable formlists from UIS. The one thing I have noticed about MAS is that it doesn't sort weapon mods, but I never considered that an issue as they just stay in the main container,

 

First I'll just distribute what we have now, and only make alterations if anyone finds more sorting issues. Or feel free to make the changes yourself if you're up to it. Thanks again for all your help!

Link to comment
Share on other sites

UIS is really thorough, so I would actually go with its form lists instead. I don't know what they are, the Form IDs, and all that stuff, nor have I loads of time, so I'm going to leave that to you. You have what you need from my edits here. Whenever you want to try it, do your best and I'll fix your scripts if they don't work.

 

In the meantime, I do think almost everything will work fine via type codes. My favourite thing about UIS that won't work right now would be the way it sorts recipe components from the Misc Items section, but as it still would sort it in the misc item container, it's probably not really a problem.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...