linuxgurugamer Posted December 31, 2017 Share Posted December 31, 2017 Whats not working? Quote Link to comment Share on other sites More sharing options...
blowfish Posted December 31, 2017 Share Posted December 31, 2017 (edited) 19 hours ago, Wyzard said: Are the "&" and "|" characters intended to work in a patch's name filter? e.g. is it OK to write "@PART[foo|bar]" to modify both the "foo" and "bar" parts with a single patch? I ask because it seems to work, but I can't tell from the documentation whether that's an intentional feature, or a quirk that might change in future versions. The text in the brackets is documented as being a "NodeNameWithWildcards", which doesn't sound like it's meant to be a boolean expression. I know that "@PART[foo]" is equivalent to "@PART:HAS[#name[foo]]", so "@PART[foo|bar]" should be equivalent to "@PART:HAS[#name[foo|bar]]", but the former works and the latter doesn't. This makes me think it might just be a quirk. (The only thing the documentation specifically says can use "|" is a :NEEDS clause. There are examples of :HAS clauses using commas for AND relationships, so I'd expect that they can use "|" for OR as well. Based on that, I'd expect "@PART:HAS[#name[foo]|#name[bar]]" to work, but strangely it doesn't quite: only the "foo" part gets the patch.) I'm testing with MM 3.0.1, btw. @PART[foo|bar] works (and will look for a PART node with name = foo or name = bar). | does not work in a :HAS block (only , or & which represent AND will work, and then only separating different conditions, e.g. :HAS[#foo1[bar1],#foo2[bar2]]). However, you can use any of | & , in a NEEDS block (first is OR, second two are AND, OR binds tighter than AND) E: clarified about and in a :HAS block Edited December 31, 2017 by blowfish Quote Link to comment Share on other sites More sharing options...
PyjackMeat Posted December 31, 2017 Share Posted December 31, 2017 4 hours ago, linuxgurugamer said: Whats not working? the amountSupplies key isn't found Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted December 31, 2017 Share Posted December 31, 2017 (edited) 5 hours ago, PyjackMeat said: the amountSupplies key isn't found I am not at my computer, but I believe that you need to add ../ Somewhere at the beginning of the key, it looks like you are defining it in the main body, but are referencing it inside a RESOURCE node Edit: Just got to my computer, I was correct, I just looked at a cfg which is doing something similar to what you are trying to do. So, I suspect that the waterFactor and oxygenFactor are also both not working, please confirm. Assuming that is so, then the following syntax should work for you. I also saw that you had an extra definition of amountSupplies in the second PART module which wasn't being used, so I deleted it from there @PART[LS_Tank_*|LifeSupportMiniPack]:NEEDS[TACLifeSupport] { foodFactor = 0.000016927083333 waterFactor = 0.000011188078704 oxygenFactor = 0.001713537562385 %amountSupplies = #$/RESOURCE[Supplies]/maxAmount$ RESOURCE { name = Food amount = #$../amountSupplies$ @amount *= #$../foodFactor$ maxAmount = #$../amountSupplies$ @maxAmount *= #$../foodFactor$ } RESOURCE { name = Water amount = #$../amountSupplies$ @amount *= #$../waterFactor$ maxAmount = #$../amountSupplies$ @maxAmount *= #$../waterFactor$ } RESOURCE { name = Oxygen amount = #$../amountSupplies$ @amount *= #$../oxygenFactor$ maxAmount = #$../amountSupplies$ @maxAmount *= #$../oxygenFactor$ } !RESOURCE[Supplies] {} !amountSupplies = delete !foodFactor = delete !waterFactor = delete !oxygenFactor = delete } @PART[MulchMiniPack]:NEEDS[TACLifeSupport] { wasteFactor = 0.000001539351852 wasteWaterFactor = 0.000014247685185 carbonDioxideFactor = 0.00148012889876 RESOURCE { name = Waste amount = #$../amountMulch$ @amount *= #$../wasteFactor$ maxAmount = #$../amountMulch$ @maxAmount *= #$../wasteFactor$ } RESOURCE { name = WasteWater amount = #$../amountMulch$ @amount *= #$../wasteWaterFactor$ maxAmount = #$../amountMulch$ @maxAmount *= #$../wasteWaterFactor$ } RESOURCE { name = CarbonDioxide amount = #$../amountMulch$ @amount *= #$../carbonDioxideFactor$ maxAmount = #$../amountMulch$ @maxAmount *= #$../carbonDioxideFactor$ } !RESOURCE[Mulch] {} !amountMulch = delete !wasteFactor = delete !wasteWaterFactor = delete !carbonDioxideFactor = delete } Edited December 31, 2017 by linuxgurugamer Quote Link to comment Share on other sites More sharing options...
jmbailey2000 Posted January 3, 2018 Share Posted January 3, 2018 Just a quick question I cannot find specified through all my searches...... It appears you can have spaces throughout a MM patch, just NOT in the PART line? I was trying some simple patches and couldn't get them to work, but eventually tried it without spaces and it worked. The spaces/tabs were to make it a little more readable and shorten the overall length of the file. Didn't work: @PART[SIL02375mRGB] :FINAL :NEEDS[CommunityCategoryKit] { %tags = cck-lights } Worked: @PART[SIL02375mRGB] :FINAL:NEEDS[CommunityCategoryKit] { %tags = cck-lights } Was just curious. Thanks! Quote Link to comment Share on other sites More sharing options...
blowfish Posted January 3, 2018 Share Posted January 3, 2018 (edited) 55 minutes ago, jmbailey2000 said: Just a quick question I cannot find specified through all my searches...... It appears you can have spaces throughout a MM patch, just NOT in the PART line? I was trying some simple patches and couldn't get them to work, but eventually tried it without spaces and it worked. The spaces/tabs were to make it a little more readable and shorten the overall length of the file. Didn't work: @PART[SIL02375mRGB] :FINAL :NEEDS[CommunityCategoryKit] { %tags = cck-lights } Worked: @PART[SIL02375mRGB] :FINAL:NEEDS[CommunityCategoryKit] { %tags = cck-lights } Was just curious. Thanks! Correct, it's a KSP limitation. KSP excludes everything after the first space from the node name*, so MM has no access to it. Spoiler * KSP actually splits the node name on space and parenthases, and from that the first part becomes the node name and the second becomes the node's ID. Why does this ID exist? I have no idea. KSP doesn't appear to use it, and I am unaware of any mods that do. Any further parts of the node name are discarded. Edited January 3, 2018 by blowfish Quote Link to comment Share on other sites More sharing options...
jmbailey2000 Posted January 3, 2018 Share Posted January 3, 2018 1 hour ago, blowfish said: Correct, it's a KSP limitation. KSP excludes everything after the first space from the node name*, so MM has no access to it. Figured. Greatly appreciated!!! Quote Link to comment Share on other sites More sharing options...
voicey99 Posted January 3, 2018 Share Posted January 3, 2018 Is there a way to target specific science definitions? I've been trying to write a patch for CrowdSourcedScience that deletes the stock scidefs, but I can't seem to make it target only Squad's definitions. Here's what I've got so far for removing EVA Reports: Spoiler @EXPERIMENT_DEFINITION:HAS[#id[evaReport]]:FOR[SQUAD] { !RESULTS { } } Naturally, it doesn't work. It deletes all scidefs, including CSS'. How do I make it target only Squad? Quote Link to comment Share on other sites More sharing options...
blowfish Posted January 3, 2018 Share Posted January 3, 2018 7 hours ago, voicey99 said: Is there a way to target specific science definitions? I've been trying to write a patch for CrowdSourcedScience that deletes the stock scidefs, but I can't seem to make it target only Squad's definitions. Here's what I've got so far for removing EVA Reports: Hide contents @EXPERIMENT_DEFINITION:HAS[#id[evaReport]]:FOR[SQUAD] { !RESULTS { } } Naturally, it doesn't work. It deletes all scidefs, including CSS'. How do I make it target only Squad? There's no way to target nodes based on their location in GameData unfortunately. Quote Link to comment Share on other sites More sharing options...
voicey99 Posted January 3, 2018 Share Posted January 3, 2018 5 minutes ago, blowfish said: There's no way to target nodes based on their location in GameData unfortunately. Damn, looks like I'll just have to comment out the lines from the scidef config directly. Thank you for confirming I can't do it though, at least. Quote Link to comment Share on other sites More sharing options...
bdlarkin Posted January 3, 2018 Share Posted January 3, 2018 (edited) This seemed to have worked before but it was several MM and KSP versions ago. But does MM have an issue with modifying EXPERIMENT_DEFINITION? I want to boost baseValue to scienceCap for all experiment_definition (similar to the less grindy mod but 0 grind).... This seemed to have worked before but it was several MM and KSP versions ago. But does MM have an issue with modifying EXPERIMENT_DEFINITION? I want to boost baseValue to scienceCap for all experiment_definition (similar to the less grindy mod but 0 grind).... @EXPERIMENT_DEFINITION[*]:FINAL { @baseValue = #$scienceCap$ } but it doesn't work. If I call out a specific EXPERIMENT_DEFINITION it doesnt work either: @EXPERIMENT_DEFINITION[surfaceSample]:FINAL { @baseValue = 40 //original 30 } This is on a plain vanilla KSP installation. Only MM 3.0.1 installed. I tried without the FINAL keyword too, but no dice. Modifying the SQUAD .cfg files works (obviously). I'm sure it's something simple that I'm missing. Appreciate any help. Edited January 3, 2018 by bdlarkin Quote Link to comment Share on other sites More sharing options...
blowfish Posted January 3, 2018 Share Posted January 3, 2018 (edited) 1 hour ago, bdlarkin said: This seemed to have worked before but it was several MM and KSP versions ago. But does MM have an issue with modifying EXPERIMENT_DEFINITION? I want to boost baseValue to scienceCap for all experiment_definition (similar to the less grindy mod but 0 grind).... This seemed to have worked before but it was several MM and KSP versions ago. But does MM have an issue with modifying EXPERIMENT_DEFINITION? I want to boost baseValue to scienceCap for all experiment_definition (similar to the less grindy mod but 0 grind).... @EXPERIMENT_DEFINITION[*]:FINAL { @baseValue = #$scienceCap$ } but it doesn't work. If I call out a specific EXPERIMENT_DEFINITION it doesnt work either: @EXPERIMENT_DEFINITION[surfaceSample]:FINAL { @baseValue = 40 //original 30 } This is on a plain vanilla KSP installation. Only MM 3.0.1 installed. I tried without the FINAL keyword too, but no dice. Modifying the SQUAD .cfg files works (obviously). I'm sure it's something simple that I'm missing. Appreciate any help. It was a change. It wasn't exactly intended, but after consulting the docs, it is 100% consistent with the intended behavior, so it was kept. You want @EXPERIMENT_DEFINITION:FINAL - the [*] bit implies that there is a name value to match the * against (however, experiment definitions use id rather than name). If you want to match a particular experiment definition you can use @EXPERIMENT_DEFINITION:HAS[#id[xxx]] Just to clarify why this worked before, it was actually matching * against EXPERIMENT_DEFINITION (quirk in the way that KSP interprets root nodes). So e.g. @EXPERIMENT_DEFINITION[EXPERIMENT_DEFINITION] would have matched every EXPERIMENT_DEFINITION Edited January 3, 2018 by blowfish Quote Link to comment Share on other sites More sharing options...
bdlarkin Posted January 3, 2018 Share Posted January 3, 2018 Ahh! That explains it. Appreciate it. Quote Link to comment Share on other sites More sharing options...
Stratickus Posted January 7, 2018 Share Posted January 7, 2018 (edited) On 1/3/2018 at 1:24 PM, blowfish said: It was a change. It wasn't exactly intended, but after consulting the docs, it is 100% consistent with the intended behavior, so it was kept. You want @EXPERIMENT_DEFINITION:FINAL - the [*] bit implies that there is a name value to match the * against (however, experiment definitions use id rather than name). If you want to match a particular experiment definition you can use @EXPERIMENT_DEFINITION:HAS[#id[xxx]] Just to clarify why this worked before, it was actually matching * against EXPERIMENT_DEFINITION (quirk in the way that KSP interprets root nodes). So e.g. @EXPERIMENT_DEFINITION[EXPERIMENT_DEFINITION] would have matched every EXPERIMENT_DEFINITION I am having a similar issue, but I am trying to edit a node that does not have a discernible name or id. This worked before the update: @LIFE_SUPPORT_SETTINGS[*]:AFTER[USILifeSupport] { ... } I have tried: @LIFE_SUPPORT_SETTINGS:AFTER[USILifeSupport]{} // @LIFE_SUPPORT_SETTINGS,0:AFTER[USILifeSupport]{} // @LIFE_SUPPORT_SETTINGS,*:AFTER[USILifeSupport]{} But none appear to work. I'm afraid I have not been able to figure out the proper syntnax to target an unnamed node on my own using the GitHub wiki. The first key in the parent node is SupplyTime = 324000. Would this work? @LIFE_SUPPORT_SETTINGS:HAS[#SupplyTime[324000]]:AFTER[USILifeSupport] Cheers, Edited January 7, 2018 by Stratickus Quote Link to comment Share on other sites More sharing options...
blowfish Posted January 7, 2018 Share Posted January 7, 2018 (edited) 36 minutes ago, Stratickus said: I am having a similar issue, but I am trying to edit a node that does not have a discernible name or id. This worked before the update: @LIFE_SUPPORT_SETTINGS[*]:AFTER[USILifeSupport] { ... } I have tried: @LIFE_SUPPORT_SETTINGS:AFTER[USILifeSupport]{} // @LIFE_SUPPORT_SETTINGS,0:AFTER[USILifeSupport]{} // @LIFE_SUPPORT_SETTINGS,*:AFTER[USILifeSupport]{} But none appear to work. I'm afraid I have not been able to figure out the proper syntnax to target an unnamed node on my own using the GitHub wiki. The first key in the parent node is SupplyTime = 324000. Would this work? @LIFE_SUPPORT_SETTINGS:HAS[#SupplyTime[324000]]:AFTER[USILifeSupport] Cheers, Are you absolutely sure @LIFE_SUPPORT_SETTINGS:AFTER[USILifeSupport]{} didn't work? This should target every LIFE_SUPPORT_SETTINGS node, and should have worked both before and after the update. Edited January 7, 2018 by blowfish Quote Link to comment Share on other sites More sharing options...
DStaal Posted January 7, 2018 Share Posted January 7, 2018 40 minutes ago, Stratickus said: I am having a similar issue, but I am trying to edit a node that does not have a discernible name or id. This worked before the update: @LIFE_SUPPORT_SETTINGS[*]:AFTER[USILifeSupport] { ... } I have tried: @LIFE_SUPPORT_SETTINGS:AFTER[USILifeSupport]{} // @LIFE_SUPPORT_SETTINGS,0:AFTER[USILifeSupport]{} // @LIFE_SUPPORT_SETTINGS,*:AFTER[USILifeSupport]{} But none appear to work. I'm afraid I have not been able to figure out the proper syntnax to target an unnamed node on my own using the GitHub wiki. The first key in the parent node is SupplyTime = 324000. Would this work? @LIFE_SUPPORT_SETTINGS:HAS[#SupplyTime[324000]]:AFTER[USILifeSupport] Cheers, For this one: Are you remembering you need to start a *new* save every time you test? (Since the settings you're trying to change are just defaults, and are written into the save - and can be changed on a per-save basis in-game.) Quote Link to comment Share on other sites More sharing options...
blowfish Posted January 7, 2018 Share Posted January 7, 2018 (edited) 57 minutes ago, DStaal said: For this one: Are you remembering you need to start a *new* save every time you test? (Since the settings you're trying to change are just defaults, and are written into the save - and can be changed on a per-save basis in-game.) Right. When debugging ModuleManager patches, it's always a good idea to see what the final result is in ModuleManager.ConfigCache since that won't be affected by how KSP/whatever mod is actually loading the data. Edited January 7, 2018 by blowfish Quote Link to comment Share on other sites More sharing options...
Stratickus Posted January 8, 2018 Share Posted January 8, 2018 4 hours ago, blowfish said: Are you absolutely sure @LIFE_SUPPORT_SETTINGS:AFTER[USILifeSupport]{} didn't work? This should target every LIFE_SUPPORT_SETTINGS node, and should have worked both before and after the update. 4 hours ago, DStaal said: For this one: Are you remembering you need to start a *new* save every time you test? (Since the settings you're trying to change are just defaults, and are written into the save - and can be changed on a per-save basis in-game.) Doh! You are absolutely correct. I now remember having to do this when I originally came up with this patch long ago. Turns out I had correctly applied the patch, but completely forgot about how these settings work. Thanks guys. Cheers, Quote Link to comment Share on other sites More sharing options...
chrisl Posted January 9, 2018 Share Posted January 9, 2018 I have a line in an MM patch I'm writing: MODULE:HAS[#/CrewCapacity[>0]] Basically, I'm creating a new module on a series of parts, but only if the part has CrewCapacity. Trouble is, the MODULE seems to be created regardless of whether CrewCapacity is set. Any idea what I'm doing wrong? Quote Link to comment Share on other sites More sharing options...
blowfish Posted January 9, 2018 Share Posted January 9, 2018 43 minutes ago, chrisl said: I have a line in an MM patch I'm writing: MODULE:HAS[#/CrewCapacity[>0]] Basically, I'm creating a new module on a series of parts, but only if the part has CrewCapacity. Trouble is, the MODULE seems to be created regardless of whether CrewCapacity is set. Any idea what I'm doing wrong? You can't check variables that way unfortunately. You'll need to do it outside that @PART:HAS[#CrewCapacity[>0]] { MODULE { ... } } Quote Link to comment Share on other sites More sharing options...
chrisl Posted January 10, 2018 Share Posted January 10, 2018 (edited) Is there a way to search for an external part using the name of the module in the part you're currently working in? For example: SSTU_MODEL { name = Adapter-2-1-Short volume = 10 . } PART { . MODULE { . CAP { name = Adapter-2-1-Short volume = #$SSTU_MODEL[#name]/volume$ } } } I keep getting errors but I'm not sure if they are because what I trying to do is not possible or if I simply have a syntax or formatting error. Edited January 10, 2018 by chrisl Quote Link to comment Share on other sites More sharing options...
Aelfhe1m Posted January 10, 2018 Share Posted January 10, 2018 @chrisl To access another root level node you use #$@...$. Also you don't use #name like that - it would be [#name[XXX]] but can be shortened to just [XXX]. Try this: PART { . MODULE { . CAP { name = Adapter-2-1-Short volume = #$@SSTU_MODEL[Adapter-2-1-Short]/volume$ } } } Quote Link to comment Share on other sites More sharing options...
chrisl Posted January 10, 2018 Share Posted January 10, 2018 15 minutes ago, Aelfhe1m said: @chrisl To access another root level node you use #$@...$. Also you don't use #name like that - it would be [#name[XXX]] but can be shortened to just [XXX]. Try this: PART { . MODULE { . CAP { name = Adapter-2-1-Short volume = #$@SSTU_MODEL[Adapter-2-1-Short]/volume$ } } } What I'm hoping to do is create a single command that will pull the volume figure on every CAP that we find in a part. @CAP,* { %volume = #$@SSTU_MODEL[#name]/volume$ } So if there are five CAP in a particular part, it would grab the name of each, look for the SSTU_MODEL with the same name, and return the volume of that part. Quote Link to comment Share on other sites More sharing options...
blowfish Posted January 11, 2018 Share Posted January 11, 2018 12 hours ago, chrisl said: What I'm hoping to do is create a single command that will pull the volume figure on every CAP that we find in a part. @CAP,* { %volume = #$@SSTU_MODEL[#name]/volume$ } So if there are five CAP in a particular part, it would grab the name of each, look for the SSTU_MODEL with the same name, and return the volume of that part. That's not currently possible, unfortunately. MM does not process variable searches within those brackets. Quote Link to comment Share on other sites More sharing options...
Citizen247 Posted January 12, 2018 Share Posted January 12, 2018 (edited) Is it possible to use a variable to control whether a patch is applied? If so, how? Edited January 12, 2018 by Citizen247 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.