irswat Posted January 20, 2017 Share Posted January 20, 2017 I'm making my first MCM menu for a mod I'm working on. I'm running into two problems:1.) I created a quest SVCE_MCM and attached a script SVCE_MCM_Menu2.) I created PlayerAlias in that quest and filled it with PlayerRef.3.) I tried attaching SKI_PlayerLoadGameAlias to the playeralias, as per MCM instruction, but I'm getting the error:"Script ski_playerloadgamealias had errors while loading, it will not be added to the object."The second problem, and I can't help but wonder if they are related. When I try to compile my MCM quest script I'm getting "No viable alternative at input."Here is the script: scriptname SVCE_MCM_Menu extends SKI_ConfigBase int inputMENU_ID_GOphrase int inputMENU_ID_GOkey string GOphrase int GOkey event OnConfigInit() Pages = new string[1] Pages[0] = "SVCE Customization" endEvent event OnPageReset(string page) ;float fSKSE = SKSE.GetVersion() + SKSE.GetVersionMinor() * 0.01 + SKSE.GetVersionBeta() * 0.0001 float fSKSE_version=SKSE.GetVersion() + SKSE.GetVersionMinor() * 0.01 + SKSE.GetVersionBeta() * 0.0001 int iSKSE_version=SKSE.GetVersionRelease() if (iSKSE_version==0) debug.notification("SKSE is not installed. Skyrim Voice Command Engine not initializing.") elseif (fSKSE_version != 1.0703) debug.notification("SKSE version 1.7.3 needed. Skyrim Voice Command Engine not initializing.") else SetCursorFillMode(TOP_TO_BOTTOM) inputMENU_ID_GOphrase=AddInputOption("Change 'GO' Command", GOphrase) AddEmptyOption() inputMENU_ID_GOkey=AddKeyMapOption("Click here to change 'GO' key binding. (default: left ctrl)", GOkey) endif endEvent event OnOptionInputOpen(int option) if (option == inputMENU_ID_GOphrase) ; Fill input box with current value SetInputDialogStartText(G0phrase) endIf endEvent event OnOptionInputAccept(int option, string input) if (option == inputMENU_ID_GOphrase) ;this is where I can add exception handling for people typing weird things. GOphrase=input SetInputOptionValue(inputMENU_ID_GOphrase, GOphrase) debug.notification("GO phrase changed to " + GOphrase) endIf endEvent event OnOptionKeyMapChange(int option, int keyCode, string conflictControl, string conflictName) if (option == inputMENU_ID_GOkey) GOkey = keyCode SetKeyMapOptionValue(inputMENU_ID_GOkey, GOkey) endIf endEvent the block that the compiler is flagging is: if (iSKSE_version==0) debug.notification("SKSE is not installed. Skyrim Voice Command Engine not initializing.") Any ideas? Link to comment Share on other sites More sharing options...
irswat Posted January 20, 2017 Author Share Posted January 20, 2017 I think the problem was I needed the SkyUI SDK, which isn't mentioned on the SkyUI MCM Quickstart page. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted January 20, 2017 Share Posted January 20, 2017 I think the problem was I needed the SkyUI SDK, which isn't mentioned on the SkyUI MCM Quickstart page.Actually it is. And yes, that was most likely the problem. Quoted from the introduction on the quickstart page In case you were linked to this guide directly from somewhere else, you should have a look at the overview first, especially to get the SkyUI SDK files: https://github.com/schlangster/skyui/wiki/ Link to comment Share on other sites More sharing options...
irswat Posted January 20, 2017 Author Share Posted January 20, 2017 :-Dwhoops Link to comment Share on other sites More sharing options...
irswat Posted January 20, 2017 Author Share Posted January 20, 2017 1.) What is the easiest way to save a string to a global variable? an int?2.) Will global variables be saved with save game file? I have 2 options in my MCM menu. The first is change a hotkey. The second is change a word that is used in the quest script for my mod. I will need to retrieve the key and string on init, to use in another script. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted January 20, 2017 Share Posted January 20, 2017 1. You cannot store a string to a global variable, only INT or FLOAT.2. As long as it is not flagged as constant, its current value will be reflected in the save file. The hotkey's DXScanCode value can be stored in a global variable if you wish. The string, you'll need to create a property that points to your MCM script and retrieve the value stored there. Syntax would be:NameOfScript Property VariableName Auto Usage would be:VariableName.MyString When filling the property, you assign the object which the script is attached to. For other ways to access functions & variables from another script, please see: http://www.creationkit.com/index.php?title=Variables_and_Properties_(Papyrus)#Getting_Properties_From_Any_Other_ScriptI want to point you to the "Accessing functions from other scripts" that is linked on that page, but for some reason the CK wiki keeps returning a 502 error. Link to comment Share on other sites More sharing options...
irswat Posted January 20, 2017 Author Share Posted January 20, 2017 (edited) thanks. Good to know Bethesda are a bunch of convoluted masochists. do you know how to use SetCursorPosition() to get the top middle of the page? Edited January 20, 2017 by irswat Link to comment Share on other sites More sharing options...
irswat Posted January 20, 2017 Author Share Posted January 20, 2017 I'm not sure I understand:I have a MCM Menu script, which is called SVCE_MCM_Menu. I have the script for the parser engine called SVCE_Parser_Engine. Are you saying I create another script called lets say SVCE_GV_Manager and in there put something like: scriptname SVCE_GV_Manager extends Quest GlobalVariable Property gCMDKey Auto SVCE_MCM_Menu Property gGO_CMD Auto I attach this to the same quest as the SVCE_MCM_Menu, or to the quest with the SVCE_Parser_Engine?In SVCE_MCM_MENU I need to set the values, so in there I would do: gCMDKey.SetValue(keyPressed) SVCE_GV_Manager.gGO_CMD.SetValue(stringuserentered) and in SVCE_Parser_Engine when I need to get the values i would do: int CMDkey=gCMDKey.GetValue() string GO_CMD=SVCE_GV_Manager.gGO_CMD.GetValue() ? Link to comment Share on other sites More sharing options...
cdcooley Posted January 20, 2017 Share Posted January 20, 2017 If SVCE_Parser_Engine is the script that's really going to use the variable values then simply declare them as properties in that script. (I chose names here to match what was in the MCM script but you could name them CMDKey and GO_CMD in both places instead if you prefer.) ScriptName SVCE_Parser_Engine extends Quest int Property GOkey Auto string Property GOphrase Auto Then in the SVCE_MCM_Menu you access them through a property that points to the quest (or whatever other object) has the SVCE_Parser_Engine script attached. (Which I'm calling ParserEngineScriptObject for lack of a better name.) scriptname SVCE_MCM_Menu extends SKI_ConfigBase SVCE_Parser_Engine Property ParserEngineScriptObject Auto event OnConfigInit() Pages = new string[1] Pages[0] = "SVCE Customization" endEvent event OnPageReset(string page) if (SKSE.GetVersionRelease() < 48) debug.notification("SKSE version 1.7.3 needed. Skyrim Voice Command Engine not initializing.") else SetCursorFillMode(TOP_TO_BOTTOM) inputMENU_ID_GOphrase=AddInputOption("Change 'GO' Command", ParserEngineScriptObject.GOphrase) AddEmptyOption() inputMENU_ID_GOkey=AddKeyMapOption("Click here to change 'GO' key binding. (default: left ctrl)", ParserEngineScriptObject.GOkey) endif endEvent event OnOptionInputOpen(int option) if (option == inputMENU_ID_GOphrase) ; Fill input box with current value SetInputDialogStartText(ParserEngineScriptObject.G0phrase) endIf endEvent event OnOptionInputAccept(int option, string value) if (option == inputMENU_ID_GOphrase) ;this is where I can add exception handling for people typing weird things. ParserEngineScriptObject.GOphrase = value SetInputOptionValue(inputMENU_ID_GOphrase, value) endIf endEvent event OnOptionKeyMapChange(int option, int keyCode, string conflictControl, string conflictName) if (option == inputMENU_ID_GOkey) ParserEngineScriptObject.GOkey = keyCode SetKeyMapOptionValue(inputMENU_ID_GOkey, keyCode) endIf endEvent I also shortened and corrected your SKSE version check. The method you used seems to be popular but but the SKSE team have stated that you should not be trying to build a floating point number from the version components simply to check compatibility. And since the MCM system itself requires SKSE the only potential problem would be the wrong version of SKSE. Personally I would rewrite that MCM using the newer State system because I think it makes it more readable. scriptname SVCE_MCM_Menu extends SKI_ConfigBase SVCE_Parser_Engine Property ParserEngineScriptObject Auto Event OnConfigInit() Pages = new string[1] Pages[0] = "SVCE Customization" EndEvent Event OnPageReset(string page) SetCursorFillMode(TOP_TO_BOTTOM) if (SKSE.GetVersionRelease() < 48) AddHeaderOption("SKSE version 1.7.3 or higher needed."); AddHeaderOption("Skyrim Voice Command Engine not available.") else AddInputOptionST("GoCmd", "'GO' Command", ParserEngineScriptObject.GOphrase) AddEmptyOption() AddKeyMapOptionST("GoKey", "'GO' Key", ParserEngineScriptObject.GOkey) endif EndEvent State GoKey Event OnHighlightST() SetInfoText("Change 'GO' key binding. (default: left ctrl)") EndEvent Event OnDefaultST() OnKeyMapChangeST(29,"","") ; left ctrl (must also be set as default in the other script) EndEvent Event OnKeyMapChangeST(int keyCode, string conflictControl, string conflictName) ; example sanity checking code if keyCode == 1 || (keyCode > 255 && !Game.UsingGamepad()) ShowMessage("$SKI_MSG1", false, "$OK", "$Cancel") return endif ; you might want to unregister the old key first ;ParserEngineScriptObject.UnregisterForKey(ParserEngineScriptObject.GOkey) ParserEngineScriptObject.GOkey = keyCode SetKeyMapOptionValueST(keyCode, false, "") ; you might want to register the new key automatically here ;ParserEngineScriptObject.RegisterForKey(keyCode) EndEvent EndState State GoCmd Event OnHighlightST() SetInfoText("Change 'GO' command.") ; is there a default? EndEvent Event OnDefaultST() SetInputDialogStartText("") ; is there a default? EndEvent Event OnInputAcceptST(string value) ;this is where I can add exception handling for people typing weird things. ParserEngineScriptObject.GOphrase = value SetInputOptionValueST(value) EndEvent EndState Link to comment Share on other sites More sharing options...
irswat Posted January 20, 2017 Author Share Posted January 20, 2017 THANK YOU SO MUCH! Link to comment Share on other sites More sharing options...
Recommended Posts