ItsAlways710 Posted December 10, 2021 Author Share Posted December 10, 2021 OnPlayerLoadGame event can only be ran on a player alias script. DOH! I read that too. And even understood it and still did that - I think I was thinking of your example and the player alias script and it all just merged together in this old brain LOL. I will revisit that and post an update, pretty sure that will be the finishing piece :smile: Thank you!!! -IA710 Link to comment Share on other sites More sharing options...
Sphered Posted December 10, 2021 Share Posted December 10, 2021 Can also apply an ability spell, or wear a biped-free armor token or something with a chant to proc the event too Prolly wouldnt do this in a release, but for your own use you can hijack a vanilla alias script and add a PlayerLoadGame event to that too and not need a plugin. Dont change the script otherwise just add that. RemoveSilenceMUS is always going and can watch that for example Link to comment Share on other sites More sharing options...
ItsAlways710 Posted December 10, 2021 Author Share Posted December 10, 2021 I hadn't considered an enchantment, I LOVE enchantments hehe.... I may end up just keeping the script the way it is but with the weird OnGameLoad event, I down-graded my laptop from AE to SE to rule out this being an issue on my gaming rig, and am beginning to think that either the changes we have made have improved it enough, or that there is something going on with my gaming rig. I'll kill an hour or two on the laptop to verify, but it ran well for a 30 min period at lunch today, so hopefully we have it cleaned up enough. Does anyone know anyone who enjoys testing mods? I hate to just drop a google drive link on reddit in SkyrimModding or something... -IA710 Link to comment Share on other sites More sharing options...
ItsAlways710 Posted December 14, 2021 Author Share Posted December 14, 2021 All, Wanted to post somewhat final code for anyone else who is following this thread to kind of close it out - this has been tested for hours now and works perfectly as far as I can tell. Doesn't work in AE if you assign a hotkey, but that is the case with every hotkey mod I have tested in AE, I read in a thread somewhere that a future version of SKSE will fix that. It's rock solid in SE 1.5.97. Scriptname IA710_HandyCrafting_MCM_Script extends SKI_ConfigBase IA710_HandyCraftingScript PROPERTY HandyCrafting auto ; pointer to script "IA710_HandyCraftingScript.psc" Message PROPERTY IA710_mUninstallMessage auto ; {Final instructions to follow to complete uninstallation.} Spell PROPERTY IA710_spFortifyCraftingWeight auto ; {Used to remove the spell from the player, in case something went wrong.} Spell[] PROPERTY HandySpellsList auto ; Array with spell lists as follow: ; [0] = Handy Store and Retrieve Spell ; [1] = Handy Conjure Ghost Mount Spell ; [2] = Handy Teleport Spell ; [3] = Handy Bag of Holding Spell FormList PROPERTY IA710_flAllIngredients auto ; {Holds all of the ingredients from the other lists.} FormList[] PROPERTY IngredientsList auto ; {Contains all the vanilla ingredient lists} ; 0 = Alchemy ; 1 = Carpentry ; 2 = Cooking ; 3 = Enchanting ; 4 = Milling ; 5 = Smelting ; 6 = Smithing ; 7 = Tanning ; 8 = Tempering ; 9 = Protected ObjectReference PROPERTY IA710_cIngredientStorageRef auto ; {Master container hold all the stored ingredients.} ObjectReference PROPERTY IA710_cTemporaryHoldingRef auto ; {Container that holds Protected ingredients while the player is crafting.} ObjectReference PROPERTY IA710_cCappingChestRef auto ; {Container tha holds the Capping ingredients list.} ObjectReference PROPERTY IA710_cBagofHoldingREF auto ; {Container Ref that holds Bag of Holding stored items} ObjectReference PROPERTY IA710_cRetrieveStorageRef auto ; {Temprarily Holds list specific ingredients while retrieving them} ObjectReference[] PROPERTY IngredientContainerRef auto ; {The containers for each of the corresponding ingredient lists} String PROPERTY ThousandsSeperator = "," auto ; {The thousands seperator used in formatting the item count numbers. Default: ,} Int[] HSKeyMap Int HSLMax Int current_version = 0 EVENT OnKeyDown(Int keycode) ;============== IF (keyCode == 1) RETURN ; - STOP - ENDIF ;--------------------- gotoState("Busy") ; ### STATE ### prevent the event from piling up with multiple keypress myF_Process(keycode) gotoState("") ; ### STATE ### back to normal ENDEVENT EVENT OnVersionUpdate(Int version) ;==================== IF (version > current_version) Debug.Trace(" OnVersionUpdate() - is updating the script to version " +version+ " -- " +self) OnConfigInit() ENDIF ENDEVENT EVENT OnConfigInit() ;================= ; Pages = new string[3] Pages[0] = "List Maintenance" Pages[1] = "Configuration" Pages[2] = "Uninstall" myF_Revert() actor player = Game.GetPlayer() player.AddSpell(HandySpellsList[0], abVerbose = False) player.AddSpell(HandySpellsList[1], abVerbose = False) player.AddSpell(HandySpellsList[2], abVerbose = False) player.AddSpell(HandySpellsList[3], abVerbose = False) ; Unregister all keys UnregisterForAllKeys() ; Initialize Hotkey Stuff HSLMax = HandySpellsList.Length ; HSKeyMap does not exist, initialize it, HSKeyMap = Utility.CreateIntArray(HSLMax, -1) current_version = GetVersion() Debug.Notification("Handy Crafting and Spells Initilization Complete") ENDEVENT EVENT OnGameReload() ;================= parent.OnGameReload() ; see "SKI_ConfigBase.psc" myF_Refresh() myF_Revert() ; Some basic maintenance. actor player = Game.GetPlayer() player.RemoveSpell(IA710_spFortifyCraftingWeight) ; Remove the carry weight buff if the player has it on him/her IA710_cTemporaryHoldingRef.RemoveAllItems(player) ; This container should always be empty, but just to be safe IA710_cRetrieveStorageRef.RemoveAllItems(player) ; This container should also always be empty, but just to be safe ; Debug.Notification("Handy Crafting: All Lists Refreshed.") ENDEVENT EVENT OnPageReset(String a_Page) ;================ IF (a_page == "") OnPageReset("List Maintenance") RETURN ; - STOP - recursive call with "Maintenance page" ENDIF ;--------------------- IF (a_page == "List Maintenance") SetCursorFillMode (TOP_TO_BOTTOM) SetTitleText("$The_HandyCrafting_Title") Utility.WaitMenuMode(0.1) ; Show all the ingredient lists on the left side of the page, maintenance and options on the right side. AddHeaderOption("$Ingredients_Lists") AddTextOptionST("IngredientEntryIDState" + 0, "$Alchemy_Ingredients", FormatNumber( IngredientContainerRef[0].GetNumItems() )) AddTextOptionST("IngredientEntryIDState" + 1, "$Carpentry_Ingredients", FormatNumber( IngredientContainerRef[1].GetNumItems() )) AddTextOptionST("IngredientEntryIDState" + 2, "$Cooking_Ingredients", FormatNumber( IngredientContainerRef[2].GetNumItems() )) AddTextOptionST("IngredientEntryIDState" + 3, "$Enchanting_Ingredients", FormatNumber( IngredientContainerRef[3].GetNumItems() )) AddTextOptionST("IngredientEntryIDState" + 4, "$Milling_Ingredients", FormatNumber( IngredientContainerRef[4].GetNumItems() )) AddTextOptionST("IngredientEntryIDState" + 5, "$Smelting_Ingredients", FormatNumber( IngredientContainerRef[5].GetNumItems() )) AddTextOptionST("IngredientEntryIDState" + 6, "$Smithing_Ingredients", FormatNumber( IngredientContainerRef[6].GetNumItems() )) AddTextOptionST("IngredientEntryIDState" + 7, "$Tanning_Ingredients", FormatNumber( IngredientContainerRef[7].GetNumItems() )) AddTextOptionST("IngredientEntryIDState" + 8, "$Tempering_Ingredients", FormatNumber( IngredientContainerRef[8].GetNumItems() )) AddTextOptionST("IngredientEntryIDState" + 9, "$Protected_Ingredients", FormatNumber( IngredientContainerRef[9].GetNumItems() )) AddTextOptionST("OpenCappingContainerState", "$Capped_Ingredients", FormatNumber( IA710_cCappingChestRef.GetNumItems() )) SetCursorPosition(1) AddHeaderOption("$Maintenance") AddTextOptionST("OpenStorageContainerState", "$Open_Storage_Container", FormatNumber(IA710_cIngredientStorageRef.GetItemCount( IA710_flAllIngredients ))) AddTextOptionST("StoreAllIngredientsState", "$Store_All_Ingredients", "") AddTextOptionST("RetrieveAllStoredState", "$Retrieve_All_Items", "") RETURN ; - STOP - ENDIF ;--------------------- IF (a_page == "Configuration") SetTitleText("$The_HandyCrafting_Title") SetCursorFillMode (TOP_TO_BOTTOM) AddHeaderOption("$Options") actor player = Game.GetPlayer() AddToggleOptionST("HCIsEnabledState", "$Enable_HandyCrafting", HandyCrafting.HandyCraftingEnabled) AddToggleOptionST("AllowInDungeonsState", "$Restricted_Mode", !HandyCrafting.AllowInDungeons) AddToggleOptionST("EnableIngCappingState", "$Enable_Capping", HandyCrafting.EnableCapping) AddToggleOptionST("EnabledWeightBuffState","$Increase_Carry_Weight_while_Crafting", HandyCrafting.CraftingWeightBuffEnabled) AddToggleOptionST("AlwaysShowMessagesState", "$Always_Show_Messages", HandyCrafting.AlwaysShowMessages) SetCursorPosition(1) AddHeaderOption ("$Add_Spells_Header") AddToggleOptionST("AddStoreSpellState", "$Add_Store_Ingredients_Power", player.HasSpell(HandySpellsList[0])) AddToggleOptionST("AddMountSpellState", "$Add_Handy_Mount_Spell", player.HasSpell(HandySpellsList[1])) AddToggleOptionST("AddTeleportSpellState", "$Add_Handy_Teleport_Spell", player.HasSpell(HandySpellsList[2])) AddToggleOptionST("AddBOHSpellState", "$Add_Handy_BOH_Spell", player.HasSpell(HandySpellsList[3])) AddEmptyOption() AddHeaderOption("$Add_Handy_Hotkeys") int i = 0 WHILE (i < HSLMax) AddKeyMapOptionST("HSKeyState" + i, HandySpellsList[i].GetName() + " Hotkey", HSKeyMap[i]) i = i + 1 ENDWHILE RETURN ; - STOP - ENDIF ;--------------------- IF (a_page == "Uninstall") SetCursorFillMode (TOP_TO_BOTTOM) SetTitleText("$The_HandyCrafting_Title") AddHeaderOption("$Uninstall") AddTextOptionST("UninstallState", "$Uninstall_HandyCrafting", "") AddEmptyOption() AddHeaderOption("Troubleshooting") AddTextOptionST("RefreshListsState", "Reinitialize and Refresh all lists", "") RETURN ENDIF ENDEVENT ;------------------------ Int FUNCTION GetVersion() ;------------------------ RETURN 1 ENDFUNCTION ;------------------ FUNCTION CloseMCM() ; Closes the MCM and System menus. Brings the player back to game mode. ;------------------ UI.Invoke("Journal Menu", "_root.QuestJournalFader.Menu_mc.ConfigPanelClose") UI.Invoke("Journal Menu", "_root.QuestJournalFader.Menu_mc.CloseMenu") Utility.Wait(0.5) ENDFUNCTION ;-------------------------------------------- FUNCTION myF_SelectSpell(Int i) ;-------------------------------------------- actor player = Game.GetPlayer() bool b = player.HasSpell( HandySpellsList[i] ) IF ( b ) player.RemoveSpell( HandySpellsList[i] ) IF (i == 0) IA710_cRetrieveStorageRef.RemoveAllItems(player) ; option: AddStoreSpellState ENDIF IF (i == 3) IA710_cBagofHoldingREF.RemoveAllItems(player) ; option: AddBOHSpellState ENDIF ELSE player.AddSpell(HandySpellsList[i], abVerbose = False) ENDIF ENDFUNCTION ;--------------------------- FUNCTION myF_AddSpell(Int i) ;--------------------------- actor player = Game.GetPlayer() IF player.HasSpell( HandySpellsList[i] ) RETURN ; - STOP - ENDIF ;--------------------- player.AddSpell( HandySpellsList[i] ) ENDFUNCTION ;------------------------ FUNCTION myF_OnOptionKeyMapChange(Int option, Int keyCode, String conflictControl, String conflictName) ; {Called when a key has been remapped} ;------------------------ bool bOK = TRUE ; bOK = continue IF (keyCode != 1) && (conflictControl != "") string s = "This key is already mapped to:\n\"" + conflictControl ; s = msg IF (conflictName == "") s = s + "\"\n\nAre you sure you want to continue?" ELSE s = s + "\"\n(" + conflictName + ")\n\nAre you sure you want to continue?" ENDIF bOK = ShowMessage(s, TRUE, "$Yes", "$No") ENDIF IF ( bOK ) UnregisterForKey( HSKeyMap[option] ) IF (keyCode != 1) RegisterForKey(keyCode) HSKeyMap[option] = keyCode ENDIF SetKeyMapOptionValueST(keyCode, False, "HSKeyState" + option) ENDIF ENDFUNCTION ;-------------------------------- FUNCTION myF_Process(Int keycode) ;-------------------------------- 1 int i IF Utility.IsInMenuMode() i = 1 ; IsInMenuMode to block when game is paused with menus open ELSEIF UI.IsMenuOpen("Dialogue Menu") i = 2 ; Dialogue Menu check to block when dialog is open ELSEIF UI.IsMenuOpen("Console") i = 3 ; Console check to block when console is open - console does not trigger IsInMenuMode and thus needs its own check ELSEIF UI.IsMenuOpen("Crafting Menu") i = 4 ; Crafting Menu check to block when crafting menus are open - game is not paused so IsInMenuMode does not work ELSEIF UI.IsMenuOpen("MessageBoxMenu") i = 5 ; MessageBoxMenu check to block when message boxes are open - while they pause the game, they do not trigger IsInMenuMode ELSEIF UI.IsMenuOpen("ContainerMenu") i = 6 ; ContainerMenu check to block when containers are accessed - while they pause the game, they do not trigger IsInMenuMode ELSEIF UI.IsTextInputEnabled() i = 7 ; IsTextInputEnabled check to block when editable text fields are open ELSEIF Game.GetPlayer().IsOnMount() i = 8 ; IsOnMount check to block when riding a horse ENDIF IF (i > 0) Debug.Notification("Unable to process Handy hotkey at this time. " +i) RETURN ; - STOP - ENDIF ;--------------------- i = HSKeyMap.Find(keyCode) IF (i < 0) RETURN ; - STOP - key not found! ENDIF HandySpellsList[i].Cast(Game.GetPlayer() as ObjectReference) ENDFUNCTION ;-------------------------------------------- String FUNCTION GetCustomControl(Int keyCode) ; UnUSED internal ;-------------------------------------------- 2 string s = "" int i = 0 WHILE (i < HSLMax) IF (HSKeyMap[i] == keyCode) s = "Handy Crafting: " + HandySpellsList[i].GetName() i = HSLMax ; abort loop ENDIF i = i + 1 ENDWHILE RETURN s ENDFUNCTION ;---------------------------------------------- String FUNCTION FormatNumber(Int aiNumToFormat) ;---------------------------------------------- 3 string s = "" ; s = FormattedNumber IF (aiNumToFormat <= 0) RETURN s ENDIF ;--------- ; 1000000 -> 1,000,000 > 7 s = aiNumToFormat as String ; 1000 -> 1,000 > 3 int i = StringUtil.GetLength(s) IF (i > 3) s = StringUtil.SubString(s, 0, (i - 3)) +ThousandsSeperator+ StringUtil.SubString(s, (i - 3), 3) i = StringUtil.GetLength(s) IF (i > 7) s = StringUtil.SubString(s, 0, (i - 7)) +ThousandsSeperator+ StringUtil.SubString(s, (i - 7), 7) ENDIF ENDIF RETURN s ENDFUNCTION ;--------------------- FUNCTION myF_Refresh() ;--------------------- 4 int i = IngredientsList.Length WHILE (i > 0) i = i - 1 RefreshList(IngredientsList[i], IngredientContainerRef[i]) ENDWHILE i = IA710_cCappingChestRef.GetNumItems() HandyCrafting.CappedIngredientsNum ; ??? HandyCrafting.CappedIngredientsRef = Utility.CreateFormArray(i) HandyCrafting.CappedIngredientsQty = Utility.CreateIntArray(i) WHILE (i > 0) i = i - 1 form fm = IA710_cCappingChestRef.GetNthForm(i) ; fm = CurrentIngredient HandyCrafting.CappedIngredientsRef[i] = fm HandyCrafting.CappedIngredientsQty[i] = IA710_cCappingChestRef.GetItemCount(fm) ENDWHILE ENDFUNCTION ;--------------------------------------------------------------------------------------- FUNCTION RefreshList(FormList aflIngredientList, ObjectReference aorIngredientContainer) ; helper, see myF_Refresh() ;--------------------------------------------------------------------------------------- 5 ; Refreshes a formlist with its associated container ; Used to make sure the formlist contains valid objects int i = aorIngredientContainer.GetNumItems() form[] a = Utility.CreateFormArray(i) ; a = ContainerContents WHILE (i > 0) i = i - 1 a[i] = aorIngredientContainer.GetNthForm(i) ENDWHILE aflIngredientList.Revert() ; clear formlist entries made by script aflIngredientList.Addforms(a) ; add new entries ENDFUNCTION ;-------------------- FUNCTION myF_Revert() ;-------------------- 6 form[] a ; a = ConvertedFormlist IA710_flAllIngredients.Revert() int i = IngredientsList.Length - 1 ; Skip adding Protected Ingredients to the large list. WHILE (i > 0) i = i - 1 a = IngredientsList[i].ToArray() IA710_flAllIngredients.AddForms(a) ENDWHILE ENDFUNCTION ;=States===================================== STATE Busy ;========= EVENT OnKeyDown(Int keycode) ENDEVENT ;======= ENDSTATE ;========= STATE IngredientEntryIDState0 ;========= EVENT OnSelectST() actor player = Game.GetPlayer() CloseMCM() IngredientContainerRef[0].Activate(player as ObjectReference) ENDEVENT EVENT OnHighlightST() SetInfoText("$Alchemy_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE IngredientEntryIDState1 ;========= EVENT OnSelectST() actor player = Game.GetPlayer() CloseMCM() IngredientContainerRef[1].Activate(player as ObjectReference) ENDEVENT EVENT OnHighlightST() SetInfoText("$Carpentry_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE IngredientEntryIDState2 ;========= EVENT OnSelectST() actor player = Game.GetPlayer() CloseMCM() IngredientContainerRef[2].Activate(player as ObjectReference) ENDEVENT EVENT OnHighlightST() SetInfoText("$Cooking_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE IngredientEntryIDState3 ;========= EVENT OnSelectST() actor player = Game.GetPlayer() CloseMCM() IngredientContainerRef[3].Activate(player as ObjectReference) ENDEVENT EVENT OnHighlightST() SetInfoText("$Enchanting_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE IngredientEntryIDState4 ;========= EVENT OnSelectST() actor player = Game.GetPlayer() CloseMCM() IngredientContainerRef[4].Activate(player as ObjectReference) ENDEVENT EVENT OnHighlightST() SetInfoText("$Milling_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE IngredientEntryIDState5 ;========= EVENT OnSelectST() actor player = Game.GetPlayer() CloseMCM() IngredientContainerRef[5].Activate(player as ObjectReference) ENDEVENT EVENT OnHighlightST() SetInfoText("$Smelting_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE IngredientEntryIDState6 ;========= EVENT OnSelectST() actor player = Game.GetPlayer() CloseMCM() IngredientContainerRef[6].Activate(player as ObjectReference) ENDEVENT EVENT OnHighlightST() SetInfoText("$Smithing_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE IngredientEntryIDState7 ;========= EVENT OnSelectST() actor player = Game.GetPlayer() CloseMCM() IngredientContainerRef[7].Activate(player as ObjectReference) ENDEVENT EVENT OnHighlightST() SetInfoText("$Tanning_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE IngredientEntryIDState8 ;========= EVENT OnSelectST() actor player = Game.GetPlayer() CloseMCM() IngredientContainerRef[8].Activate(player as ObjectReference) ENDEVENT EVENT OnHighlightST() SetInfoText("$Tempering_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE IngredientEntryIDState9 ;========= EVENT OnSelectST() actor player = Game.GetPlayer() CloseMCM() IngredientContainerRef[9].Activate(player as ObjectReference) ENDEVENT EVENT OnHighlightST() SetInfoText("$Protected_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE OpenCappingContainerState ;========= EVENT OnSelectST() actor player = Game.GetPlayer() CloseMCM() IA710_cCappingChestRef.AddInventoryEventFilter(IA710_flAllIngredients) IA710_cCappingChestRef.Activate(player as ObjectReference) ENDEVENT EVENT OnHighlightST() SetInfoText("$Capped_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE OpenStorageContainerState ;========= EVENT OnSelectST() actor player = Game.GetPlayer() CloseMCM() IA710_cIngredientStorageRef.Activate(player as ObjectReference) ENDEVENT EVENT OnHighlightST() SetInfoText("$Open_Storage_Container_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE StoreAllIngredientsState ;========= EVENT OnSelectST() actor player = Game.GetPlayer() IA710_cIngredientStorageRef.RemoveAllItems(player) ; Store any Protected ingredients in the temporary container player.RemoveItem(IngredientsList[9], player.GetItemCount(IngredientsList[9]), abSilent = True, akOtherContainer = IA710_cTemporaryHoldingRef) ; Search through the capped ingredients list for excess ingredients in the players inventory int i = IA710_cCappingChestRef.GetNumItems() WHILE (i > 0) i = i - 1 form fm = IA710_cCappingChestRef.GetNthForm(i) ; fm = IngredientToCap int QuantityToCap = player.GetItemCount(fm) - IA710_cCappingChestRef.GetItemCount(fm) ; Set any excess ingredients aside in the temporary holding container IF (QuantityToCap > 0) player.RemoveItem(fm, QuantityToCap, abSilent = True, akOtherContainer = IA710_cTemporaryHoldingRef) ENDIF ENDWHILE ; Store all the remaining ingredients player.RemoveItem(IA710_flAllIngredients, player.GetItemCount(IA710_flAllIngredients), abSilent = True, akOtherContainer = IA710_cIngredientStorageRef) ; Retreive the Protected items from the temporary holding container IA710_cTemporaryHoldingRef.RemoveAllItems(player) ShowMessage("$Ingredients_Stored", False) SetTextOptionValueST(FormatNumber(IA710_cIngredientStorageRef.GetItemCount(IA710_flAllIngredients)), False, "OpenStorageContainerState") ENDEVENT EVENT OnHighlightST() SetInfoText("$Store_All_Ingredients_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE RetrieveAllStoredState ;========= EVENT OnSelectST() actor player = Game.GetPlayer() IA710_cBagofHoldingREF.RemoveAllItems(player) IA710_cRetrieveStorageRef.RemoveAllItems(player) IA710_cIngredientStorageRef.RemoveAllItems(player) IA710_cTemporaryHoldingRef.RemoveAllItems(player) SetTextOptionValueST(FormatNumber(IA710_cIngredientStorageRef.GetItemCount(IA710_flAllIngredients)), False, "OpenStorageContainerState") ShowMessage("$All_Items_Retrieved", False) ENDEVENT EVENT OnHighlightST() SetInfoText("$Retrieve_All_Items_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE HCIsEnabledState ;========= EVENT OnSelectST() HandyCrafting.HandyCraftingEnabled = !HandyCrafting.HandyCraftingEnabled SetToggleOptionValueST(HandyCrafting.HandyCraftingEnabled) ENDEVENT EVENT OnDefaultST() HandyCrafting.HandyCraftingEnabled = TRUE ; TRUE SetToggleOptionValueST(HandyCrafting.HandyCraftingEnabled) ; enabled ENDEVENT EVENT OnHighlightST() SetInfoText("$WeightlessInfo") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE AllowInDungeonsState ;========= EVENT OnSelectST() HandyCrafting.AllowInDungeons = !HandyCrafting.AllowInDungeons SetToggleOptionValueST(!HandyCrafting.AllowInDungeons) ENDEVENT EVENT OnDefaultST() HandyCrafting.AllowInDungeons = TRUE ; TRUE SetToggleOptionValueST(!HandyCrafting.AllowInDungeons) ; opposite here ENDEVENT EVENT OnHighlightST() SetInfoText("$Restricted_Mode_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE EnableIngCappingState ;========= EVENT OnSelectST() HandyCrafting.EnableCapping = !HandyCrafting.EnableCapping SetToggleOptionValueST(HandyCrafting.EnableCapping) ENDEVENT EVENT OnDefaultST() HandyCrafting.EnableCapping = TRUE ; TRUE SetToggleOptionValueST(HandyCrafting.EnableCapping) ; enable ENDEVENT EVENT OnHighlightST() SetInfoText("$Enable_Capping_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE EnabledWeightBuffState ;========= EVENT OnSelectST() HandyCrafting.CraftingWeightBuffEnabled = !HandyCrafting.CraftingWeightBuffEnabled SetToggleOptionValueST(HandyCrafting.CraftingWeightBuffEnabled) ENDEVENT EVENT OnDefaultST() HandyCrafting.CraftingWeightBuffEnabled = TRUE ; TRUE SetToggleOptionValueST(HandyCrafting.CraftingWeightBuffEnabled) ; enabled ENDEVENT EVENT OnHighlightST() SetInfoText("$Enable_Weight_Buff_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE AlwaysShowMessagesState ;========= EVENT OnSelectST() HandyCrafting.AlwaysShowMessages = !HandyCrafting.AlwaysShowMessages SetToggleOptionValueST(HandyCrafting.AlwaysShowMessages) ENDEVENT EVENT OnDefaultST() HandyCrafting.AlwaysShowMessages = TRUE ; TRUE SetToggleOptionValueST(HandyCrafting.AlwaysShowMessages) ; always show messages ENDEVENT EVENT OnHighlightST() SetInfoText("$Always_Show_Messages_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE AddStoreSpellState ;========= EVENT OnSelectST() actor player = Game.GetPlayer() myF_SelectSpell(0) SetToggleOptionValueST(player.HasSpell(HandySpellsList[0])) ENDEVENT EVENT OnDefaultST() myF_AddSpell(0) SetToggleOptionValueST(True) ENDEVENT EVENT OnHighlightST() SetInfoText("$Add_Store_Ingedients_Power_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE AddMountSpellState ;========= EVENT OnSelectST() actor player = Game.GetPlayer() myF_SelectSpell(1) SetToggleOptionValueST(player.HasSpell(HandySpellsList[1])) ENDEVENT EVENT OnDefaultST() myF_AddSpell(1) SetToggleOptionValueST(True) ENDEVENT EVENT OnHighlightST() SetInfoText("$Add_Handy_Mount_Spell_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE AddTeleportSpellState ;========= EVENT OnSelectST() actor player = Game.GetPlayer() myF_SelectSpell(2) SetToggleOptionValueST(player.HasSpell(HandySpellsList[2])) ENDEVENT EVENT OnDefaultST() myF_AddSpell(2) SetToggleOptionValueST(True) ENDEVENT EVENT OnHighlightST() SetInfoText("$Add_Handy_Teleport_Spell_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE AddBOHSpellState ;========= EVENT OnSelectST() actor player = Game.GetPlayer() myF_SelectSpell(3) SetToggleOptionValueST(player.HasSpell(HandySpellsList[3])) ENDEVENT EVENT OnDefaultST() myF_AddSpell(3) SetToggleOptionValueST(True) ENDEVENT EVENT OnHighlightST() SetInfoText("$Add_Handy_BOH_Spell_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE HSKeyState0 ;========= EVENT OnKeyMapChangeST(Int keyCode, String conflictControl, String conflictName) myF_OnOptionKeyMapChange(0, keycode, conflictControl, conflictName) ENDEVENT EVENT OnDefaultST() UnregisterForKey(HSKeyMap[0]) HSKeyMap[0] = -1 SetKeyMapOptionValueST(-1) ENDEVENT EVENT OnHighlightST() SetInfoText("$Set_Handy_Hotkey") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE HSKeyState1 ;========= EVENT OnKeyMapChangeST(Int keyCode, String conflictControl, String conflictName) myF_OnOptionKeyMapChange(1, keycode, conflictControl, conflictName) ENDEVENT EVENT OnDefaultST() UnregisterForKey(HSKeyMap[1]) HSKeyMap[1] = -1 SetKeyMapOptionValueST(-1) ENDEVENT EVENT OnHighlightST() SetInfoText("$Set_Handy_Hotkey") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE HSKeyState2 ;========= EVENT OnKeyMapChangeST(Int keyCode, String conflictControl, String conflictName) myF_OnOptionKeyMapChange(2, keycode, conflictControl, conflictName) ENDEVENT EVENT OnDefaultST() UnregisterForKey(HSKeyMap[2]) HSKeyMap[2] = -1 SetKeyMapOptionValueST(-1) ENDEVENT EVENT OnHighlightST() SetInfoText("$Set_Handy_Hotkey") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE HSKeyState3 ;========= EVENT OnKeyMapChangeST(Int keyCode, String conflictControl, String conflictName) myF_OnOptionKeyMapChange(3, keycode, conflictControl, conflictName) ENDEVENT EVENT OnDefaultST() UnregisterForKey(HSKeyMap[3]) HSKeyMap[3] = -1 SetKeyMapOptionValueST(-1) ENDEVENT EVENT OnHighlightST() SetInfoText("$Set_Handy_Hotkey") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE UninstallState ;========= EVENT OnSelectST() IF ShowMessage("$Confirm_Uninstall") actor player = Game.GetPlayer() CloseMCM() HandyCrafting.ShutDown() UnregisterForAllKeys() player.RemoveSpell(HandySpellsList[3]) player.RemoveSpell(HandySpellsList[2]) player.RemoveSpell(HandySpellsList[1]) player.RemoveSpell(HandySpellsList[0]) IA710_cBagofHoldingREF.RemoveAllItems(player) IA710_cRetrieveStorageRef.RemoveAllItems(player) IA710_cIngredientStorageRef.RemoveAllItems(player) IA710_cTemporaryHoldingRef.RemoveAllItems(player) int i = IngredientContainerRef.Length WHILE (i > 0) i = i - 1 IngredientContainerRef[i].RemoveAllItems() ENDWHILE IA710_mUninstallMessage.Show() self.Stop() ; STOP the QUEST ENDIF ENDEVENT EVENT OnHighlightST() SetInfoText("$Uninstall_Description") ENDEVENT ;========= ENDSTATE ;========= ;========= STATE RefreshListsState ;========= EVENT OnSelectST() OnConfigInit() myF_Refresh() myF_Revert() ShowMessage("Reinitialized MCM and Refreshed all lists.", False) ENDEVENT EVENT OnHighlightST() SetInfoText("Selecting this option will reinitialize the MCM and refresh all lists") ENDEVENT ;========= ENDSTATE ;========= Thank you all for your help, if I post for download I will list all of you in credits! -IA710 Link to comment Share on other sites More sharing options...
ReDragon2013 Posted December 15, 2021 Share Posted December 15, 2021 (edited) All functions which are obsolete (because they are not called inside the MCM script or external from other script) can/should be removed. like this: String FUNCTION GetCustomControl(Int keyCode) ; UnUSED internalKeep in mind the events (in code snippets below) are used for different states. I let them out to make it here more simple for demonstration. old: ;------------------------------ FUNCTION myF_SelectSpell(Int i) ;------------------------------ actor player = Game.GetPlayer() bool b = player.HasSpell( HandySpellsList[i] ) IF ( b ) player.RemoveSpell( HandySpellsList[i] ) IF (i == 0) IA710_cRetrieveStorageRef.RemoveAllItems(player) ; option: AddStoreSpellState ENDIF IF (i == 3) IA710_cBagofHoldingREF.RemoveAllItems(player) ; option: AddBOHSpellState ENDIF ELSE player.AddSpell(HandySpellsList[i], abVerbose = False) ENDIF ENDFUNCTION EVENT OnSelectST() actor player = Game.GetPlayer() myF_SelectSpell(0) SetToggleOptionValueST(player.HasSpell(HandySpellsList[0])) ENDEVENT EVENT OnSelectST() actor player = Game.GetPlayer() myF_SelectSpell(1) SetToggleOptionValueST(player.HasSpell(HandySpellsList[1])) ENDEVENT EVENT OnSelectST() actor player = Game.GetPlayer() myF_SelectSpell(2) SetToggleOptionValueST(player.HasSpell(HandySpellsList[2])) ENDEVENT EVENT OnSelectST() actor player = Game.GetPlayer() myF_SelectSpell(3) SetToggleOptionValueST(player.HasSpell(HandySpellsList[3])) ENDEVENT new: ;------------------------------ FUNCTION myF_SelectSpell(Int i) ;------------------------------ actor player = Game.GetPlayer() bool b = player.HasSpell( HandySpellsList[i] ) IF ( b ) player.RemoveSpell( HandySpellsList[i] ) IF (i == 0) IA710_cRetrieveStorageRef.RemoveAllItems(player) ; option: AddStoreSpellState ENDIF IF (i == 3) IA710_cBagofHoldingREF.RemoveAllItems(player) ; option: AddBOHSpellState ENDIF ELSE player.AddSpell(HandySpellsList[i], abVerbose = False) ENDIF ; added next line SetToggleOptionValueST( !b ) ; take the opposite here, because if spell was found on player it will be removed otherwise added ENDFUNCTION EVENT OnSelectST() myF_SelectSpell(0) ENDEVENT EVENT OnSelectST() myF_SelectSpell(1) ENDEVENT EVENT OnSelectST() myF_SelectSpell(2) ENDEVENT EVENT OnSelectST() myF_SelectSpell(3) ENDEVENT old: EVENT OnSelectST() actor player = Game.GetPlayer() CloseMCM() IngredientContainerRef[0].Activate(player as ObjectReference) ENDEVENT ; ... EVENT OnSelectST() actor player = Game.GetPlayer() CloseMCM() IngredientContainerRef[9].Activate(player as ObjectReference) ENDEVENT EVENT OnSelectST() actor player = Game.GetPlayer() CloseMCM() IA710_cCappingChestRef.AddInventoryEventFilter(IA710_flAllIngredients) IA710_cCappingChestRef.Activate(player as ObjectReference) ENDEVENT EVENT OnSelectST() actor player = Game.GetPlayer() CloseMCM() IA710_cIngredientStorageRef.Activate(player as ObjectReference) ENDEVENT new: ;------------------------------------------ FUNCTION myF_Activate(ObjectReference oRef) ;------------------------------------------ CloseMCM() oRef.Activate(Game.GetPlayer() as ObjectReference) ENDFUNCTION EVENT OnSelectST() myF_Activate( IngredientContainerRef[0] ) ENDEVENT ; ... EVENT OnSelectST() myF_Activate( IngredientContainerRef[9] ) ENDEVENT EVENT OnSelectST() IA710_cCappingChestRef.AddInventoryEventFilter(IA710_flAllIngredients) myF_Activate( IA710_cCappingChestRef ) ENDEVENT EVENT OnSelectST() myF_Activate( IA710_cIngredientStorageRef ) ENDEVENT Edited December 15, 2021 by ReDragon2013 Link to comment Share on other sites More sharing options...
ItsAlways710 Posted December 16, 2021 Author Share Posted December 16, 2021 ReDragon2013, Can't believe I missed that last Unused, thank you. I reviewed your examples and ended up implementing and testing all last night, all went well! Once again, thank you all SO much. Sincerely, -IA710 Link to comment Share on other sites More sharing options...
Recommended Posts