dizietemblesssma Posted September 27, 2020 Share Posted September 27, 2020 I've searched and looked and I'm almost certain that it is not possible to source one script into another as one can often do in shell scripting.But, just in case there's some wild way to do it, I thought I'd just check:) diziet Link to comment Share on other sites More sharing options...
Reneer Posted September 27, 2020 Share Posted September 27, 2020 Some further explanation as to what you are trying to do would be helpful. But, as far as I know, there is no equivalent to the Linux 'source' command functionality in Papyrus. You could approximate it by calling functions from outside scripts, however. Link to comment Share on other sites More sharing options...
dizietemblesssma Posted September 29, 2020 Author Share Posted September 29, 2020 I have a very long mcm script, there are 4 pages but two of them have a total of about 60 states in them, I was wondering if those states could be written in another script/file and imported/sourced. I'm fairly certain it can't from everything I read over the past few months, but obviously I haven't read eveything:) and if you don't ask, you don't find out! diziet Link to comment Share on other sites More sharing options...
Reneer Posted September 29, 2020 Share Posted September 29, 2020 This may or may not work, but you can try using the import syntax. That might do what you're looking for, but I rarely use it myself. Link to comment Share on other sites More sharing options...
Evangela Posted September 29, 2020 Share Posted September 29, 2020 Import just makes it so you don't need to start some functions with the script object they are members of (i.e. Game.GetPlayer() -> GetPlayer()) Link to comment Share on other sites More sharing options...
IsharaMeradin Posted September 29, 2020 Share Posted September 29, 2020 You cannot offload your states to another script. MCM scripts will get rather large. They will hit a point where they will no longer load fully in the Creation Kit. You could write functions that can handle some of the work and have them on another script but not really worth the hassle to do that honestly. While here, here is a tip I learned when doing MCM scripts: Do not process your stuff at the option selection. Instead use the OnConfigClose event to register for a single update and process all your stuff based upon the final value of the various option variables. Why? Some processing is latent and causes the script to hang waiting for the menu to close which in turn leads to issues when switching to another MCM menu without fully exiting. Link to comment Share on other sites More sharing options...
dizietemblesssma Posted September 29, 2020 Author Share Posted September 29, 2020 While here, here is a tip I learned when doing MCM scripts: Do not process your stuff at the option selection. Instead use the OnConfigClose event to register for a single update and process all your stuff based upon the final value of the various option variables. Why? Some processing is latent and causes the script to hang waiting for the menu to close which in turn leads to issues when switching to another MCM menu without fully exiting.Ah, in another MCM menu one of the toggles applies a spell. At this point I have to return to the game before I can do any more in the MCM. Will this allow me to avoid this, or will it still stop me from using other MCM menus? diziet Link to comment Share on other sites More sharing options...
IsharaMeradin Posted September 29, 2020 Share Posted September 29, 2020 If you put off applying the spell until the player exits the menu system, any other menu from any other mod can be accessed. The spell will not actually be applied until the menu system is completely exited. This is because the update timer does not count while the game is paused which it is paused when in the MCM menu system. Link to comment Share on other sites More sharing options...
dizietemblesssma Posted September 29, 2020 Author Share Posted September 29, 2020 So: Event OnConfigClose() ;;;apply spell EndEvent and put the RegisterForSingleUpdate in the spell script? diziet Link to comment Share on other sites More sharing options...
dizietemblesssma Posted September 30, 2020 Author Share Posted September 30, 2020 this is the code that applies the spell: Function dz_activate_changing(Bool var) spell my_spell my_spell = dz_outfits_grant_ability_spell If var == True my_spell.cast(PlayerRef,teammate_ref_slot[index]) EndIf EndFunction as you can see the spell is applied to teammate_ref_slot[index], it occurs to me that if I can visit other pages of my menu then a user would quite possibly also toggle this function for a different teammate_ref_slot[index], meaning that the OnConfigClose would need to be aware of the multiple targets for the spell? There are multiple pages all with the same states, on each page there is one state that will apply the spell to the target corresponding to that page (teammate_ref_slot[index]). So if I'm waiting for OnConfigClose, then I have to queue up the cast commands, if I understand how the state thing works? diziet Link to comment Share on other sites More sharing options...
Recommended Posts