Sigma88 Posted May 15, 2016 Share Posted May 15, 2016 (edited) 18 minutes ago, Whovian41110 said: @PART[*]:HAS[#CrewCapacity[>0]]:NEEDS[UmbraSpaceIndustries] { %RESOURCE[Supplies] { %amount = 15 @amount *= #$/CrewCapacity$ %maxAmount = #$amount$ } %RESOURCE[Mulch] { %amount = 0 @amount *= #$/CrewCapacity$ you don't need this line since you want initial amount to be always 0 %maxAmount = 15 @maxAmount *= #$/CrewCapacity$ } } replace both red lines with Quote @amount *= #$../CrewCapacity$ Edited May 15, 2016 by Sigma88 Quote Link to comment Share on other sites More sharing options...
blowfish Posted May 15, 2016 Share Posted May 15, 2016 6 minutes ago, Sigma88 said: replace both red lines with @amount *= #$../CrewCapacity$ Shouldn't #$/CrewCapacity$ work though? IIRC / refers to whatever root node you're currently part of, in this case the part. Quote Link to comment Share on other sites More sharing options...
Sigma88 Posted May 15, 2016 Share Posted May 15, 2016 (edited) 30 minutes ago, blowfish said: Shouldn't #$/CrewCapacity$ work though? IIRC / refers to whatever root node you're currently part of, in this case the part. oh you are right (I'm not used to edit so close to the root) @Whovian41110 just delete the second red line Edited May 15, 2016 by Sigma88 Quote Link to comment Share on other sites More sharing options...
Enceos Posted May 16, 2016 Share Posted May 16, 2016 (edited) @blowfish I'm trying to make a patch which creates a new attachment node from the contents of the node_attach. @PART[*]:HAS[@MODULE[ModuleDeployableSolarPanel]] { %node_stack_root = #$node_attach$ @attachRules = 1,1,0,0,1 @bulkheadProfiles = size1, srf } The patched parts in configCache get 'equals' signs without the node names O.o is that some kind of bug or I messed up my config? Spoiler UrlConfig { name = solarPanels4 type = PART parentUrl = Squad/Parts/Electrical/1x6SolarPanels/1x6SolarPanels url = Squad/Parts/Electrical/1x6SolarPanels/1x6SolarPanels/solarPanels4 PART { name = solarPanels4 module = Part author = NovaSilisko mesh = model.mu rescaleFactor = 1 node_attach = 0.0, 0.0, 0.0, 1.0, 0.0, 0.0 TechRequired = advElectrics entryCost = 3800 cost = 380 category = Utility subcategory = 0 title = OX-4L 1x6 Photovoltaic Panels manufacturer = Probodobodyne Inc description = The OX-4 is similar in design to the SP series solar panels, but without the heavy casing. Includes passive radiators on the reverse side for better heat dissipation. WARNING: Not retractable once deployed! attachRules = 0,1,0,0,1 mass = 0.0175 dragModelType = default maximum_drag = 0.2 minimum_drag = 0.2 angularDrag = 1 crashTolerance = 8 maxTemp = 1200 bulkheadProfiles = srf thermalMassModifier = 2.0 emissiveConstant = 0.95 heatConductivity = 0.04 tags = array charge deploy e/c elect energ extend generat (light photo power solar sun track unfold volt watt = 0.0, 0.0, 0.0, 1.0, 0.0, 0.0 = 1,1,0,0,1 = size1, srf MODULE { name = ModuleDeployableSolarPanel animationName = solarpanels4 resourceName = ElectricCharge chargeRate = 1.64 retractable = false } } } P.S. Does the And/Or sign work for modules? this one | . I'd like to expand the patch on wheels as well with :HAS[@MODULE[ModuleDeployableSolarPanel|ModuleWheelBase]] Edited May 16, 2016 by Enceos Quote Link to comment Share on other sites More sharing options...
Drakenex Posted May 16, 2016 Share Posted May 16, 2016 (edited) first of all if it's been covered before but I really couldn't found it. Is there a way to select many parts, filtered by one word in the Title and change said word for all of them? So Far I've found how to filter a word from the title using variables: @title = #$@PART[Word]/title$ But I don't know if it's possible to just change said word and keep the rest of the title intact. For example I want to change from: All Parts where "title =" contains the word "Belle" + more text to: Agena + more text Just change one word and keep the rest. Same example but real text: From: title = Belle-A-25 "Hadar" Liquid Fuel Engine To: title = Agena-A-25 "Hadar" Liquid Fuel Engine Is that possible? Thanks!! Edited May 16, 2016 by Drakenex Quote Link to comment Share on other sites More sharing options...
Sigma88 Posted May 16, 2016 Share Posted May 16, 2016 (edited) 1 hour ago, Enceos said: P.S. Does the And/Or sign work for modules? this one | . I'd like to expand the patch on wheels as well with :HAS[@MODULE[ModuleDeployableSolarPanel|ModuleWheelBase]] I have no idea about your first issue, but I don't think OR can work except in the Root node, so @PART:HAS[@MODULE[A]|@MODULE[C]] should work, but @PART:HAS[@MODULE[A|C]] shouldn't (there's a small chance I could be wrong on this 17 minutes ago, Drakenex said: ...words... you could use the "find and replace" which is used like this: @title ^= :Belle:Agena: this will edit the key "title" changing all "Belle" to "Agena" Edited May 16, 2016 by Sigma88 Quote Link to comment Share on other sites More sharing options...
Drakenex Posted May 16, 2016 Share Posted May 16, 2016 (edited) 18 minutes ago, Sigma88 said: you could use the "find and replace" which is used like this: @title ^= :Belle:Agena: this will edit the key "title" changing all "Belle" to "Agena" Ohh thaks! and to filter by a word in the name can I use wildcards? like: @PART[*Agena*] for name = bluedog_AgenaA Thanks in advance Edit: Just found it works like that! (You'll get credit for the patch ) Edited May 16, 2016 by Drakenex Quote Link to comment Share on other sites More sharing options...
Sigma88 Posted May 16, 2016 Share Posted May 16, 2016 (edited) 17 minutes ago, Drakenex said: to filter by a word in the name can I use wildcards? like: @PART[*Agena*] technically you don't even need to do that, Find and Replace will not throw an error if it doesn't find the word you want to replace, so you can use @PART and everything will work out fine anyways. if you wonder which of the two solutions would be the most efficient, that's something I still wasn't able to understand myself but unless you want to put some additional restriction, using the filter should not matter. even better, if you plan to change more words you could do it all in the same patch: @PART { @title ^= :first:1st: @title ^= :second:2nd: @title ^= :third:3rd: } Edit: when a filter is not needed I usually end up omitting it just because it saves some characters in the cfg Edited May 16, 2016 by Sigma88 Quote Link to comment Share on other sites More sharing options...
Drakenex Posted May 16, 2016 Share Posted May 16, 2016 1 minute ago, Sigma88 said: technically you don't even need to do that, Find and Replace will not throw an error if it doesn't find the word you want to replace, so you can use @PART and everything will work out fine anyways. if you wonder which of the two solutions would be the most efficient, that's something I still wasn't able to understand myself but unless you want to put some additional restriction, using the filter should not matter. even better, if you plan to change more words you could do it all in the same patch: @PART { @title ^= :first:1st: @title ^= :second:2nd: @title ^= :third:3rd: } Yup "your logic is undeniable" hehe, thanks a lot! Quote Link to comment Share on other sites More sharing options...
blowfish Posted May 16, 2016 Share Posted May 16, 2016 1 hour ago, Enceos said: @blowfish I'm trying to make a patch which creates a new attachment node from the contents of the node_attach. @PART[*]:HAS[@MODULE[ModuleDeployableSolarPanel]] { %node_stack_root = #$node_attach$ @attachRules = 1,1,0,0,1 @bulkheadProfiles = size1, srf } The patched parts in configCache get 'equals' signs without the node names O.o is that some kind of bug or I messed up my config? That looks right to me, so maybe a bug? @sarbian would probably know better than I. 1 hour ago, Enceos said: P.S. Does the And/Or sign work for modules? this one | . I'd like to expand the patch on wheels as well with :HAS[@MODULE[ModuleDeployableSolarPanel|ModuleWheelBase]] I'm pretty sure that only works on top-level nodes. Quote Link to comment Share on other sites More sharing options...
Enceos Posted May 17, 2016 Share Posted May 17, 2016 (edited) 13 hours ago, blowfish said: That looks right to me, so maybe a bug? @sarbian would probably know better than I. I'm pretty sure that only works on top-level nodes. Would you please kindly test that config on your KSP install? I'd wish to confirm that it has problems not only on my machine before @sarbian digs into the issue. Edited May 17, 2016 by Enceos Quote Link to comment Share on other sites More sharing options...
blowfish Posted May 17, 2016 Share Posted May 17, 2016 (edited) 8 minutes ago, Enceos said: Would you please kindly test that config on your KSP install? I'd wish to confirm that it has problems not only on my machine before @sarbian digs into the issue. Well, could not replicate. The URL configs look like I would expect them to. Does ModuleManager give you any errors in your log? Are any exceptions thrown? Edited May 17, 2016 by blowfish Quote Link to comment Share on other sites More sharing options...
Enceos Posted May 17, 2016 Share Posted May 17, 2016 1 minute ago, blowfish said: Well, could not replicate. The URL configs look like I would expect them to. I see. Thank you very much! Quote Link to comment Share on other sites More sharing options...
Sigma88 Posted May 17, 2016 Share Posted May 17, 2016 (edited) Spoiler so, I am in a pickle :| I need to check if a node contains a certain value which has square brackets, like this: ROOTNODE { MYNODE { key = abc,def[xyz],ghi } } I have no idea how to check for the presence of "def[xyz]" I've tried :HAS[#key[*,def[xyz],*]] but it doesn't work same for :HAS[#key[*,def?xyz?,*]] I managed to separate "def" from "[xyz]" by using @key[*,[] ^= :$:,: which gives me key = abc,def,[xyz],ghi, But I don't think this will help me. I've tried removing the brackets using: @key ^= :[:,: but that doesn't work either @sarbian @blowfish do you have any idea of what might work? solved, sorry for the ping Edited May 17, 2016 by Sigma88 Quote Link to comment Share on other sites More sharing options...
PortableGoogle Posted May 18, 2016 Share Posted May 18, 2016 Hi @sarbian @severedsolo said I should post here and ask you to take a look. He thinks there might be a MM bug involved in this issue. So it seems that when we have the bases and stations contract pack with automatedsciencesampler we run into a problem where it seems to think station science is installed so it ends up causing an error and some of the contract pack gets disabled. At first he thought it was because automatedsciencesampler has a add on dll called stationscience.dll which Severedsolo thought was causing MM to think station science is installed. I had removed that dll and still had the problem. Once I removed the stationscience.cfg in the contract pack, contract config no longer showed the contracts as disabled. The stationscience.dll I deleted was the only one in my gamedata folder. I have 2 logs from contract config if they do you any goodStationcore.loghttp://pastebin.com/1LRUXWtFSurfacesample.loghttp://pastebin.com/3p0SVXEr As well as the output_loghttp://www.filedropper.com/outputlog_4 Hopefully I described the situation well enough for you. If you need anymore logs or information let me know. I do have a whole bunch of mods installed, I'm pretty sure when i made these logs I had all of these mods installed. Quote Link to comment Share on other sites More sharing options...
cy-one Posted May 19, 2016 Share Posted May 19, 2016 The last time I did my own MM-patches.... well, it's been a while, and I've become obviously rusty. Why the heck does this not work? @PART[*]:HAS[@RESOURCE[Ore]]:HAS[#category[FuelTank]]:HAS[!MODULE[InterstellarFuelSwitch]] { %Ores = #$RESOURCE[Ore]/MaxAmount$ %Parts = #$RESOURCE[Ore]/MaxAmount$ @Parts *= 2 MODULE { name = InterstellarFuelSwitch resourceNames = Ore;Metal;RocketParts resourceAmounts = #$../Ores$;#$../Ores$;#$../Parts$ tankMass = #$../mass$ basePartMass = 0.0 displayCurrentTankCost = true hasGUI = true availableInFlight = true availableInEditor = true showInfo = true } !RESOURCE[Ore] {} } It should edit all ore-containing fuel-tanks without an IsFS to be able to also hold metal (same amount) and rocket parts (double the amount) But it does nothign at all o.O Quote Link to comment Share on other sites More sharing options...
Sigma88 Posted May 19, 2016 Share Posted May 19, 2016 (edited) 21 minutes ago, cy-one said: @PART:HAS[@RESOURCE[Ore],#category[FuelTank],!MODULE[InterstellarFuelSwitch]] { MODULE { name = InterstellarFuelSwitch resourceNames = Ore;Metal;RocketParts resourceAmounts = #$../RESOURCE[Ore]/MaxAmount$;$../RESOURCE[Ore]/MaxAmount$;$../RESOURCE[Ore]/MaxAmount$ @resourceAmounts[2,;] *= 2 tankMass = #$../mass$ basePartMass = 0.0 displayCurrentTankCost = true hasGUI = true availableInFlight = true availableInEditor = true showInfo = true } !RESOURCE[Ore] {} } I cleaned it up a bit, this should work I'm going with the assumption that you don't need "Ores" and "Parts" inside the Part node, if you do then you should readd those. the only error you made as far as I can tell was to use multiple # in this line: resourceAmounts = #$../Ores$;#$../Ores$;#$../Parts$ you just need to use # once, just after the = sign Edited May 19, 2016 by Sigma88 Quote Link to comment Share on other sites More sharing options...
cy-one Posted May 19, 2016 Share Posted May 19, 2016 (edited) Testing it right now. How exactly does the @resourceAmounts[2,;] *= 2 part work? As far as I understand it atm, I would've just used @rA[2], not @rA[2,;] Edit: Nope, doesn't work either Edited May 19, 2016 by cy-one Quote Link to comment Share on other sites More sharing options...
Sigma88 Posted May 19, 2016 Share Posted May 19, 2016 (edited) 19 minutes ago, cy-one said: Testing it right now. How exactly does the @resourceAmounts[2,;] *= 2 part work? As far as I understand it atm, I would've just used @rA[2], not @rA[2,;] Edit: Nope, doesn't work either @resourceAmounts[2,;] *= 2 means: <<in the first key "resourceAmouts", target the third element of the semi-colon separated list, and multiply it by 2>> [2] would require a comma separated list ( example = a,b,c) when you have a list with a different separator you need to use [2,separator] but maybe ; is a special character and messes up the code try using your original patch, but remove the extra # from the resourceAmounts Edited May 19, 2016 by Sigma88 Quote Link to comment Share on other sites More sharing options...
sarbian Posted May 19, 2016 Author Share Posted May 19, 2016 On 5/13/2016 at 6:38 PM, Svm420 said: @sarbian Did you ever get a chance to look in to this? Thanks! I just did. 2.6.25 is out. Technically you should check that the node_stack_top is here before trying to duplicate it @PART[*]:HAS[#node_stack_top[*],~node_stack_top2[],@MODULE[ModuleEngines*]:HAS[!PROPELLANT[IntakeA*]]]:FINAL { %node_stack_top2 = #$node_stack_top$ } Quote Link to comment Share on other sites More sharing options...
Tahib Posted May 19, 2016 Share Posted May 19, 2016 On 22.4.2016 at 10:57 PM, blowfish said: Okay, I'll walk you through it. In spoiler tags for those who don't wish to see a long tutorial Hide contents General info on how MM works: all .cfg files in GameData (with a few exceptions) are loaded into something called the game database in KSP. Before any parts (or other stuff) are loaded, ModuleManager goes through that database and identifies patches that need to be made. MM uses the @ symbol to identify edits to existing nodes. We want to edit all PART nodes @PART[*] { } All parts have a name = something field, which MM matches based on what's inside the square brackets [ ]. * means match anything. If you only wanted to match parts starting with KW (for instance), it would be @PART[KW*]. If you only wanted to match a specific part, it would be @PART[MyPart] This patch doesn't do anything yet, since there's nothing between the curly braces { } Now, we really only want to match parts with ModuleReactionWheel: @PART[*]:HAS[@MODULE[ModuleReactionWheel]] { } The :HAS block tells MM to look for stuff in the node and only match if conditions are met. @MODULE[ModuleReactionWheel] tells it to look for a MODULE node with name = ModuleReactionWheel (@ in this context means has this node, ! means does not have this node, # means has this value, ~ means does not have this value). Now, to actually do something. Once these nodes are matched, we want to actually edit the ModuleReactionWheel @PART[*]:HAS[@MODULE[ModuleReactionWheel]] { @MODULE[ModuleReactionWheel] { } } Where here again @ means modify this node or value. Then we want to modify the pitchTorque, yawTorque, and rollTorque inside that. Let's say you wanted to divide each by a factor of 5 @PART[*]:HAS[@MODULE[ModuleReactionWheel]] { @MODULE[ModuleReactionWheel] { @pitchTorque /= 5 @yawTorque /= 5 @rollTorque /= 5 } } You can also use other mathematical operators, including *=, +=, and -= Oh, and we should make sure it runs at the right time. @PART[*]:HAS[@MODULE[ModuleReactionWheel]]:FINAL { @MODULE[ModuleReactionWheel] { @pitchTorque /= 5 @yawTorque /= 5 @rollTorque /= 5 } } The :FINAL will tell MM to run this after all other patches (except those also marked :FINAL). It's not recommended to use :FINAL in an actual mod that will be distributed (when to run should be specified explicitly in that case), but for personal patches it's fine. Hope that helps. this one doesn't work anymore? Quote Link to comment Share on other sites More sharing options...
blowfish Posted May 19, 2016 Share Posted May 19, 2016 28 minutes ago, Tahib said: this one doesn't work anymore? Are you sure? These are some of ModuleManager's core features. Maybe you want to provide more info about your issue? Quote Link to comment Share on other sites More sharing options...
Tahib Posted May 19, 2016 Share Posted May 19, 2016 I tried to change reaction wheels torque with this, but it has no effect Quote Link to comment Share on other sites More sharing options...
blowfish Posted May 20, 2016 Share Posted May 20, 2016 9 minutes ago, Tahib said: I tried to change reaction wheels torque with this, but it has no effect It has no effect as in what? As in you looked at the reaction wheel values in the editor part catalog and they aren't different from their original values? Or as in you looked at ModuleManager.ConfigCache and saw that the changed didn't apply? If you want us to help you debug this, please do the following: Post the exact patch you have and the path to the .cfg file that contains it (e.g. GameData/Stuff/MyPatch.cfg) Delete GameData/ModuleManager.ConfigCache Open KSP and let it load to the main menu Post KSP.log (in the KSP root folder) and GameData/ModuleManager.ConfigCache (these are really the steps for debugging any module manager patch) The original person I wrote the tutorial for had no complaints, so it's probably some configuration issue on your end. Quote Link to comment Share on other sites More sharing options...
cy-one Posted May 20, 2016 Share Posted May 20, 2016 Might be a stupid post, but how does one do multiline comments in MM/stock configs? 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.