ripple Posted April 6, 2012 Share Posted April 6, 2012 (edited) I am trying to set up a toggle via MCM for an auto-Purge Cell Buffer script. The problem is that the toggle script won't save in GECK with NVSE support. Am I doing something wrong? scn zMCMPCBMenuScript short iMaster short iMouseOver short iOption short iTemp float fTemp float fValue reference rList begin GameMode if GetGameRestarted if IsModLoaded "The Mod Configuration Menu.esp" set iMaster to GetModIndex "The Mod Configuration Menu.esp" set rList to BuildRef iMaster 2790 ListAddForm rList zPCBMenuItem endif endif end begin MenuMode 1013 if IsModLoaded "The Mod Configuration Menu.esp" else Return endif if GetUIFloat "StartMenu/MCM/_ActiveMod" == GetModIndex "RHKPCB.esp" set iOption to GetUIFloat "StartMenu/MCM/_ActiveOption" set fValue to GetUIFloat "StartMenu/MCM/_Value" if GetUIFloat "StartMenu/MCM/*:5/SubMenu1/_enable" == 0 SetUIFloat "StartMenu/MCM/_ActiveSubMenu" 1 SetUIFloat "StartMenu/MCM/*:5/SubMenu1/_enable" 1 SetUIString "StartMenu/MCM/*:5/SubMenu1/text/string" "General" SetUIString "StartMenu/MCM/*:8/SubTitle1/string" "Purge Cell Buffers Toggle" set zPCBToggle to 1 endif if GetUIFloat "StartMenu/MCM/_Reset" ;1 - RESET SetUIFloat "StartMenu/MCM/_Reset" 0 SetUIFloat "StartMenu/MCM/*:1/_columns" 1 elseif GetUIFloat "StartMenu/MCM/_Default" ;2 - DEFAULT SetUIFloat "StartMenu/MCM/_Default" 0 SetUIFloat "StartMenu/MCM/_Reset" 1 elseif GetUIFloat "StartMenu/MCM/_NewValue" ;3 - NEW VALUE SetUIFloat "StartMenu/MCM/_NewValue" 0 SetUIFloat "StartMenu/MCM/_Reset" 1 elseif GetUIFloat "StartMenu/MCM/_ShowList" == 1 ;4 - SHOW LIST SetUIFloat "StartMenu/MCM/_ShowList" 2 elseif GetUIFloat "StartMenu/MCM/_ShowScale" == 1 ;5 - SHOW SCALE SetUIFloat "StartMenu/MCM/_ShowScale" 2 elseif GetUIFloat "StartMenu/MCM/_DefaultScale" ;6 - DEFAULT SCALE SetUIFloat "StartMenu/MCM/_DefaultScale" 0 SetUIFloat "StartMenu/MCM/_ShowScale" 2 endif if iMouseover != GetUIFloat "StartMenu/MCM/*:1/_optionID" ;7 - MOUSE-OVER set iMouseover to GetUIFloat "StartMenu/MCM/*:1/_optionID" if iMouseover SetUIFloat "StartMenu/MCM/MCM_Info/visible" 1 if iMouseover == 1 else SetUIFloat "StartMenu/MCM/MCM_Info/visible" 0 endif else SetUIFloat "StartMenu/MCM/MCM_Info/visible" 0 endif endif endif end Edited April 6, 2012 by ripple Link to comment Share on other sites More sharing options...
blove Posted April 6, 2012 Share Posted April 6, 2012 Short iMaster Is the only thing I see offhand. Link to comment Share on other sites More sharing options...
ripple Posted April 6, 2012 Author Share Posted April 6, 2012 Thanks for the suggestion but that didn't fix it :/ Link to comment Share on other sites More sharing options...
blove Posted April 6, 2012 Share Posted April 6, 2012 Oops. Short iMouseover Also the script seems rather short. Isn't there a Reset and New Value section as well? Link to comment Share on other sites More sharing options...
ripple Posted April 6, 2012 Author Share Posted April 6, 2012 (edited) No dice. Still can't save the script. :( Here is the new script: [edit] new script below. Edited April 6, 2012 by ripple Link to comment Share on other sites More sharing options...
tunaisafish Posted April 6, 2012 Share Posted April 6, 2012 iMaster again. Link to comment Share on other sites More sharing options...
ripple Posted April 6, 2012 Author Share Posted April 6, 2012 added 'short iMaster' but...still cannot save. Link to comment Share on other sites More sharing options...
blove Posted April 6, 2012 Share Posted April 6, 2012 (edited) Assuming Toggle is a global, does Toggle and PCBMenuItem exist in the plugin yet? If this is the only option, why use submenus? Edited April 6, 2012 by blove Link to comment Share on other sites More sharing options...
ripple Posted April 6, 2012 Author Share Posted April 6, 2012 (edited) Dear gads, it saved! I edited the script to change the global variable to a more recognizable name, must have messed that up. The problem now is....the menu doesn't show up in game with the other MCM menus..... scn zMCMPCBMenuScript short iMaster short iMouseOver short iOption short iTemp float fTemp float fValue reference rList begin GameMode if GetGameRestarted if IsModLoaded "The Mod Configuration Menu.esp" set iMaster to GetModIndex "The Mod Configuration Menu.esp" set rList to BuildRef iMaster 2790 ListAddForm rList zPCBMenuItem endif endif end begin MenuMode 1013 if IsModLoaded "The Mod Configuration Menu.esp" else Return endif if GetUIFloat "StartMenu/MCM/_ActiveMod" == GetModIndex "RHKPCB.esp" set iOption to GetUIFloat "StartMenu/MCM/_ActiveOption" set fValue to GetUIFloat "StartMenu/MCM/_Value" if GetUIFloat "StartMenu/MCM/_Reset" ;1 - RESET SetUIFloat "StartMenu/MCM/_Reset" 0 SetUIFloat "StartMenu/MCM/*:1/_columns" 2 setUIFloat "StartMenu/MCM/*:1/*:1/_enable" 1 setUIString "StartMenu/MCM/*:1/*:1/_title" "Purge Cell Buffers Toggle" setUIFloat "StartMenu/MCM/*:1/*:1/_altFont" 7 setUIFloat "StartMenu/MCM/*:1/*:1/_type" 5 setUIFloat "StartMenu/MCM/*:1/*:1/_highlight" 0 SetUIFloat "StartMenu/MCM/*:1/*:3/_enable" 1 SetUIString "StartMenu/MCM/*:1/*:3/_title" "Profile" SetUIFloat "StartMenu/MCM/*:1/*:3/_type" 1 SetUIFloat "StartMenu/MCM/*:1/*:3/_indent" 1.5 SetUIFloat "StartMenu/MCM/*:1/*:3/_value" zPCBToggle elseif GetUIFloat "StartMenu/MCM/_Default" ;2 - DEFAULT SetUIFloat "StartMenu/MCM/_Default" 0 SetUIFloat "StartMenu/MCM/_Reset" 1 elseif GetUIFloat "StartMenu/MCM/_NewValue" ;3 - NEW VALUE SetUIFloat "StartMenu/MCM/_NewValue" 0 SetUIFloat "StartMenu/MCM/_Reset" 1 elseif GetUIFloat "StartMenu/MCM/_ShowList" == 1 ;4 - SHOW LIST SetUIFloat "StartMenu/MCM/_ShowList" 2 elseif GetUIFloat "StartMenu/MCM/_ShowScale" == 1 ;5 - SHOW SCALE SetUIFloat "StartMenu/MCM/_ShowScale" 2 elseif GetUIFloat "StartMenu/MCM/_DefaultScale" ;6 - DEFAULT SCALE SetUIFloat "StartMenu/MCM/_DefaultScale" 0 SetUIFloat "StartMenu/MCM/_ShowScale" 2 endif if iMouseover != GetUIFloat "StartMenu/MCM/*:1/_optionID" ;7 - MOUSE-OVER set iMouseover to GetUIFloat "StartMenu/MCM/*:1/_optionID" if iMouseover SetUIFloat "StartMenu/MCM/MCM_Info/visible" 1 if iMouseover == 1 SetUIString "StartMenu/MCM/MCM_Info/string" "Toggles Purge Cell Buffer Timer Script on or off." else SetUIFloat "StartMenu/MCM/MCM_Info/visible" 0 endif else SetUIFloat "StartMenu/MCM/MCM_Info/visible" 0 endif endif endif end Edited April 6, 2012 by ripple Link to comment Share on other sites More sharing options...
Astymma Posted April 11, 2012 Share Posted April 11, 2012 Surprised that saves TBH. In section 1 - RESET is where you define the UI elements and their formatting and what variable holds the value for each. Your Purge Cell Buffers choice doesn't have a variable assigned using:SetUIFloat StartMenu/MCM/*:1/*.1/_value" variableName Your Profile choice has a variable name assigned but it isn't declared anywhere as to type within the script (is it a global?).It's also a String chooser display type and you don't have strings assigned to the values. type 1 UI element presents a list ofString values and the user selects one. Not sure if that was your intent. In section 2 - Default you'd supply code to set default values for the variables used as the values for the UI elements. In section 3 - New Value you'd supply code to set the variables values when they are changed using the UI elements. Um, I also think there is no long version of the "ref" keyword for reference variables, better to use "ref" and not "reference". As an example assuming both a toggle box type display and a string list chooser it would look like so: scn zMCMPCBMenuScript short iMaster short iMouseOver short iOption short iTemp float fTemp float fValue ref rList short sToggle short sString begin GameMode if GetGameRestarted if IsModLoaded "The Mod Configuration Menu.esp" set iMaster to GetModIndex "The Mod Configuration Menu.esp" set rList to BuildRef iMaster 2790 ListAddForm rList zPCBMenuItem endif endif end begin MenuMode 1013 if IsModLoaded "The Mod Configuration Menu.esp" else Return endif if GetUIFloat "StartMenu/MCM/_ActiveMod" == GetModIndex "RHKPCB.esp" set iOption to GetUIFloat "StartMenu/MCM/_ActiveOption" set fValue to GetUIFloat "StartMenu/MCM/_Value" if GetUIFloat "StartMenu/MCM/_Reset" ;1 - RESET SetUIFloat "StartMenu/MCM/_Reset" 0 SetUIFloat "StartMenu/MCM/*:1/_columns" 2 setUIFloat "StartMenu/MCM/*:1/*:1/_enable" 1 setUIString "StartMenu/MCM/*:1/*:1/_title" "Purge Cell Buffers Toggle" setUIFloat "StartMenu/MCM/*:1/*:1/_altFont" 7 setUIFloat "StartMenu/MCM/*:1/*:1/_type" 5 setUIFloat "StartMenu/MCM/*:1/*:1/_highlight" 0 SetUIFloat "StartMenu/MCM/*:1/*:3/_value" sToggle SetUIFloat "StartMenu/MCM/*:1/*:3/_enable" 1 SetUIString "StartMenu/MCM/*:1/*:3/_title" "Profile" SetUIFloat "StartMenu/MCM/*:1/*:3/_type" 1 SetUIFloat "StartMenu/MCM/*:1/*:3/_indent" 1.5 if sString == 1 SetUIString "StartMenu/MCM/*.1/*:3/value/*:1/string" "Option 1" elseif sString == 2 SetUIString "StartMenu/MCM/*.1/*:3/value/*:1/string" "Option 2" elseif sString == 3 SetUIString "StartMenu/MCM/*.1/*:3/value/*:1/string" "Option 3" endif elseif GetUIFloat "StartMenu/MCM/_Default" ;2 - DEFAULT SetUIFloat "StartMenu/MCM/_Default" 0 SetUIFloat "StartMenu/MCM/_Reset" 1 ;assume toggle is off by default set sToggle to 0 ;assume "option 1" enabled by default set sString to 1 elseif GetUIFloat "StartMenu/MCM/_NewValue" ;3 - NEW VALUE SetUIFloat "StartMenu/MCM/_NewValue" 0 SetUIFloat "StartMenu/MCM/_Reset" 1 ;you have defined elements 1 and 3 (but no 2) ;UI changes are element iOption and the new choice is in fValue so we need to put it in our variable if iOption == 1 set sToggle to fValue elseif iOption == 3 set sString to fValue endif elseif GetUIFloat "StartMenu/MCM/_ShowList" == 1 ;4 - SHOW LIST SetUIFloat "StartMenu/MCM/_ShowList" 2 elseif GetUIFloat "StartMenu/MCM/_ShowScale" == 1 ;5 - SHOW SCALE SetUIFloat "StartMenu/MCM/_ShowScale" 2 elseif GetUIFloat "StartMenu/MCM/_DefaultScale" ;6 - DEFAULT SCALE SetUIFloat "StartMenu/MCM/_DefaultScale" 0 SetUIFloat "StartMenu/MCM/_ShowScale" 2 endif if iMouseover != GetUIFloat "StartMenu/MCM/*:1/_optionID" ;7 - MOUSE-OVER set iMouseover to GetUIFloat "StartMenu/MCM/*:1/_optionID" if iMouseover SetUIFloat "StartMenu/MCM/MCM_Info/visible" 1 if iMouseover == 1 SetUIString "StartMenu/MCM/MCM_Info/string" "Toggles Purge Cell Buffer Timer Script on or off." else SetUIFloat "StartMenu/MCM/MCM_Info/visible" 0 endif else SetUIFloat "StartMenu/MCM/MCM_Info/visible" 0 endif endif endif end Link to comment Share on other sites More sharing options...
Recommended Posts