Starwaster Posted January 28, 2015 Share Posted January 28, 2015 It is loading, but I'm curious why that would matter? Does the added module have to have an associated PartModule assembly? If so, and wanted to add a Module without an associated .dll, could I do so by using a :FINAL tag?Hmm.. off to test..- - - Updated - - -Regardless of my above curiosity, the following does not work:@PART[*]:HAS[@MODULE[ModuleDockingNode]]{ @MODULE[ModuleDockingNode],* { %portName_DPAI = default %portName_DPAI_initialized = false }}- - - Updated - - -Applying node NavyFish/Plugins/moduleDockingNodeNamed/@PART[*]:HAS[@MODULE[ModuleDockingNode]] to Squad/Parts/Utility/dockingPort/dockingPort/dockingPort2[LOG 23:49:39.978] [ModuleManager] Applying node NavyFish/Plugins/moduleDockingNodeNamed/@PART[*]:HAS[@MODULE[ModuleDockingNode]] to Squad/Parts/Utility/dockingPortInline/dockingPortInline/dockingPortLateral[LOG 23:49:39.979] [ModuleManager] Applying node NavyFish/Plugins/moduleDockingNodeNamed/@PART[*]:HAS[@MODULE[ModuleDockingNode]] to Squad/Parts/Utility/dockingPortJr/dockingPortJr/dockingPort3The patch is being applied and the "ModuleDockingNode" is stock... Yet no changes to the persistence or quicksave files for existing craft or newly created craft. wha...It'll add it to the part's config node but if there's no actual PartModule then I don't see how it's going to be added to any parts/vessels in the save file. There's nothing to actually SAVE it or load it. Quote Link to comment Share on other sites More sharing options...
NavyFish Posted January 28, 2015 Share Posted January 28, 2015 So does that imply I can't add fields to an existing module? I thought that was possible. Quote Link to comment Share on other sites More sharing options...
sarbian Posted January 28, 2015 Author Share Posted January 28, 2015 MM can add values to a module but if the module itself does know of those values they won't be in the saves. Quote Link to comment Share on other sites More sharing options...
FreeThinker Posted January 28, 2015 Share Posted January 28, 2015 (edited) Oh, then I know the issue.Replace your "&" with ","In 2.5.7 this was changed for fixing the science reports containing a "&"I'm afraid that I cheered too soon when replace "&" by "," the following code still generates 4 errors when loading KSP//Specific part fixes@PART[FNMethaneTank*]:HAS[@RESOURCE[LqdMethane],@RESOURCE[Oxidizer],!MODULE[ModuleFuelTanks]]:NEEDS[WarpPlugin]:FOR[RealFuels]{ MODULE { name = ModuleFuelTanks temp = 0 volume = 0 type = Cryogenic @temp = #$../RESOURCE[LqdMethane]/maxAmount$ @temp *= 4.412 @volume = #$../MODULE[ModuleFuelTanks]/temp$ @temp = #$../RESOURCE[Oxidizer]/maxAmount$ @temp *= 5 @volume += #$../MODULE[ModuleFuelTanks]/temp$ !temp = 0 } !RESOURCE[LqdMethane] {} !RESOURCE[Oxidizer] {}}To repeat, the above MM code worked in ModuleManager.2.5.6, but no longer in MM 2.5.8 and MM 2.5.9 (I don't know about MM 2.5.7). So something must have changed which makes this script fail! Notice that if I remove both occurances of "@volume", I don't get any error (but also no functionality). Both are similar in the way how they attempt to access the "temp" parameter. @volume = #$../MODULE[ModuleFuelTanks]/temp$@volume += #$../MODULE[ModuleFuelTanks]/temp$perhaps it can't find the temporary "temp" variable after it was created on the second line? it almost looks like a list wasn't updated... Edited January 28, 2015 by FreeThinker Quote Link to comment Share on other sites More sharing options...
Kowgan Posted January 28, 2015 Share Posted January 28, 2015 For people going 10 pages back for usage FAQ, this may have your answers so you don't need to post and wait for an answer: https://github.com/sarbian/ModuleManager/wiki/Module-Manager-Handbook Quote Link to comment Share on other sites More sharing options...
mecki Posted January 28, 2015 Share Posted January 28, 2015 I'm afraid that I cheered too soon when replace "&" by "," the following code still generates 4 errors when loading KSP//Specific part fixes@PART[FNMethaneTank*]:HAS[@RESOURCE[LqdMethane],@RESOURCE[Oxidizer],!MODULE[ModuleFuelTanks]]:NEEDS[WarpPlugin]:FOR[RealFuels]{ MODULE { name = ModuleFuelTanks temp = 0 volume = 0 type = Cryogenic @temp = #$../RESOURCE[LqdMethane]/maxAmount$ @temp *= 4.412 @volume = #$../MODULE[ModuleFuelTanks]/temp$ @temp = #$../RESOURCE[Oxidizer]/maxAmount$ @temp *= 5 @volume += #$../MODULE[ModuleFuelTanks]/temp$ !temp = 0 } !RESOURCE[LqdMethane] {} !RESOURCE[Oxidizer] {}}To repeat, the above MM code worked in ModuleManager.2.5.6, but no longer in MM 2.5.8 and MM 2.5.9 (I don't know about MM 2.5.7). So something must have changed which makes this script fail! Notice that if I remove both occurances of "@volume", I don't get any error (but also no functionality). Both are similar in the way how they attempt to access the "temp" parameter. @volume = #$../MODULE[ModuleFuelTanks]/temp$@volume += #$../MODULE[ModuleFuelTanks]/temp$perhaps it can't find the temporary "temp" variable after it was created on the second line? it almost looks like a list wasn't updated...As I said earlier:I don't know why you would need to go into the above node to go back into the node you already are.That`s why I would replace#$../MODULE[ModuleFuelTanks]/temp$with#$temp$That's just the way it works in this example:http://forum.kerbalspaceprogram.com/threads/55219-Module-Manager-2-3-5-%28Sept-14%29-Loading-Speed-Fix?p=1416253&viewfull=1#post1416253(from https://github.com/sarbian/ModuleManager/wiki/Module%20Manager%20Syntax)to be safe you could also use%temp = 0when you first define it. Quote Link to comment Share on other sites More sharing options...
sarbian Posted January 28, 2015 Author Share Posted January 28, 2015 (edited) To repeat, the above MM code worked in ModuleManager.2.5.6, but no longer in MM 2.5.8 and MM 2.5.9 (I don't know about MM 2.5.7). So something must have changed which makes this script fail! Notice that if I remove both occurances of "@volume", I don't get any error (but also no functionality). Can you please test with 2.5.7 ? I don't see what changed in the code that could impact variable if you test 2.5.7 i'll be sure it's the regex change.And post a log. Edited January 28, 2015 by sarbian Quote Link to comment Share on other sites More sharing options...
Raptor831 Posted January 28, 2015 Share Posted January 28, 2015 For people going 10 pages back for usage FAQ, this may have your answers so you don't need to post and wait for an answer: https://github.com/sarbian/ModuleManager/wiki/Module-Manager-HandbookThanks for the tip! Didn't realize that was there. Quote Link to comment Share on other sites More sharing options...
FreeThinker Posted January 28, 2015 Share Posted January 28, 2015 Can you please test with 2.5.7 ? I don't see what changed in the code that could impact variable if you test 2.5.7 i'll be sure it's the regex change.And post a log.Where can I download 2.5.7? Quote Link to comment Share on other sites More sharing options...
undercoveryankee Posted January 28, 2015 Share Posted January 28, 2015 Where can I download 2.5.7?https://ksp.sarbian.com/jenkins/job/ModuleManager/lastSuccessfulBuild/artifact/ Quote Link to comment Share on other sites More sharing options...
FreeThinker Posted January 28, 2015 Share Posted January 28, 2015 https://ksp.sarbian.com/jenkins/job/ModuleManager/lastSuccessfulBuild/artifact/Alright, I tested and 2.5.7 also has the same problen- - - Updated - - -As I said earlier:I don't know why you would need to go into the above node to go back into the node you already are.That`s why I would replace#$../MODULE[ModuleFuelTanks]/temp$with#$temp$Well at least modification no longer generates 4 errors and it also appears to work as intended. Quote Link to comment Share on other sites More sharing options...
NavyFish Posted January 29, 2015 Share Posted January 29, 2015 MM can add values to a module but if the module itself does know of those values they won't be in the saves.Thank you. That explains everything - - - Updated - - -Is there a way to determine the index of the module you're currently 'inspecting'? i.e.:@PART[*]:HAS[@MODULE[ModuleDockingNode], @MODULE[ModuleDockingNodeNamed]]{ @MODULE[ModuleDockingNodeNamed],* { %controlTransformName = #$../MODULE,[B]X[/B][ModuleDockingNode]/controlTransformName }}Where X is the index of the ModuleDockingNodeNamed.In pseudocode, the above snippet should:For each part that has both a ModuleDockingNode and ModuleDockingNodeNamed At each ModuleDockingNodeNamed (index [B]X[/B]) add or edit the field "controlTransformName" so its value matches the "controlTransformName" from the ModuleDockingNode of corresponding index [B]X[/B] in the same part.- - - Updated - - -For that matter, here's another question: Can you add modules 'outside' of the currently iterated module?Pseudocode:For each part that has a ModuleDockingNode At each ModuleDockingNode add a new module immediately after this node (outside of this node) so a part with N number of ModuleDockingNodes would end up having N entirely new modules added to it (in the part's root)- - - Updated - - -For that matter, here's another question: Can you add modules 'outside' of the currently iterated module?Nevermind that last question - yes, you can, by 'copying' nodes and then changing their names (your example was helpful) Quote Link to comment Share on other sites More sharing options...
NathanKell Posted January 29, 2015 Share Posted January 29, 2015 I am unaware of such. However, you can do@MODULE[foo],0 // the first@MODULE[foo],1 // the secondand so forth(same with @NODE,0 and @key,0 btw) Quote Link to comment Share on other sites More sharing options...
NavyFish Posted January 29, 2015 Share Posted January 29, 2015 (edited) I am unaware of such. However, you can do@MODULE[foo],0 // the first@MODULE[foo],1 // the secondand so forth(same with @NODE,0 and @key,0 btw)Thanks. I'd originally hardcoded it like that out to something like 16 modules, but it just felt too clunky. Ended up using a plugin to index into the modules. cuz MOAR codes is the kerbal way.@sarbian - It might be useful for others to have access to the index, i.e.@MODULE[foo],*{ %index = #$GLOBALVARS/currentIndex$}The above snippet would add/edit the index key to have the value of 'this' foo module's index. Whether that index is based upon all of the part's modules, or just modules of type [foo] (or whatever was searched for, filtered, etc), is up to you (the latter is more useful, IMO, but the former likely more flexible). Just a thought! ------------------------------------------------------------------------------------In case it's of interest to anyone (doubtful), or may be helpful (possible), I'm posting my commented solution below. The goal here was to add one new module (ModuleDockingNodeNamed) for every ModuleDockingNode in a part. This is two patches in-one - the first patch cleans up existing ModuleDockingNodeNamed modules, which would only take effect if the user had a previous version of DPAI installed - the second patch is simpler and only works on 'fresh' modules (those untainted by the nasty older deprecated stuff).//First find all of the old ModuleDockingNodeNamed modules (they won't have a controlTransformName key)@PART[*]:HAS[@MODULE[ModuleDockingNode],@MODULE[ModuleDockingNodeNamed]:HAS[~controlTransformName[]]]{ //Change the module type on the old ModuleDockingNodeNamed module so it's out of the way but the data is saved for later restoration //Prior to this patch, there would only ever be one ModuleDockingNodeNamed in a part. @MODULE[ModuleDockingNodeNamed]:HAS[~controlTransformName[]] { @name = ModuleDockingNodeNamed_deprecated } //Now copy each ModuleDockingNode, then strip its contents, change its name to ModuleDockingNodeNamed, and give it default values +MODULE[ModuleDockingNode],* { //remove all keys -* = dummy //remove all EVENTS and ACTIONS nodes -EVENTS,* {} -ACTIONS,* {} //change the name key (hence 'type' of module) %name = ModuleDockingNodeNamed %controlTransformName = not_initialized %portName = default %initialized = false } //Go to the first of these new ModuleDockingNodeNamed modules, and restore in the data we saved earlier @MODULE[ModuleDockingNodeNamed],0 { @portName = #$../MODULE[ModuleDockingNodeNamed_deprecated]/portName$ @initialized = #$../MODULE[ModuleDockingNodeNamed_deprecated]/initialized$ } //Finally, delete the deprecated module -MODULE[ModuleDockingNodeNamed_deprecated]}//Next, repeat this process for all new parts which don't already have a ModuleDockingNodeNamed (no need to save/restore anything this time)//So find all parts that have a ModuleDockingNode with no ModuleDockingNodeNamed modules@PART[*]:HAS[@MODULE[ModuleDockingNode],!MODULE[ModuleDockingNodeNamed]]{ //As before, copy each ModuleDockingNode, then strip its contents, change its name to ModuleDockingNodeNamed, and give it default values +MODULE[ModuleDockingNode],* { -* = dummy -EVENTS,* {} -ACTIONS,* {} %name = ModuleDockingNodeNamed %controlTransformName = not_initialized %portName = default %initialized = false }} Edited January 29, 2015 by NavyFish code formatz Quote Link to comment Share on other sites More sharing options...
lextacy Posted January 29, 2015 Share Posted January 29, 2015 Some massive issues with 2.5.9 1. Lots and LOTS and i mean LOTS! of MM configs stopped working2. Tweakscaled parts in VAB go wacko , like 5 meter tanks grow into 15 meter tanks!3. Really new and strange behaviors in scene changing 4. Ive went back to the older version 2.5.6 and everything worked again5. Will wait for 2.5.10 for a proper fix Quote Link to comment Share on other sites More sharing options...
Olympic1 Posted January 29, 2015 Share Posted January 29, 2015 Some massive issues with 2.5.9 1. Lots and LOTS and i mean LOTS! of MM configs stopped working2. Tweakscaled parts in VAB go wacko , like 5 meter tanks grow into 15 meter tanks!3. Really new and strange behaviors in scene changing 4. Ive went back to the older version 2.5.6 and everything worked again5. Will wait for 2.5.10 for a proper fix1. Since 2.5.7 the "&" is a valid char for key values and no syntax anymore. This was so that science reports containing a "&" could work when MM was installed. This can be fixed to change a "&" by a ","2. That is a TweakScale bug, no MM.3. Like what?4. See 1.5. See 1. and 2. Quote Link to comment Share on other sites More sharing options...
Scientist Posted January 29, 2015 Share Posted January 29, 2015 suggestion, allow numbered-value keys to accept value of other keys, ie@PART{ CrewCapacity = 5 MODULE { ResourceAmount = CrewCapacity * 5 <- this }}currently i'm making 40 patches, for 1 2 3 4 ... 40 crew, when the above could simplify it into 1 patch Quote Link to comment Share on other sites More sharing options...
sarbian Posted January 29, 2015 Author Share Posted January 29, 2015 suggestion, allow numbered-value keys to accept value of other keys, ieFrom the first post links : http://forum.kerbalspaceprogram.com/threads/55219-Module-Manager-2-3-5-%28Sept-14%29-Loading-Speed-Fix?p=1416253&viewfull=1#post1416253 Quote Link to comment Share on other sites More sharing options...
Starwaster Posted January 29, 2015 Share Posted January 29, 2015 suggestion, allow numbered-value keys to accept value of other keys, ie@PART{ CrewCapacity = 5 MODULE { ResourceAmount = CrewCapacity * 5 <- this }}currently i'm making 40 patches, for 1 2 3 4 ... 40 crew, when the above could simplify it into 1 patch You can already do what you want with variables in MM patches: http://forum.kerbalspaceprogram.com/threads/55219-Module-Manager-2-3-5-%28Sept-14%29-Loading-Speed-Fix?p=1416253&viewfull=1#post1416253Here's an example of a config I made for Ioncross Crew Support to replace a lot of HAS[#crew[1]], HAS[#crew[2]], etc etc until I got tired of typing.IONCROSS_MM_SETTINGS{ O2 = 850 CO2 = 200}@PART[*]:HAS[#CrewCapacity[*],~CrewCapacity[0],!MODULE[IonModuleCrewSupport]]:FOR[IoncrossCrewSupport]{ O2Amount = #$@IONCROSS_MM_SETTINGS/O2$ CO2Amount = #$@IONCROSS_MM_SETTINGS/CO2$ @O2Amount *= #$CrewCapacity$ @CO2Amount *= #$CrewCapacity$ MODULE { name = IonModuleCrewSupport } RESOURCE { name = Oxygen amount = #$/O2Amount$ maxAmount = #$/O2Amount$ } RESOURCE { name = CarbonDioxide amount = 0 maxAmount = #$/CO2Amount$ }} Quote Link to comment Share on other sites More sharing options...
undercoveryankee Posted January 29, 2015 Share Posted January 29, 2015 suggestion, allow numbered-value keys to accept value of other keys, ie@PART{ CrewCapacity = 5 MODULE { ResourceAmount = CrewCapacity * 5 <- this }}currently i'm making 40 patches, for 1 2 3 4 ... 40 crew, when the above could simplify it into 1 patch See http://forum.kerbalspaceprogram.com/threads/55219-Module-Manager-2-3-5-%28Sept-14%29-Loading-Speed-Fix?p=1416253&viewfull=1#post1416253 for the syntax that's been available since MM 2.3.5. The link in the OP isn't the easiest thing in the world to see, but it's there.I think your use case would look something like@PART { %CrewCapacity = 5 MODULE { ResourceAmount = #$../CrewCapacity$ @ResourceAmount *= 5 }} Quote Link to comment Share on other sites More sharing options...
Crzyrndm Posted January 29, 2015 Share Posted January 29, 2015 (edited) @PART{ CrewCapacity = 5 MODULE { ResourceAmount = CrewCapacity * 5 <- this }}ResourceAmount = #$../CrewCapacity$@ResourceAmount *= 5I think that's how the variable system works... (spitballed from this post) Edited January 29, 2015 by Crzyrndm Quote Link to comment Share on other sites More sharing options...
undercoveryankee Posted January 29, 2015 Share Posted January 29, 2015 ResourceAmount = #$../CrewCapacity$ * 5I think that's how the variable system works... (spitballed from this post)Only thing is you can't do math within the value side. Your code would set ResourceAmount to the string "5 * 5". To actually get MM to evaluate the math, you have to do the two-line assign and then *=. Quote Link to comment Share on other sites More sharing options...
Crzyrndm Posted January 29, 2015 Share Posted January 29, 2015 Only thing is you can't do math within the value side. Your code would set ResourceAmount to the string "5 * 5". To actually get MM to evaluate the math, you have to do the two-line assign and then *=.Yea, I see that from all the ones that got there before me (I seem to have left the window open...) Quote Link to comment Share on other sites More sharing options...
Scientist Posted January 29, 2015 Share Posted January 29, 2015 sarbian i was lookin for that for a day, love you andddddd im an idiot for not finding it Quote Link to comment Share on other sites More sharing options...
planetsabc Posted January 30, 2015 Share Posted January 30, 2015 does anyone have mm 2.5.8? i need that version specifically for a modded install. could you please pm me if you do? 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.