IsharaMeradin Posted August 25, 2016 Share Posted August 25, 2016 What is the best method to start a quest that needs to be started after an option has been selected in the MCM menu? I know if it is simply started in the MCM menu it can lock up the entire MCM menu system. Something about latency or that the Start() command can only run when the game is not paused. I know that if I wait till OnConfigClose event to call it, it can still cause issues with other MCM menus. The same is true if calling a function on another script from the OnConfigClose event. I'm leaning towards RegisterForSingleUpdate(x) in the OnConfigClose event and an OnUpdate() event on a second script attached to the same quest. The OnUpdate() is conditioned to only start the quest if IsInMenuMode is false else it re-registers. But I want to make sure that there isn't a better way first. Link to comment Share on other sites More sharing options...
cdcooley Posted August 25, 2016 Share Posted August 25, 2016 You can register for updates even before quests are started. Quest scripts are always available. You can use its variables, call its functions, and even register for events at any time whether the quest is running or not. The only real quirks are that when you start the quest all variables get reset and when you stop the quest all registrations get cleared. If you're not already planning to use game time update events on that quest just put this in the quest script. Event OnUpdateGameTime() Start() EndEvent And even if you are, you can do this. Event OnUpdateGameTime() if !IsRunning() Start() else ; do your other stuff endif EndEvent In either case you just register it directly in your MCM at any point you find convenient. TheInterestingQuest.RegisterForSingleUpdateGameTime(0.0001) Using a game time update ensures the game is back out of the MCM before the quest gets started. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted August 26, 2016 Author Share Posted August 26, 2016 I knew that the GameTime variants didn't count the time when paused. Just didn't think that it could be used as a way to wait for the MCM menu system to be closed. You mention calling the registration on the quest(s) that I want to have started. Is there any reason that that is better than using a separate script on the MCM quest? Link to comment Share on other sites More sharing options...
PeterMartyr Posted August 26, 2016 Share Posted August 26, 2016 A Convenient Function Function CloseMCMenu() UI.Invoke("Journal Menu", "_root.QuestJournalFader.Menu_mc.ConfigPanelClose") UI.Invoke("Journal Menu", "_root.QuestJournalFader.Menu_mc.CloseMenu")EndFunction Link to comment Share on other sites More sharing options...
IsharaMeradin Posted August 26, 2016 Author Share Posted August 26, 2016 A Convenient Function Function CloseMCMenu() UI.Invoke("Journal Menu", "_root.QuestJournalFader.Menu_mc.ConfigPanelClose") UI.Invoke("Journal Menu", "_root.QuestJournalFader.Menu_mc.CloseMenu")EndFunctionAnd what is that supposed to do? Link to comment Share on other sites More sharing options...
PeterMartyr Posted August 26, 2016 Share Posted August 26, 2016 A Convenient Function Function CloseMCMenu() UI.Invoke("Journal Menu", "_root.QuestJournalFader.Menu_mc.ConfigPanelClose") UI.Invoke("Journal Menu", "_root.QuestJournalFader.Menu_mc.CloseMenu")EndFunctionAnd what is that supposed to do? It instantly closes the Mod Configuration Menu . Example: Start Quest ClickMe MessegeBox appears " Close Menu to Start Quest" " Yes?, No?" It " ActionScript" to Close MCMenu The finer details I leave to you, don't wanta make it to easy. :geek: Link to comment Share on other sites More sharing options...
cdcooley Posted August 26, 2016 Share Posted August 26, 2016 I knew that the GameTime variants didn't count the time when paused. Just didn't think that it could be used as a way to wait for the MCM menu system to be closed. You mention calling the registration on the quest(s) that I want to have started. Is there any reason that that is better than using a separate script on the MCM quest?The additional script would mean additional properties and memory overhead for no real benefit as far as I can see it. Why have three scripts when two get all of the work done? It is forms that get registered for events not scripts, so if your extra script is on the MCM quest then you might as well just put everything in the MCM script itself. If you prefer you can flip the logic of my original suggestion by registering the MCM quest itself for a game time event and let its OnUpdateGameTime() function call start on the other quest. I've actually done it both ways in my mods. Link to comment Share on other sites More sharing options...
lofgren Posted August 26, 2016 Share Posted August 26, 2016 (edited) I'm fairly certain that registerforupdate doesn't count time when the game is in menu mode. Otherwise a whole bunch of my scripts wouldn't work properly. RegisterForSingleUpdate(1.0) will fire OnUpdate() after 1 second of unpaused real time. That's how I start all of my quests from MCM. There's no need to check if the game is in menu mode because OnUpdate() won't fire in menu mode. I prefer to have my MCM script manage starting/stopping quests rather than register the target quest because it seems more closely associated with the functions of the MCM. That's a purely subjective choice though. Edited August 26, 2016 by lofgren Link to comment Share on other sites More sharing options...
cdcooley Posted August 27, 2016 Share Posted August 27, 2016 I have an MCM page that can start multiple different quests so for me it was easier to attach the update event to the individual quests than to the MCM. But yes if they come as a simple matched pair it's probably cleaner to put the update event in the MCM since typically an MCM script wouldn't have one for any other purpose. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted August 27, 2016 Author Share Posted August 27, 2016 Ended up converting my toggle option bools into an array in the same index order as an already existing formlist that listed all the quests I'd possible need to start based on MCM options. Registered for the update on the MCM and in the update on the MCM used a while loop to check the toggle option bool values and in turn start or stop the quests as needed. This eliminated the need for additional global variables that had been used to let the other script know which quests to start or stop. It also removed a bunch of uniquely named bool variables which slightly shortened the overall length of the script. Link to comment Share on other sites More sharing options...
Recommended Posts