Jump to content

Rearranging workshop categories in-game?


HeyYou

Recommended Posts

 

I don't think you can rearrange workshop categories in-game. If you have a lot of mod added workshop categories, might be the easiest solution to Revert() all formlists (delete script added froms from them) with a script, then redesign and rebuild your category menu from scratch..

So, revert would clear all script added categories, (which would be all but one for me, I think....) But, it would be possible to read thru the form list, build an array with all categories, and then possible dictate the order in which categories were added, and where to put them?

 

Yes it's possible. You can try this Quest script. Just create a Quest and attach this script to it, then fill the properties.

 

Note that I don't have any mod added workshop categories (yes, I'm serious :)) so I couldn't test it. It complied though...

 

 

Scriptname RearrangeWorkshopCategoryScript extends Quest Const

FormList[] Property VanillaWsCategories Auto Const
{Array of FormLists of vanilla workshop categories.
FormLists are in order, see Index in functions XXXXXCategoryAtIndex().}

FormList[] Property ModAddedWsCategories Auto Const
{Array of FormLists of mod added workshop categories.
FormLists are in order, see Index in functions XXXXXCategoryAtIndex().}

Keyword[] Property ModAddedWsCategoryKeywords Auto Const
{Array of Keywords of mod added workshop categories.
Keywords are in order, see Index in functions XXXXXCategoryAtIndex().}

;/ ------------------------------------------------------

	Legnth of the arrays should match.
	Elements of the arrays need to be in the same order.

------------------------------------------------------- /;



; To call: Console "CQF MyQuest RemoveCategoryAtIndex X" (replace X with Index)
; Removes the mod added workshop category from the formlist of the vanilla workshop category at Index
; Index values: From 0 to FormListArray.Length-1
Function RemoveCategoryAtIndex(Int Index=-1)

	; Variables
	FormList VanillaWsCategory
	FormList ModAddedWsCategory
	Keyword ModAddedWsCategoryKeyword

	If Index >= 0

		; Get elements at Index
		VanillaWsCategory = VanillaWsCategories[Index]
		ModAddedWsCategory = ModAddedWsCategories[Index]
		ModAddedWsCategoryKeyword = ModAddedWsCategoryKeywords[Index]

		; Remove the mod added formlist and its keyword from the vanilla workshop category
		VanillaWsCategory.RemoveAddedForm(ModAddedWsCategories)
		VanillaWsCategory.RemoveAddedForm(ModAddedWsCategoryKeyword)

	EndIf

EndFunction

; To call: Console "CQF MyQuest AddCategoryAtIndex X" (replace X with Index)
; Adds the mod added workshop category to the formlist of the vanilla workshop category at Index
; Index values: From 0 to FormListArray.Length-1
Function AddCategoryAtIndex(Int Index=-1)

	; Variables
	FormList VanillaWsCategory
	FormList ModAddedWsCategory
	Keyword ModAddedWsCategoryKeyword

	If Index >= 0

		; Get elements at Index
		VanillaWsCategory = VanillaWsCategories[Index]
		ModAddedWsCategory = ModAddedWsCategories[Index]
		ModAddedWsCategoryKeyword = ModAddedWsCategoryKeywords[Index]

		; Add the mod added formlist and its keyword to the vanilla workshop category
		VanillaWsCategory.AddForm(ModAddedWsCategories)
		VanillaWsCategory.AddForm(ModAddedWsCategoryKeyword)

	EndIf

EndFunction

Function RevertAllVanillaMenus()

	Int Index = VanillaWsCategories.Length-1
	If Index > 0
		While Index >= 0
			FormList VanillaWsCategory = VanillaWsCategories[Index]
			If VanillaWsCategory
				Int Index0 = ModAddedWsCategories.Length-1
				If Index0 > 0
					While Index0 >= 0
						FormList ModAddedWsCategory = ModAddedWsCategories[Index]
						If ModAddedWsCategory
							VanillaWsCategory.RemoveAddedForm(ModAddedWsCategory)
						EndIf
						Index0 = Index0 - 1
					EndWhile
				EndIf
				Int Index1 = ModAddedWsCategoryKeywords.Length-1
				If Index1 > 0
					While Index1 >= 0
						Keyword ModAddedWsCategoryKeyword = ModAddedWsCategoryKeywords[Index]
						If ModAddedWsCategoryKeyword
							VanillaWsCategory.RemoveAddedForm(ModAddedWsCategoryKeyword)
						EndIf
						Index1 = Index1 - 1
					EndWhile
				EndIf
			EndIf
			VanillaWsCategory.Revert()
			Index = Index - 1
		EndWhile
	EndIf

EndFunction

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...