JonDahm Posted July 19, 2015 Share Posted July 19, 2015 Is there any way to make a custom configuration for my mod that ModuleManager can modify? I have some non-part-related GUI elements that I'd like to be as easily extensible as possible. Quote Link to comment Share on other sites More sharing options...
Crzyrndm Posted July 19, 2015 Share Posted July 19, 2015 (edited) Is there any way to make a custom configuration for my mod that ModuleManager can modify? I have some non-part-related GUI elements that I'd like to be as easily extensible as possible.Just write a text file with the .cfg extension and use a unique node type for your settings. eg.[COLOR=#008000]// inside GameData/test/testSettings.cfg[/COLOR]TestSettingsNode{ setting_test_a = A Value}Module manager doesn't care what node type it's patching. PART just happens to be the most commonly usedYou can retrieve the module manager patched node usingConfigNode node = GameDatabase.Instance.GetConfigNodes("TestSettingsNode").FirstOrDefault();Debug.log(node.GetValue("settings_test_a"));[COLOR=#008000] // prints "A Value" to the log[/COLOR][COLOR=#008000]// note: there is also a GameDatabase.Instance.GetConfigNode method that uses a GameData relative path to fetch the node. I can just never remember the path to use[/COLOR] Edited July 19, 2015 by Crzyrndm Quote Link to comment Share on other sites More sharing options...
JonDahm Posted July 19, 2015 Share Posted July 19, 2015 You can retrieve the module manager patched node usingConfigNode node = GameDatabase.Instance.GetConfigNodes("TestSettingsNode").FirstOrDefault();Debug.log(node.GetValue("settings_test_a"));[COLOR=#008000] // prints "A Value" to the log[/COLOR][COLOR=#008000]// note: there is also a GameDatabase.Instance.GetConfigNode method that uses a GameData relative path to fetch the node. I can just never remember the path to use[/COLOR]You're the best! I knew that I could name the nodes whatever, but I didn't know how to get the patched version of it from Module Manager. Thank you so much! Quote Link to comment Share on other sites More sharing options...
Nori Posted July 19, 2015 Share Posted July 19, 2015 @[COLOR=#ff0000]NODE[/COLOR]:HAS[#ElectricCharge[<200]]{ @ElectricCharge = 200}should be like that(replace the red bit with what you need)linkThanks for the reply. That doesn't seem to work since it is checking against a resource. Would have to reference amount or maxamount somehow. Quote Link to comment Share on other sites More sharing options...
Sigma88 Posted July 19, 2015 Share Posted July 19, 2015 (edited) Thanks for the reply. That doesn't seem to work since it is checking against a resource. Would have to reference amount or maxamount somehow.pardon, my faultlet's see if I can write something that works@PART:HAS[@RESOURCE[ElectricCharge]:HAS[#maxAmount[<200]]{ @RESOURCE[ElectricCharge] { @amount = 200 // or whatever you need @maxAmount = 200 }}I think this *should* work Edited July 19, 2015 by Sigma88 Quote Link to comment Share on other sites More sharing options...
Nori Posted July 19, 2015 Share Posted July 19, 2015 pardon, my faultlet's see if I can write something that works@PART:HAS[@RESOURCE[ElectricCharge]:HAS[#maxAmount[<200]]{ @RESOURCE[ElectricCharge] { @amount = 200 // or whatever you need @maxAmount = 200 }}I think this *should* workOk I think I got it. Thanks for your help! I learned today that you can nest HAS commands, which is crazy.@PART[*]:HAS[@MODULE[ModuleCommand]:HAS[#minimumCrew[0]],@RESOURCE[ElectricCharge]:HAS[#maxAmount[<200]]]{ @RESOURCE[ElectricCharge] { @amount = 200 @maxAmount = 200 }} Quote Link to comment Share on other sites More sharing options...
Sigma88 Posted July 21, 2015 Share Posted July 21, 2015 the operator @ will set the value of a key only if that key is already in the module, is there an operator to set the value of a key only if it's missing? Quote Link to comment Share on other sites More sharing options...
Starwaster Posted July 21, 2015 Share Posted July 21, 2015 the operator @ will set the value of a key only if that key is already in the module, is there an operator to set the value of a key only if it's missing?If interpreting your question literally, the answer would be no ... you don't really say what the operator would do if the key is present. (NOT set it...?)There is % which sets it if it's present and adds it with the assigned value if it's absent. example:%skinMaxTemp = 1523.15 Regardless of whether skinMaxTemp is absent or present, the above line will result in the part having skinMaxTemp with value of 1523.15 Quote Link to comment Share on other sites More sharing options...
Sigma88 Posted July 21, 2015 Share Posted July 21, 2015 If interpreting your question literally, the answer would be no ... you don't really say what the operator would do if the key is present. (NOT set it...?)There is % which sets it if it's present and adds it with the assigned value if it's absent. example:%skinMaxTemp = 1523.15 Regardless of whether skinMaxTemp is absent or present, the above line will result in the part having skinMaxTemp with value of 1523.15no, I really need what I asked I can make it work anyways, but having that operator would make everything much easier Quote Link to comment Share on other sites More sharing options...
Svm420 Posted July 21, 2015 Share Posted July 21, 2015 Is there a way to duplicate an attachment/Stack node? This is what i was going for. Create a duplicate top stack node for all engines that don't have one. Also can I parse the list of coordinates with MM so that i could change a single variable in the list? Thanks@PART[*]:HAS[~node_stack_top2[],@MODULE[ModuleEngines*]]:FOR[ZZZZ]{ %node_stack_top2 = #$node_stack_top$} Quote Link to comment Share on other sites More sharing options...
DBowman Posted July 26, 2015 Share Posted July 26, 2015 I wanted to have my MM tweak applied after a couple of other optionally present mods; if they are absent apply it anytime but if either or both of the others are present do it after them. Will this get the right effect:+PART[FuelCell]:AFTER[TACLifeSupport&USILifeSupport] { ... MODULE:NEEDS[TACLifeSupport] {...} MODULE:NEEDS[uSILifeSupport] {...} ...}I searched around a little but it wasn't clear to me that AFTER would 'run' when the specified thing was absent. Quote Link to comment Share on other sites More sharing options...
NathanKell Posted July 26, 2015 Share Posted July 26, 2015 Pass specifiers don't work like that.A pass specifier does only one thing: it says, when the pass is (this), run this patch.Valid options are::FIRST(nothing) -- runs on LEGACY:BEFORE, FOR, or AFTER[some_identifier]:FINALBEFORE/FOR/AFTER take an identifier. The valid identifiers are:1. The names of all loaded DLLs2. any identifier in a FOR[], excepting any already added in 13. The names of all root folders in GameData, excepting any added in 1 or 2.A BEFORE, FOR, and AFTER pass is run for each identifier, and they are processed in that order (so all DLL identifiers run before any others).As soon as a patch has a pass specifier that matches the current pass, it is run and then cleared.This means that you can only add one pass specifier (since if you add two, the patch will run on the one that occurs first and the other will be ignored), and that AFTER[something&something] will only work if there is an identifier added (per above) named something&something, i.e. it won't work. Quote Link to comment Share on other sites More sharing options...
DBowman Posted July 26, 2015 Share Posted July 26, 2015 thanks Nathan- hmm so how do I ensure that the appropriate TAC or USI module gets added?is the MODULE:NEEDS[TAC] enough to ensure that it wont get run before TAC is run/present?maybe one 'core' MM.cfg to create my part and two patch MM.cfgs, one for TAC and one for USI, each using :AFTER[MOD] to controll adding the right MODULE? Quote Link to comment Share on other sites More sharing options...
NathanKell Posted July 27, 2015 Share Posted July 27, 2015 MODULE:NEEDS[whatever] will run on whatever pass the patch it's in has; NEEDS has nothing to do with passes. (Before any passes are run, MM will go through and discard all nodes with unmet :NEEDS)If you're trying to ensure you run AFTER[TacLifeSupport] then that's indeed what you need to use and nothing else. Same with USI. Quote Link to comment Share on other sites More sharing options...
DBowman Posted July 27, 2015 Share Posted July 27, 2015 ok so sounds like I need:MyPart_Core.cfg - makes the part and constant resources etcMyPart_TAC.cfg - with :AFTER[TAC] to be run after TAC is present and containing MODULE:NEEDS[TAC] {...} to add the TAC moduleMyPart_USI.cfg - as for TAC but referencing USI stuffis that the simplest cleanest way to get the job done? but how does it know to do MyPart_TAC after MyPart_Core ? do you know a mod that does what I'm wanting to do that I could use as a reference? Quote Link to comment Share on other sites More sharing options...
Sigma88 Posted July 27, 2015 Share Posted July 27, 2015 ok so sounds like I need:MyPart_Core.cfg - makes the part and constant resources etcMyPart_TAC.cfg - with :AFTER[TAC] to be run after TAC is present and containing MODULE:NEEDS[TAC] {...} to add the TAC moduleMyPart_USI.cfg - as for TAC but referencing USI stuffis that the simplest cleanest way to get the job done? but how does it know to do MyPart_TAC after MyPart_Core ? do you know a mod that does what I'm wanting to do that I could use as a reference?The part.core will be loaded before any of the patches so your're fine. You will need to check when the tac patches apply to be sure you can use after [TAC] Quote Link to comment Share on other sites More sharing options...
NathanKell Posted July 28, 2015 Share Posted July 28, 2015 You also don't need to worry about NEEDS[tac] if you're only running on AFTER[tac] since that pass won't exist if tac isn't installed. Quote Link to comment Share on other sites More sharing options...
Shaggygoblin Posted July 29, 2015 Share Posted July 29, 2015 I'm sure this has been answered, but my search-foo is weak this evening...my goal: find all parts that are probe and all that hold crewwill this return probes, command pods, AND/OR ( | ) crew spaces (ala Hitchhiker, Science Lab, etc.)?@PART[*]:HAS[@MODULE[ModuleCommand]][B]|[/B]:HAS[#CrewCapacity[*]]Is the [*] correct to return cores {ModuleCommand{minimumCrew = 0} as well as ( | ) anything with PART{CrewCapacity = 1,2,3...}(I've seen pods/cocpits with integrated cores for on-board Autopilot, in case Jeb suffocates or something) by itself? @PART[*]:HAS[@MODULE[*][#minimumCrew[*]]][B]|[/B]:HAS[#CrewCapacity[*]]Am I correct to assume that passing [#CrewCapacity [*]] will return any items that have the CrewCapacity listed under the root node PART (won't give fuel tanks or non-crewed fuselages)?wow, vertigo from trying to make sure i had laid it all out the way 'i think' i understand it. And the more I try to clarify what I'm asking, the more confused I seem to be getting so...I don't envy you that do this for a living...hats off to you! Quote Link to comment Share on other sites More sharing options...
Sigma88 Posted July 29, 2015 Share Posted July 29, 2015 can I do:@NODE,*:NEEDS[mymod]{// stuff}or do I need to write it in a different way?I want to add stuff to all "NODE"s only if my mod is installed Quote Link to comment Share on other sites More sharing options...
Olympic1 Posted July 29, 2015 Share Posted July 29, 2015 can I do:@NODE,*:NEEDS[mymod]{// stuff}or do I need to write it in a different way?I want to add stuff to all "NODE"s only if my mod is installedAs far as I understand MM, that should work Quote Link to comment Share on other sites More sharing options...
Sigma88 Posted July 29, 2015 Share Posted July 29, 2015 I wasn't sure which to choose between@NODE,*:NEEDS[mymod]{// stuff}and@NODE:NEEDS[mymod],*{// stuff} Quote Link to comment Share on other sites More sharing options...
HafCoJoe Posted July 30, 2015 Share Posted July 30, 2015 I seem to remember module manager having a database reload function (other then the debug menu one). Was that a thing at one point? or am I imagining things again... Quote Link to comment Share on other sites More sharing options...
Shaggygoblin Posted July 30, 2015 Share Posted July 30, 2015 (edited) Alt-F11, iirc. should be a black window with ModuleManger in the title bar, 3 buttons. (As it appears on mine)confirmed just now in-game: Alt+F11Nice that it has the version of the .dll in the title bar too for quick at-a-glance check. Edited July 30, 2015 by Shaggygoblin Quote Link to comment Share on other sites More sharing options...
HafCoJoe Posted July 30, 2015 Share Posted July 30, 2015 Alt-F11, iirc. should be a black window with ModuleManger in the title bar, 3 buttons. (As it appears on mine)confirmed just now in-game: Alt+F11Nice that it has the version of the .dll in the title bar too for quick at-a-glance check.Aha! Thank you very much. Rep! Quote Link to comment Share on other sites More sharing options...
Shaggygoblin Posted July 30, 2015 Share Posted July 30, 2015 (edited) no, pls don't rep...lol...but if it was the answer, please pay it forward Edited July 30, 2015 by Shaggygoblin Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.