ZombieNL Posted April 2, 2019 Share Posted April 2, 2019 (edited) For my mod Vampire Coffin i try to add a MCM menu to give the player some more options.This is what i want, (don't know if it is possible to do something like this): In the mcm you choose the options you want to see when you activate the shrine in my coffin.The script for the shrine should check witch options are selected (toggled on) and add those to an array.At the same time i add numbers to the new array, together with the correct text labels.Then i add the correct functions so the menu is more then just text. I run into a lot of problems and i need help to fix this mess.This is my MCM script: Scriptname VC_Script_MCM extends SKI_ConfigBase {MCM menu script} ; For all code in this file i used the MCM video tutorials from DarkFox127 as starting point and started working from there. Bool VampireVal0 = True ; Cancel button. This does not not show in mcm menu and therefore always is True. Bool VampireVal1 = True Bool VampireVal2 = False Bool VampireVal3 = True Bool VampireVal4 = False Bool VampireVal5 = False int iVampire1 int iVampire2 int iVampire3 int iVampire4 int iVampire5 bool[] Property VampireVal Auto ; Make the array available for VC_Script_Shrine_MolagBal Event OnConfigInit() Pages = new string[1] Pages[0] = "Config" EndEvent Event OnInit() parent.OnInit() VampireVal = new bool[6] ; storing all bools in array VampireVal[0] = VampireVal0 VampireVal[1] = VampireVal1 VampireVal[2] = VampireVal2 VampireVal[3] = VampireVal3 VampireVal[4] = VampireVal4 VampireVal[5] = VampireVal5 EndEvent Event OnPageReset(string page) If (Page == "") LoadCustomContent("Imaginary_Image") Return Else UnLoadCustomContent() EndIf If (Page == "Config") SetCursorFillMode(TOP_TO_BOTTOM) AddHeaderOption("Vampire Menu") iVampire1 = AddToggleOption("Vampire Armor", VampireVal1) iVampire2 = AddToggleOption("Vampire Armor without fighting", VampireVal2) iVampire3 = AddToggleOption("Ancient Blood", VampireVal3) iVampire4 = AddToggleOption("Cure Vampirism", VampireVal4) iVampire5 = AddToggleOption("Turn into a Lycan", VampireVal5) EndIf EndEvent Event OnOptionSelect(int option) If (CurrentPage == "Config") If (option == iVampire1) VampireVal1 = !VampireVal1 SetToggleOptionValue(iVampire1, VampireVal1) If VampireVal1 == True VampireVal[1] = True VampireVal1 = False Else VampireVal[1] = False VampireVal1 = True EndIf ElseIf (option == iVampire2) VampireVal2 = !VampireVal2 SetToggleOptionValue(iVampire2, VampireVal2) VampireVal2 = VampireVal2 If VampireVal2 == True VampireVal[2] = True VampireVal2 = False Else VampireVal[2] = False VampireVal2 = True EndIf ElseIf (option == iVampire3) VampireVal3 = !VampireVal3 SetToggleOptionValue(iVampire3, VampireVal3) VampireVal3 = VampireVal3 If VampireVal3 == True VampireVal[3] = True VampireVal3 = False Else VampireVal[3] = False VampireVal3 = True EndIf ElseIf (option == iVampire4) VampireVal4 = !VampireVal4 SetToggleOptionValue(iVampire4, VampireVal4) VampireVal4 = VampireVal4 If VampireVal4 == True VampireVal[4] = True VampireVal4 = False Else VampireVal[4] = False VampireVal4 = True EndIf ElseIf (option == iVampire5) VampireVal5 = !VampireVal5 SetToggleOptionValue(iVampire5, VampireVal5) VampireVal5 = VampireVal5 If VampireVal5 == True VampireVal[5] = True VampireVal5 = False Else VampireVal[5] = False VampireVal5 = True EndIf EndIf EndIf EndEvent Event OnOptionDefault(int option) If (option == iVampire1) VampireVal1 = True SetToggleOptionValue(iVampire1, VampireVal1) VampireVal[1] = True ElseIf (option == iVampire2) VampireVal2 = False SetToggleOptionValue(iVampire2, VampireVal2) VampireVal[2] = False ElseIf (option == iVampire3) VampireVal3 = True SetToggleOptionValue(iVampire3, VampireVal3) VampireVal[3] = True ElseIf (option == iVampire4) VampireVal4 = False SetToggleOptionValue(iVampire4, VampireVal4) VampireVal[4] = False ElseIf (option == iVampire5) VampireVal5 = False SetToggleOptionValue(iVampire5, VampireVal5) VampireVal[5] = False EndIf EndEvent Event OnOptionHighlight(int option) If (option == iVampire1) SetInfoText("You want Vampire Armor? You have to fight for it! Default: Enabled") ElseIf (option == iVampire2) SetInfoText("Get the Vampire Armor without fighting. Default: Disabled") ElseIf (option == iVampire3) SetInfoText("Get the Ancient Blood buff. Default: Enabled") ElseIf (option == iVampire4) SetInfoText("Cure Vampirism and remove all powers. Default: Disabled") ElseIf (option == iVampire5) SetInfoText("Cure Vampirism and Turn into a Lycan. Default: Disabled") Else SetInfoText("This MCM menu can be used to choose which options you want to see when you activate the Molag Bal Shrine.") EndIf EndEvent And this is the script for the shrine: Scriptname VC_Script_Shrine_MolagBal extends ObjectReference {Menu Script for Molag Bal Shrine} VC_Script_addCoffin Property RemoteScript Auto ; All functions are stored in VC_Script_addCoffin. I call them when needed with RemoteScript. VC_Script_MCM Property RemoteMCM Auto ; Link to MCM menu script ; Messages for old menu version. In the new menu i should no longer need them. Message Property VC_Msg_ShrineMenu_Vampire Auto Message Property VC_Msg_ShrineMenu_Lycan Auto Message Property VC_Msg_ShrineMenu_Mortal Auto Event onActivate(ObjectReference akActionRef) CheckRace() EndEvent Function CheckRace() RemoteScript.VC_Player_Race() If (RemoteScript.vcRace == 1) ; Player is Vampire VampireMenu() ElseIf (RemoteScript.vcRace == 2) ; Player is Lycan LycanMenu() ElseIf (RemoteScript.vcRace == 3) ; Player is Mortal MortalMenu() EndIf EndFunction Function VampireMenu() ; New version. string[] VampireText = new string[6] ; Array with text labels for menu VampireText[0] = ". Cancel" VampireText[1] = ". Vampire Armor" VampireText[2] = ". Vampire Armor without fighting" VampireText[3] = ". Ancient Blood" VampireText[4] = ". Cure Vampirism and remove all powers" VampireText[5] = ". Cure Vampirism and Turn into a Lycan" int i = 1 ; adding mumbers to menu, starting with 1 int Index = 0 ; for array index and adding matching textlabels from array VampireText string[] VampireMenu ; Creating new menu array from bools who are True While Index < RemoteMCM.VampireVal.Length Debug.Notification("VampireVal " + Index + " = " + RemoteMCM.VampireVal[Index]) ; Temporary notification for testing If RemoteMCM.VampireVal[Index] == True ; Check wich bools are True VampireMenu[Index] = i + VampireText[Index]; adding Textlabels + numbers to menu array ; adding actions to menu Debug.Notification("option " + i + VampireText[Index]) If Index == 0 ElseIf Index == 1 Debug.Notification("Kill the Champion!") ; Temporary text instead of calling the function to prevent NPC from spawning. ; RemoteScript.VamipereArmor() ; Disabled during testing. ElseIf Index == 2 RemoteScript.VamipereArmorCoward() ElseIf Index == 3 RemoteScript.AncientBlood() ElseIf Index == 4 RemoteScript.CureVampire() ElseIf Index == 5 RemoteScript.CureVampire() RemoteScript.CreateLycan() EndIf EndIf Index += 1 i += 1 EndWhile ; At this point the new menu should be complete and stored in the array VampireMenu. Now i need to convert the array to a visible menu. ; The while loop below should display the array VampireMenu and all options in it. I only made this to see if everything works as intended. int p = 0 int L = VampireMenu.Length ; It is supposed to count the number of rows in array VampireMenu after the previous while loop is finished. For some reason this is always 0. Debug.Notification("You have seleted " + L + " Options") ; Temporary notification for testing While p < L Debug.Notification("VampireMenu " + p + " = " + VampireMenu[p]) ; Temporary notification for testing p += 1 EndWhile EndFunction ; Old working versions for lycan and mortal menus. I don't update them until i get the new vampire menu to work. Function LycanMenu (int aiButton = 0) aiButton = VC_Msg_ShrineMenu_Lycan.Show() If aiButton == 0 ; 1. Cancel ElseIf aiButton == 1 ; 2. Cure my Lycantrophy RemoteScript.CureLycan() ElseIf aiButton == 2 ; 3. Cure my Lycantrophy and turn me into a Vampire RemoteScript.CureLycan() RemoteScript.CreateVampire() EndIf EndFunction Function MortalMenu (int aiButton = 0) aiButton = VC_Msg_ShrineMenu_Mortal.Show() If aiButton == 0 ; 1. Cancel ElseIf aiButton == 1 ; 2. Cure all my disseases RemoteScript.CureAllDisseases() ElseIf aiButton == 2 ; 3. Sanguinare Vampiris RemoteScript.DiseaseSV() ElseIf aiButton == 3 ; 4. Turn me into a vampire RemoteScript.CreateVampire() ElseIf aiButton == 4 ; 5. Turn me into a Lycan. This option is not in v1.1, but will be in next release. In the MCM menu i will add the option to toggle this option on or off. RemoteScript.CreateLycan() EndIf EndFunction I added some notes inside the code to explain what i try to do.Both scripts compile just fine, there are no errors. Some of my problems:When i exit the mcm and activate the shrine as a vampire it looks like the options are passed correctly from mcm to the shrine, but when i open the mcm again, all options are set to default again. It is supposed to remember what i selected before.When i activate the shrine as vampire i see all the test notifications just fine, but i always see all of them. not just the ones corrosponding with the options selected in the mcm.At the same time all the functions are started. The If/Else to select the correct functions is being ignored. All this mess is just my attempt to make a new array with only the selected mcm options. I still need a way to display the new array as a menu, but i don't know how to do that.It would not surprise me if i do this all the wrong way. For some reason i always over-complicate things while there is an easier way to do what i want. Edited April 2, 2019 by ZombieNL Link to comment Share on other sites More sharing options...
ZombieNL Posted April 4, 2019 Author Share Posted April 4, 2019 So even after 2 days, still 0 reactions?Do i need to explain better what i try to do?Is it even possible what i want?If it is possible, am i on the right path, or do i need to rebuild my script with totaly different functions/code to make it work?I am completely stuck on this project with no idea what to try next, so any help or info is welcome. Link to comment Share on other sites More sharing options...
ReDragon2013 Posted April 4, 2019 Share Posted April 4, 2019 (edited) script as follow is not tested, not compiled yet You are missing the initialization of second temp array, and for sure good luck with "Now I need to convert the array to a visible menu."No idea how you wish to manage this. Splitting code in functions is really nice, but overview should be given too. VC_Script_Shrine_MolagBal Scriptname VC_Script_Shrine_MolagBal extends ObjectReference {Menu Script for Molag Bal Shrine} ; https://forums.nexusmods.com/index.php?/topic/7534066-mcm-and-shrine-menu-problems/ VC_Script_addCoffin PROPERTY RemoteScript auto ; link to VC_Script_addCoffin, all functions are stored there. (I call them when needed with RemoteScript.) VC_Script_MCM PROPERTY RemoteMCM auto ; link to MCM menu script ; -- EVENTs -- EVENT OnActivate(ObjectReference akActionRef) IF (akActionRef == Game.GetPlayer() as ObjectReference) ELSE RETURN ; - STOP - not the player ENDIF ;--------------------- gotoState("Busy") ; ### STATE ### RemoteScript.VC_Player_Race() ; check for player race and set value for property "vcRace" int i = RemoteScript.vcRace ; get the raceFlag IF (i == 1) VampireMenu() ELSEIF (i == 2) LycanMenu() ELSEIF (i == 3) MortalMenu() ENDIF gotoState("") ; ### STATE ### back to no state ENDEVENT ;================================= state Busy ;========= EVENT OnActivate(ObjectReference akActionRef) ENDEVENT ;======= endState ; -- FUNCTIONs -- 3 ; "Old working versions for lycan and mortal menus. ; I do not update them until I get the new vampire menu to work." Message Property VC_Msg_ShrineMenu_Vampire auto Message Property VC_Msg_ShrineMenu_Lycan auto Message Property VC_Msg_ShrineMenu_Mortal auto ;------------------- FUNCTION LycanMenu() ;------------------- int i = VC_Msg_ShrineMenu_Lycan.Show() IF (i == 0) RETURN ; - STOP - Cancel button ENDIF ;--------------------- RemoteScript.CureLycan() IF (i == 1) ; cure my Lycantrophy only ELSE ; cure my Lycantrophy and turn me into a Vampire RemoteScript.CreateVampire() ENDIF ENDFUNCTION ;-------------------- FUNCTION MortalMenu() ;-------------------- int i = VC_Msg_ShrineMenu_Mortal.Show() IF (i == 0) RETURN ; - STOP - Cancel button ENDIF ;--------------------- IF (i == 1) ; 2. Cure all my disseases RemoteScript.CureAllDisseases() ELSEIF (i == 2) ; 3. Sanguinare Vampiris RemoteScript.DiseaseSV() ELSEIF (i == 3) ; 4. Turn me into a vampire RemoteScript.CreateVampire() ELSE ;IF (i == 4) ; 5. Turn me into a Lycan. This option is not in v1.1, but will be in next release. ; In the MCM menu I will add the option to toggle this option on/off. RemoteScript.CreateLycan() ENDIF ENDFUNCTION ; **************************************************** ; VC_Script_MCM extends SKI_ConfigBase ; bool[] Property VampireVal Auto ;------------------------- FUNCTION myF_Select(Int i) ; internal helper ;------------------------- IF (i == 0) ; nothing ELSEIF (i == 1) Debug.Notification("Kill the Champion!") ; Temporary text instead of calling the function to prevent NPC from spawning. ;RemoteScript.VamipereArmor() ; Disabled during testing. ELSEIF (i == 2) RemoteScript.VamipereArmorCoward() ELSEIF (i == 3) RemoteScript.AncientBlood() ELSEIF (i == 4) RemoteScript.CureVampire() ELSE ;IF (i == 5) RemoteScript.CureVampire() RemoteScript.CreateLycan() ENDIF ENDFUNCTION ;--------------------- FUNCTION VampireMenu() ; New version. ;--------------------- string[] VampireText = new string[6] ; temporarily array with text labels for menu VampireText[0] = ". Cancel" VampireText[1] = ". Vampire Armor" VampireText[2] = ". Vampire Armor without fighting" VampireText[3] = ". Ancient Blood" VampireText[4] = ". Cure Vampirism and remove all powers" VampireText[5] = ". Cure Vampirism and Turn into a Lycan" string[] VampireMenu = new String[128] ; *** creating new menu array from bools who are True, preset with maximum value int c = 0 ; c = L int n = 1 ; n = i adding mumbers to menu, starting with 1 int i = 0 ; i = index for array index and adding matching textlabels from array VampireText WHILE (i < RemoteMCM.VampireVal.Length) Debug.Notification("VampireVal " +i+ " = " + RemoteMCM.VampireVal[i]) ; debugging only !!! bool bOK = RemoteMCM.VampireVal[i] IF ( bOK ) ; check wich bools are True VampireMenu[i] = n + VampireText[i] ; adding Textlabels + numbers to menu array ; adding actions to menu Debug.Notification("option " + n + VampireText[i]) myF_Select(i) c = c + 1 ENDIF n = n + 1 i = i + 1 ENDWHILE ;----------------------------------------------------------------------------------- ; At this point the new menu should be complete and stored in the array VampireMenu. ; Now I need to convert the array to a visible menu. ; The while loop below should display the array VampireMenu and all options in it. ; I only made this to see if everything works as intended. Debug.Notification("You have seleted " + c + " Options") ; debugging only !!! i = 0 WHILE (i < c) Debug.Notification("VampireMenu " + i + " = " + VampireMenu[i]) ; debugging only !!! i = i + 1 ENDWHILE ENDFUNCTION Edited April 4, 2019 by ReDragon2013 Link to comment Share on other sites More sharing options...
ZombieNL Posted April 4, 2019 Author Share Posted April 4, 2019 Your new version compiles just fine, but i have some questions:Do i realy need to check if the shrine is activated by the player?The shrine is located in my pocket dimension. The only NPC in there is my thrall, but she is behind a locked door. Followers should not follow you inside the coffin, but i guess it is not 100% impossible that it can happen. But even if a NPC activates the shrine, what is the harm in that?I never used states before, what does it do?Creating a new function to call the individual functions is a nice idea, but still they all get activated. not just the ones i select in the mcm menu.Here is the new version. I did not just copy/paste your script, but merged it into my own. Scriptname VC_Script_Shrine_MolagBal extends ObjectReference {Menu Script for Molag Bal Shrine} VC_Script_addCoffin Property RemoteScript Auto ; All functions are stored in VC_Script_addCoffin. I call them when needed with RemoteScript. VC_Script_MCM Property RemoteMCM Auto ; Link to MCM menu script Event onActivate(ObjectReference akActionRef) CheckRace() EndEvent Function CheckRace() RemoteScript.VC_Player_Race() If (RemoteScript.vcRace == 1) ; Player is Vampire VampireMenu() ElseIf (RemoteScript.vcRace == 2) ; Player is Lycan LycanMenu() ElseIf (RemoteScript.vcRace == 3) ; Player is Mortal MortalMenu() EndIf EndFunction Function functionSelect(int Index) If Index == 0 ElseIf Index == 1 Debug.Notification("Kill the Champion!") ; Temporary text instead of calling the function to prevent NPC from spawning. ; RemoteScript.VamipereArmor() ; Disabled during testing. ElseIf Index == 2 RemoteScript.VamipereArmorCoward() ElseIf Index == 3 RemoteScript.AncientBlood() ElseIf Index == 4 RemoteScript.CureVampire() ElseIf Index == 5 RemoteScript.CureVampire() RemoteScript.CreateLycan() EndIf EndFunction Function VampireMenu() ; New version. string[] VampireText = new string[6] ; Array with text labels for menu VampireText[0] = ". Cancel" VampireText[1] = ". Vampire Armor" VampireText[2] = ". Vampire Armor without fighting" VampireText[3] = ". Ancient Blood" VampireText[4] = ". Cure Vampirism and remove all powers" VampireText[5] = ". Cure Vampirism and Turn into a Lycan" int c = 0 ; counting the number of rows for the array VampireMenu int i = 1 ; adding mumbers to menu, starting with 1 int Index = 0 ; for array index and adding matching textlabels from array VampireText string[] VampireMenu = new string [128] ; Creating new menu array from bools who are True While Index < RemoteMCM.VampireVal.Length Debug.Notification("VampireVal " + Index + " = " + RemoteMCM.VampireVal[Index]) ; debugging only !!! Index += 1 EndWhile Index = 0 While Index < RemoteMCM.VampireVal.Length If RemoteMCM.VampireVal[Index] == True ; Check wich bools are True VampireMenu[Index] = i + VampireText[Index]; adding Textlabels + numbers to menu array ; adding actions to menu Debug.Notification("option " + i + VampireText[Index]) ; debugging only !!! functionSelect(Index) c += 1 EndIf Index += 1 i += 1 EndWhile ; At this point the new menu should be complete and stored in the array VampireMenu. Now i need to convert the array to a visible menu. ; The while loop below should display the array VampireMenu and all options in it. I only made this to see if everything works as intended. Index = 0 Debug.Notification("You have seleted " + c + " Options") ; debugging only !!! While Index < c Debug.Notification("VampireMenu " + Index + " = " + VampireMenu[Index]) ; debugging only !!! Index += 1 EndWhile EndFunction ; Old working versions for lycan and mortal menus. I don't update them until i get the new vampire menu to work. ; Messages for old menu version. In the new menu i should no longer need them. Message Property VC_Msg_ShrineMenu_Vampire Auto Message Property VC_Msg_ShrineMenu_Lycan Auto Message Property VC_Msg_ShrineMenu_Mortal Auto Function LycanMenu (int aiButton = 0) aiButton = VC_Msg_ShrineMenu_Lycan.Show() If aiButton == 0 ; 1. Cancel ElseIf aiButton == 1 ; 2. Cure my Lycantrophy RemoteScript.CureLycan() ElseIf aiButton == 2 ; 3. Cure my Lycantrophy and turn me into a Vampire RemoteScript.CureLycan() RemoteScript.CreateVampire() EndIf EndFunction Function MortalMenu (int aiButton = 0) aiButton = VC_Msg_ShrineMenu_Mortal.Show() If aiButton == 0 ; 1. Cancel ElseIf aiButton == 1 ; 2. Cure all my disseases RemoteScript.CureAllDisseases() ElseIf aiButton == 2 ; 3. Sanguinare Vampiris RemoteScript.DiseaseSV() ElseIf aiButton == 3 ; 4. Turn me into a vampire RemoteScript.CreateVampire() ElseIf aiButton == 4 ; 5. Turn me into a Lycan. This option is not in v1.1, but will be in next release. In the MCM menu i will add the option to toggle this option on or off. RemoteScript.CreateLycan() EndIf EndFunction string[] VampireMenu = new String[128]Did fix the array, but then you give the array 128 rows by default?I left that out, because you can't know in advance how many rows the array will get.The first debug while loop works fine, displaying the correct bool values.When you open the mcm menu again, you no longer see wich options you selected earlier, but all options are set to default again.The next while loop is still a problem.If i select all 6 options the new menu is build, but at the same time all functions are activated as well. The last debug while loop works as intended.If i select 0,1,2,3,4 or 5 options The menu acts like all options are set to defaultI still have no idea how to convert the array to a menu. I was hoping someone on this forum can help me with this.What do you mean with this?:"Splitting code in functions is really nice, but overview should be given too." Link to comment Share on other sites More sharing options...
IsharaMeradin Posted April 5, 2019 Share Posted April 5, 2019 No idea if your situation has been resolved or not. At any rate, the reason your initial MCM was reverting the choices was due to the following: If VampireVal1 == True VampireVal[1] = True VampireVal1 = False Else VampireVal[1] = False VampireVal1 = True EndIfThe nature of the options are that you make a selection and the bool changes to true or false depending upon the selection made. This bool value is what tells the MCM to display the correct option status. By changing the value inside the option selection, you are effectively telling the MCM that the choice was not made. It should have been as follows: If VampireVal1 == True VampireVal[1] = True Else VampireVal[1] = False EndIf Link to comment Share on other sites More sharing options...
foamyesque Posted April 5, 2019 Share Posted April 5, 2019 I'm not totally sure why there's the independent boolean variables at all. Why not the single array? Maybe another for reset-to-default information. Then you could just do VampireVal[n] = !VampireVal[n] Link to comment Share on other sites More sharing options...
ZombieNL Posted April 5, 2019 Author Share Posted April 5, 2019 No idea if your situation has been resolved or not. At any rate, the reason your initial MCM was reverting the choices was due to the following: If VampireVal1 == True VampireVal[1] = True VampireVal1 = False Else VampireVal[1] = False VampireVal1 = True EndIfThe nature of the options are that you make a selection and the bool changes to true or false depending upon the selection made. This bool value is what tells the MCM to display the correct option status. By changing the value inside the option selection, you are effectively telling the MCM that the choice was not made. It should have been as follows: If VampireVal1 == True VampireVal[1] = True Else VampireVal[1] = False EndIfThe problem was not solved yet, you gave the solution. Thnx! I'm not totally sure why there's the independent boolean variables at all. Why not the single array? Maybe another for reset-to-default information. Then you could just do VampireVal[n] = !VampireVal[n] The initial bools are there for when you load the mcm for the first time. The mcm should have some initial values to build the menu. I chose to make the initial values the same as the default values because i think that makes sense. I don't know how to implement your suggestion into my script. I don't understand your comment enough. Here is my new MCM code: Scriptname VC_Script_MCM extends SKI_ConfigBase {MCM menu script} ; For all code in this file i used the MCM video tutorials from DarkFox127 as starting point and started working from there. Bool VampireVal0 = True ; Cancel button. This does not not show in mcm menu and therefore always is True. Bool VampireVal1 = True Bool VampireVal2 = False Bool VampireVal3 = True Bool VampireVal4 = False Bool VampireVal5 = False int iVampire1 int iVampire2 int iVampire3 int iVampire4 int iVampire5 bool[] Property VampireVal Auto ; Make the array available for VC_Script_Shrine_MolagBal Event OnConfigInit() Pages = new string[1] Pages[0] = "Config" EndEvent Event OnInit() parent.OnInit() VampireVal = new bool[6] ; storing all bools in array VampireVal[0] = VampireVal0 VampireVal[1] = VampireVal1 VampireVal[2] = VampireVal2 VampireVal[3] = VampireVal3 VampireVal[4] = VampireVal4 VampireVal[5] = VampireVal5 EndEvent Event OnPageReset(string page) If (Page == "") LoadCustomContent("Imaginary_Image") Return Else UnLoadCustomContent() EndIf If (Page == "Config") SetCursorFillMode(TOP_TO_BOTTOM) AddHeaderOption("Vampire Menu") iVampire1 = AddToggleOption("Vampire Armor", VampireVal1) iVampire2 = AddToggleOption("Vampire Armor without fighting", VampireVal2) iVampire3 = AddToggleOption("Ancient Blood", VampireVal3) iVampire4 = AddToggleOption("Cure Vampirism", VampireVal4) iVampire5 = AddToggleOption("Turn into a Lycan", VampireVal5) EndIf EndEvent Event OnOptionSelect(int option) If (CurrentPage == "Config") If (option == iVampire1) VampireVal1 = !VampireVal1 SetToggleOptionValue(iVampire1, VampireVal1) If VampireVal1 == True VampireVal[1] = True Else VampireVal[1] = False EndIf ElseIf (option == iVampire2) VampireVal2 = !VampireVal2 SetToggleOptionValue(iVampire2, VampireVal2) VampireVal2 = VampireVal2 If VampireVal2 == True VampireVal[2] = True Else VampireVal[2] = False EndIf ElseIf (option == iVampire3) VampireVal3 = !VampireVal3 SetToggleOptionValue(iVampire3, VampireVal3) VampireVal3 = VampireVal3 If VampireVal3 == True VampireVal[3] = True Else VampireVal[3] = False EndIf ElseIf (option == iVampire4) VampireVal4 = !VampireVal4 SetToggleOptionValue(iVampire4, VampireVal4) VampireVal4 = VampireVal4 If VampireVal4 == True VampireVal[4] = True Else VampireVal[4] = False EndIf ElseIf (option == iVampire5) VampireVal5 = !VampireVal5 SetToggleOptionValue(iVampire5, VampireVal5) VampireVal5 = VampireVal5 If VampireVal5 == True VampireVal[5] = True Else VampireVal[5] = False EndIf EndIf EndIf EndEvent Event OnOptionDefault(int option) If (option == iVampire1) VampireVal1 = True SetToggleOptionValue(iVampire1, VampireVal1) VampireVal[1] = True ElseIf (option == iVampire2) VampireVal2 = False SetToggleOptionValue(iVampire2, VampireVal2) VampireVal[2] = False ElseIf (option == iVampire3) VampireVal3 = True SetToggleOptionValue(iVampire3, VampireVal3) VampireVal[3] = True ElseIf (option == iVampire4) VampireVal4 = False SetToggleOptionValue(iVampire4, VampireVal4) VampireVal[4] = False ElseIf (option == iVampire5) VampireVal5 = False SetToggleOptionValue(iVampire5, VampireVal5) VampireVal[5] = False EndIf EndEvent Event OnOptionHighlight(int option) If (option == iVampire1) SetInfoText("You want Vampire Armor? You have to fight for it! Default: Enabled") ElseIf (option == iVampire2) SetInfoText("Get the Vampire Armor without fighting. Default: Disabled") ElseIf (option == iVampire3) SetInfoText("Get the Ancient Blood buff. Default: Enabled") ElseIf (option == iVampire4) SetInfoText("Cure Vampirism and remove all powers. Default: Disabled") ElseIf (option == iVampire5) SetInfoText("Cure Vampirism and Turn into a Lycan. Default: Disabled") Else SetInfoText("This MCM menu can be used to choose which options you want to see when you activate the Molag Bal Shrine.") EndIf EndEvent I also noticed another problem. When i move my cursor over one of the options in the mcm, i see the correct InfoText, but when my cursor is not on one of the options it should activate this bit of code: Else SetInfoText("This MCM menu can be used to choose which options you want to see when you activate the Molag Bal Shrine.") EndIfBut it never shows the text at all. I know it's only a minor thing, but still i would like it to work. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted April 5, 2019 Share Posted April 5, 2019 That is not how OnOptionHighlight works. It will only display text when an option is highlighted. If you put the mouse over any non-option area, no text will display. Unfortunately, it is working as intended. You could devise a message box that pops up when the MCM is opened for the first time (not every time) which will inform the user of what you wish.My Aesthetic Bolt Quiver mod has a working example of this. Relevant code snippet is as follows: bool DisplayMessage = false event OnPageReset(string a_page) {Called when a new page is selected, including the initial empty page} If DisplayMessage == false ShowMessage("$Notice",false) DisplayMessage = true EndIf ;etc... Link to comment Share on other sites More sharing options...
ZombieNL Posted April 5, 2019 Author Share Posted April 5, 2019 That is not how OnOptionHighlight works. It will only display text when an option is highlighted. If you put the mouse over any non-option area, no text will display. Unfortunately, it is working as intended.Thnx for explaining this, but in that case i just leave it as it is now.My mcm is easy enough to understand as it is. The InfoText was just a litle extra. If the code you showed is producing the message in screenshot 7/9 from your mod-page, then i don't understand why you made it. Isn't this the way all mcm menu's work?First you need to exit all menu's before you can notice any changes. I think i prefere to explain my mcm menu in the description of my mod page. That should be enough. Link to comment Share on other sites More sharing options...
ReDragon2013 Posted April 5, 2019 Share Posted April 5, 2019 (edited) I have doubt that next is changing the option text inside the MCM menu you like. Why?If you end the function VampireMenu() each temp array is thrown away. Function VampireMenu() ; New version. string[] VampireText = new string[6] ; Array with text labels for menu VampireText[0] = ". Cancel" VampireText[1] = ". Vampire Armor" VampireText[2] = ". Vampire Armor without fighting" VampireText[3] = ". Ancient Blood" VampireText[4] = ". Cure Vampirism and remove all powers" VampireText[5] = ". Cure Vampirism and Turn into a Lycan" int c = 0 ; counting the number of rows for the array VampireMenu int i = 1 ; adding mumbers to menu, starting with 1 int Index = 0 ; for array index and adding matching textlabels from array VampireText string[] VampireMenu = new string [128] ; Creating new menu array from bools who are True While Index < RemoteMCM.VampireVal.Length Debug.Notification("VampireVal " + Index + " = " + RemoteMCM.VampireVal[Index]) ; debugging only !!! Index += 1 EndWhile Index = 0 While Index < RemoteMCM.VampireVal.Length If RemoteMCM.VampireVal[Index] == True ; Check wich bools are True VampireMenu[Index] = i + VampireText[Index]; adding Textlabels + numbers to menu array ; adding actions to menu Debug.Notification("option " + i + VampireText[Index]) ; debugging only !!! functionSelect(Index) c += 1 EndIf Index += 1 i += 1 EndWhile ; At this point the new menu should be complete and stored in the array VampireMenu. Now i need to convert the array to a visible menu. ; The while loop below should display the array VampireMenu and all options in it. I only made this to see if everything works as intended. Index = 0 Debug.Notification("You have seleted " + c + " Options") ; debugging only !!! While Index < c Debug.Notification("VampireMenu " + Index + " = " + VampireMenu[Index]) ; debugging only !!! Index += 1 EndWhile EndFunction everything you made with string[] VampireText string[] VampireMenukeeps in this function and will never get transfer to MCM script Edited April 5, 2019 by ReDragon2013 Link to comment Share on other sites More sharing options...
Recommended Posts