XLjedi Posted November 1, 2017 Share Posted November 1, 2017 13 minutes ago, Gorby1 said: 1. Yes 2. No 3. I put mine in a folder I made called 'MyCustomPatches', for example: \GameData\MyCustomPatches\MyCustomPatchFile.cfg I like to make a separate CFG file for each mod. Exmaples: NearFutureSpacecraft.cfg, KWRocketry.cfg, Squad.cfg, etc Excellent, thank you! So since I did this... obviously there's a problem with my script then if I don't see the "patches applied" message increment by 1 after I put my .cfg out there. Also fair to assume the .cfg file is of the typical .txt editor variety, correct? Well, I s'pose that narrows it down to my little file as the issue then. Quote Link to comment Share on other sites More sharing options...
Gorby1 Posted November 1, 2017 Share Posted November 1, 2017 (edited) 40 minutes ago, XLjedi said: Excellent, thank you! So since I did this... obviously there's a problem with my script then if I don't see the "patches applied" message increment by 1 after I put my .cfg out there. Also fair to assume the .cfg file is of the typical .txt editor variety, correct? Well, I s'pose that narrows it down to my little file as the issue then. I'm fairly certain that each CFG is not considered a patch, but rather every part modification is a patch. As in, one CFG file can contain many patches. For example the code below adds decouplers to the 3 different stock fairings and removes their fuel crossfeed - it counts as 3 patches. Spoiler @PART[fairingSize?]:AFTER[Squad] { @fuelCrossFeed = False MODULE { name = ModuleDecouple ejectionForce = #$../mass$ explosiveNodeID = top } @MODULE[ModuleDecouple] { @ejectionForce *= 2000 } } EDIT: And yes, just use any old plain text editor. Notepad in Windows is fine. Edited November 1, 2017 by Gorby1 Quote Link to comment Share on other sites More sharing options...
KSK Posted November 1, 2017 Share Posted November 1, 2017 (edited) 20 hours ago, blowfish said: Based on the filename this is OSX, and probably would have gone through TextEdit (OSX's appropriately named basic text editor). But TextEdit does have limited rich text functionality including the ability to save as RTF, you just have to know to save as plain text. Yup - that and, you know, get the darn part names right. Anyway - we have lift-off! It's going to take a while to think up replacement text for all the tech tree nodes and part descriptions (not to mention a bit of experimentation to make it read nicely onscreen) - but getting the patches to work is a big step forward. Thanks @Nightside, @blowfish and @linuxgurugamer for the help! Edited November 1, 2017 by KSK Quote Link to comment Share on other sites More sharing options...
shdwlrd Posted November 2, 2017 Share Posted November 2, 2017 On 10/31/2017 at 9:19 PM, blowfish said: Some errors which were previously silent will now cause loud failures (error messages in the loading screen and cache will not be generated). Most of them have to do with patches that have more than one pass specified (e.g. :FOR[xxx]:AFTER[yyy]). 8 hours ago, Poodmund said: SO... for patches that need multiple passes, how should we get around this issue? 7 hours ago, blowfish said: A patch can only be run once. This should have been the case before as well. I'm confused about what you're talking about here... I don't know it this example is the situation that Poodmund is referring to, but this is my example. I'm writing patches for mod X that can't be updated do to licensing. I'm also writing patches for mod X to add compatibility for mods A, B, & C. The initial patches for mod X have to load. Then the patches for mods A, B, & C needs to load after mod X because I'm overwriting some of the values for mod X to be more friendly for mods A, B, & C. So the question becomes; How do you dictate the order in which the patches load? Especially when you need patches to load in a certain order without breaking MM? (eg, patching a patch) Quote Link to comment Share on other sites More sharing options...
blowfish Posted November 2, 2017 Share Posted November 2, 2017 (edited) 17 hours ago, shdwlrd said: I don't know it this example is the situation that Poodmund is referring to, but this is my example. I'm writing patches for mod X that can't be updated do to licensing. I'm also writing patches for mod X to add compatibility for mods A, B, & C. The initial patches for mod X have to load. Then the patches for mods A, B, & C needs to load after mod X because I'm overwriting some of the values for mod X to be more friendly for mods A, B, & C. So the question becomes; How do you dictate the order in which the patches load? Especially when you need patches to load in a certain order without breaking MM? (eg, patching a patch) I don't think it's related. But here's the explanation of the order of all patches: All patches marked :FIRST are run All patches with no pass specified are run (this is called the legacy pass) For each installed mod*, in alphabetical order: All patches marked :BEFORE[mod] are run All patches marked :FOR[mod] are run All patches marked :AFTER[mod] are run All patches marked :FINAL are run * ModuleManager considers a mod to be installed if one of the following 3 conditions is met: A DLL named mod.dll exists somewhere in GameData A patch marked :FOR[mod] exists A directory exists in GameData named mod/ Edited November 2, 2017 by blowfish Quote Link to comment Share on other sites More sharing options...
shdwlrd Posted November 3, 2017 Share Posted November 3, 2017 (edited) 5 hours ago, blowfish said: I don't think it's related. But here's the explanation of the order of all patches: All patches marked :FIRST are run All patches with no pass specified are run (this is called the legacy pass) For each installed mod*, in alphabetical order: All patches marked :BEFORE[mod] are run All patches marked :FOR[mod] are run All patches marked :AFTER[mod] are run All patches marked :FINAL are run * ModuleManager considers a mod to be installed if one of the following 3 conditions is met: A DLL named mod.dll exists somewhere in GameData A patch marked :FOR[mod] exists A directory exists in GameData named mod/ That isn't exactly what I was asking, but it does answer my question. I just needed to know how to format the patches to be able to patch a patched value. But knowing the exact order of how the patches are loaded kind of makes my question irrelevant. Thank you @blowfish for detailed response. Edited November 3, 2017 by shdwlrd Quote Link to comment Share on other sites More sharing options...
FreeThinker Posted November 3, 2017 Share Posted November 3, 2017 (edited) Question: would there be any way to conditionally declare a resource depending on the presence of another mod? Edited November 3, 2017 by FreeThinker Quote Link to comment Share on other sites More sharing options...
blowfish Posted November 3, 2017 Share Posted November 3, 2017 Just now, FreeThinker said: Question: would there be any way to conditionally declare a resource depending on the presence of another mod? Anything can have :NEEDS on it and MM will look at that Quote Link to comment Share on other sites More sharing options...
FreeThinker Posted November 3, 2017 Share Posted November 3, 2017 (edited) 3 minutes ago, blowfish said: Anything can have :NEEDS on it and MM will look at that Alright, so something like this should work: RESOURCE_DEFINITION:NEEDS[!CommunityResourcePack] { abbreviation = AM name = Antimatter displayName = Antimatter density = 0.000000001 flowMode = STAGE_PRIORITY_FLOW transfer = PUMP isTweakable = false isVisible = true unitCost = 100 } Edited November 3, 2017 by FreeThinker Quote Link to comment Share on other sites More sharing options...
Nightside Posted November 6, 2017 Share Posted November 6, 2017 Is it possible to pull one value from a key as a variable? I'd like to get the value of vacuum isp of an engine then do some math with that number. Example: GIVEN atmosphereCurve { key = 0 210 key = 1 175} DESIRED ispV = 210 Quote Link to comment Share on other sites More sharing options...
Aelfhe1m Posted November 7, 2017 Share Posted November 7, 2017 41 minutes ago, Nightside said: Is it possible to pull one value from a key as a variable? From the original post on variables: On 14/09/2014 at 10:33 PM, sarbian said: ratio[2, ] gets you the third space separated field Example: Spoiler // Original TESTNODE { atmosphereCurve { key = 0 210 key = 1 175 } } // patch @TESTNODE { testISP = #$atmosphereCurve/key[1, ]$ } // result in ModuleManager.CacheConfig UrlConfig { name = TESTNODE type = TESTNODE parentUrl = /test url = /test/TESTNODE TESTNODE { testISP = 210 atmosphereCurve { key = 0 210 key = 1 175 } } } Quote Link to comment Share on other sites More sharing options...
Galane Posted November 8, 2017 Share Posted November 8, 2017 I want to add the radome1snub.cfg capability from BDArmory 1.0.0 to stock avionicsNoseCone.cfg PART { name = bdRadome1snub module = Part author = BahamutoD rescaleFactor = 1 node_stack_bottom01 = 0.0, -0.4816, 0.0, 0.0, -1.0, 0.0, 1 //node_attach = 0, 0, -0.313, 0.0, 0.0, 1.0 TechRequired = precisionEngineering entryCost = 6200 cost = 320 category = none subcategory = 0 title = AN/APG-63V1 Radome manufacturer = Bahamuto Dynamics description = A forward facing, aerodynamically housed radar. It can scan and lock targets within a 120 degree field of view. This is a dedicated ground attack version with much better performance against ground targets, but reduced air-to-air capabilities. attachRules = 1,0,1,1,0 stackSymmetry = 2 mass = 0.375 dragModelType = default maximum_drag = 0.1 minimum_drag = 0.1 angularDrag = .25 crashTolerance = 40 maxTemp = 2000 fuelCrossFeed = True bulkheadProfiles = size1 thermalMassModifier = 6.0 emissiveConstant = 0.95 MODEL { model = BDArmory/Parts/radome125/radome1snub } MODULE { name = ModuleRadar // -- Section: General Configuration -- radarName = AN/APG-63V1 Radome // if left empty part.title is used, but advised to set this to a nice printable text rwrThreatType = 1 // IMPORTANT, please set correctly: // 0 = SAM site radar // 1 = Fighter radar (airborne) // 2 = AWACS radar (airborne) // 3, 4 = ACTIVE MISSILE (DO NOT USE UNLESS YOU KNOW WHAT YOU'RE DOING! // 5 = Detection radar (ground/ship based) // 6 = SONAR (ship/submarine based) rotationTransformName = scanRotation //turretID = 0 // if needed resourceDrain = 0.75 // change to higher values for more capable radars, e.g AESA // -- Section: Capabilities -- omnidirectional = false // false: boresight scan radar directionalFieldOfView = 120 // for omni and boresight //boresightFOV = 10 // for boresight only //scanRotationSpeed = 240 // degress per second //lockRotationSpeed = 120 // only relevant if canLock lockRotationAngle = 4 showDirectionWhileScan = true // can show target direction on radar screen. False: radar echos displayed as block only (no direction) multiLockFOV = 40 // only relevant if canLock //lockAttemptFOV = 2 // only relevant if canLock maxLocks = 1 //how many targets can be locked/tracked simultaneously. only relevant if canLock canScan = true // scanning/detecting targets (volume search) canLock = true // locking/tracking targets (fire control) canTrackWhileScan = true // continue scanning while tracking a locked target canRecieveRadarData = false // can work as passive data receiver (NOTE THE SPELLING! [SIC]) minSignalThreshold = 80 // DEPRECATED, NO LONGER USED! use detection float curve! minLockedSignalThreshold = 100 // DEPRECATED, NO LONGER USED! use locktrack float curve! radarGroundClutterFactor = 0.4 // how much is the radar efficiency reduced to by ground clutter/look-down? // 0.0 = reduced to 0% (=IMPOSSIBLE to detect ground targets) // 1.0 = fully efficient (no difference between air & ground targets) // default if unset: 0.25 // Ground targets, especially ships, already have a massively larger RCS than fighters, hence // any ground clutter factor >0.25 is to be considered very good, making an efficient surface/horizon search radar. // values >1.0 are possible, meaning the radar is MORE efficient during look down than vs air targets. radarDetectionCurve { // floatcurve to define at what range (km) which minimum cross section (m^2) can be detected. // this defines both min/max range of the radar, and sensitivity/efficiency // it is recommended to define an "assured detection range", at which all craft are detected regardless // of their rcs. This is achieved by using a minrcs value of zero, thus detecting everything. // key = distance rcs key = 0.0 0 key = 5 0 //between 0 and 5 km the min cross section is 0, thus assured detection of everything key = 10 5 // key = 20 20 // key = 30 30 //maxrange of 30km } radarLockTrackCurve { // same as detectionCurve, just for locking/tracking purpose // ATTENTION: DO NOT USE an "assured locking range" here, as this would render lock-breaking // ECM-jammers & chaff completely ineffective!! // key = distance rcs key = 0.0 0 key = 5 5 // key = 10 7 // key = 20 25 // key = 30 35 //maxrange of 35km } } } Quote Link to comment Share on other sites More sharing options...
Aelfhe1m Posted November 8, 2017 Share Posted November 8, 2017 43 minutes ago, Galane said: I want to add the radome1snub.cfg capability from BDArmory 1.0.0 to stock avionicsNoseCone.cfg This patch should copy the radar module from the example config you gave into the stock part: @PART[avionicsNoseCone] { #@PART[bdRadome1snub]/MODULE[ModuleRadar] {} } Quote Link to comment Share on other sites More sharing options...
Pulsar Posted November 8, 2017 Share Posted November 8, 2017 I need to use a value in a module node for some further calculation. I kept getting error some reason. Can anyone help? For example: Spoiler //Part file PART { Name = Part1 //some stuff MODULE { name = ModuleA A = 18 //Need this value for some calculation } } //MM Patch @PART[part1] { MODULE { name = ModuleB @B = 10 @B += #$../MODULE[ModuleA]/A$ //ERROR HERE } } Quote Link to comment Share on other sites More sharing options...
Gorby1 Posted November 8, 2017 Share Posted November 8, 2017 56 minutes ago, Pulsar said: I need to use a value in a module node for some further calculation. I kept getting error some reason. Can anyone help? When I add a module to a part and then edit a value within the added module, I write it as two different nodes like below - I don't know for sure if that's what's wrong with your code but when I write patches this way it works. Spoiler //MM Patch @PART[part1] { MODULE { name = ModuleB B = 10 } @MODULE[ModuleB] { @B += #$../MODULE[ModuleA]/A$ } } Quote Link to comment Share on other sites More sharing options...
Pulsar Posted November 8, 2017 Share Posted November 8, 2017 @Gorby1 Still doesn't work. I will give the code. I'm trying to retrieve key "DeployedCrewCapacity" value and using it to calculate extra habitation month for USI Life support. I use your solution but it still doesn't work. Spoiler //Part file PART { Name = Part1 //some stuff MODULE { name = ModuleDeployableHabitat DeployedCrewCapacity = 18 } } //MM Patch @PART[Part1]:NEEDS[USILifeSupport] { %MODULE[ModuleLifeSupport]{} %MODULE[USI_ModuleFieldRepair]{} MODULE { name = ModuleHabitation BaseKerbalMonths = #$/mass$ CrewCapacity = 0 BaseHabMultiplier = 0 ConverterName = Habitat StartActionName = Start Habitat StopActionName = Stop Habitat INPUT_RESOURCE { ResourceName = ElectricCharge Ratio = #$../BaseKerbalMonths$ @Ratio *= .25 } } @MODULE[ModuleHabitation] { @BaseKerbalMonths *= 12 @BaseKerbalMonths -= #$../MODULE[ModuleDeployableHabitat]/DeployedCrewCapacity$ @CrewCapacity += #$../MODULE[ModuleDeployableHabitat]/DeployedCrewCapacity$ } } Quote Link to comment Share on other sites More sharing options...
Gorby1 Posted November 8, 2017 Share Posted November 8, 2017 25 minutes ago, Pulsar said: Still doesn't work. I will give the code. I'm trying to retrieve key "DeployedCrewCapacity" value and using it to calculate extra habitation month for USI Life support. I use your solution but it still doesn't work. Your reference to part1's mass is not correct, and I don't believe you can reference the 'BaseKerbalMonths' as a variable within the same node it was created; I would write it like this. I know it seems lengthy and there's probably a better/simpler way to write it, but like I said - when I write patches this way it works so I don't question it Also, just noticed you're using the % symbol (edit or create) for the modules ModuleLifeSupport and USI_ModuleFieldRepair... the way you have it written it won't edit them at all if they exist, and if they don't exist then I don't believe that would create them properly. I would comment those out for now, like I've done. Spoiler @PART[Part1]:NEEDS[USILifeSupport] { //%MODULE[ModuleLifeSupport]{} //%MODULE[USI_ModuleFieldRepair]{} MODULE //module and its values are initially created/added to the part { name = ModuleHabitation BaseKerbalMonths = #$../mass$ CrewCapacity = 0 BaseHabMultiplier = 0 ConverterName = Habitat StartActionName = Start Habitat StopActionName = Stop Habitat INPUT_RESOURCE { ResourceName = ElectricCharge Ratio = #$../../mass$ } } @MODULE[ModuleHabitation] //now that the module has been created its values can be edited { @BaseKerbalMonths *= 12 @CrewCapacity += #$../MODULE[ModuleDeployableHabitat]/DeployedCrewCapacity$ @INPUT_RESOURCE[ElectricCharge] { @Ratio *= .25 } } @MODULE[ModuleHabitation] //this node edits BaseKerbalMonths again because it was already edited in the last node { @BaseKerbalMonths -= #$../MODULE[ModuleDeployableHabitat]/DeployedCrewCapacity$ } } Quote Link to comment Share on other sites More sharing options...
Pulsar Posted November 9, 2017 Share Posted November 9, 2017 @Gorby1 OK. I found the source of the problem. I got the module name wrong. Your solution helps a lot though! Thank you! Quote Link to comment Share on other sites More sharing options...
KerbalPhysics Posted November 11, 2017 Share Posted November 11, 2017 I am not a freakin computer nerd or whatever, I need help on where and how to install it because right now all I see is 83758tyyiy4t87y3tywrywieyioegwyoiwergi and no download button! Quote Link to comment Share on other sites More sharing options...
Wyzard Posted November 11, 2017 Share Posted November 11, 2017 1 hour ago, KerbalPhysics said: I am not a freakin computer nerd or whatever, I need help on where and how to install it because right now all I see is 83758tyyiy4t87y3tywrywieyioegwyoiwergi and no download button! The download links are below the changelog in the OP. Use your browser's search feature to look for the word "download" on the first page. ModuleManager is typically bundled with mods that need it, though, so you shouldn't need to install it separately. Quote Link to comment Share on other sites More sharing options...
TheKurgan Posted November 12, 2017 Share Posted November 12, 2017 Hello all, I'm trying to create an MM patch that takes the value of a part's mass and multiplies it by .35 (or 35% of it's mass) to give me the value I need for the amount of the resource... let's call it "stuff" that the part can contain. I have no clue how to do it, and I have been reading everything I can find here in the forums and the MM thread, and I am no further ahead than I was yesterday morning. @PART[*]:HAS[@MODULE[SOMEMODULE]] { MODULE { name = addStuff stuff = mass*.35 } } I know this is totally wrong... but can you guys help me make it correct? Or let me know If it is even possible. Thank you Quote Link to comment Share on other sites More sharing options...
Drew Kerman Posted November 12, 2017 Share Posted November 12, 2017 15 minutes ago, TheKurgan said: I'm trying to create an MM patch that takes the value of a part's mass and multiplies it by .35 (or 35% of it's mass) to give me the value I need for the amount of the resource... let's call it "stuff" that the part can contain. Check this out Quote Link to comment Share on other sites More sharing options...
TheKurgan Posted November 12, 2017 Share Posted November 12, 2017 (edited) 34 minutes ago, Drew Kerman said: Check this out I tried to make sense of that, but it's beyond my current understanding and ability. I'm not a guy that usually asks for things to be done for me, I try to figure it out , and I usually do... but this time I am stumped. Edited November 12, 2017 by TheKurgan Quote Link to comment Share on other sites More sharing options...
Aelfhe1m Posted November 12, 2017 Share Posted November 12, 2017 4 hours ago, TheKurgan said: I tried to make sense of that, but it's beyond my current understanding and ability. I'm not a guy that usually asks for things to be done for me, I try to figure it out , and I usually do... but this time I am stumped. For your specific example: @PART[*]:HAS[@MODULE[SOMEMODULE]] { MODULE { name = addStuff // first create new variable stuff and initialise it to the value of "mass" in the part's root (/) stuff = #$/mass$ // now multiply stuff by 0.35 @stuff *= 0.35 } } Quote Link to comment Share on other sites More sharing options...
TheKurgan Posted November 12, 2017 Share Posted November 12, 2017 Thank you, I will play around with it. Cheers. 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.