blowfish Posted December 22, 2016 Share Posted December 22, 2016 (edited) 6 minutes ago, captinjoehenry said: Is there anyway to check if a part has module a but does not have module b with this? I want to add an ablator module to every part that has a ModuleLiftingSurface but if a part also has a ModuleAblator already I do not want to add the new ablator to that part. @PART:HAS[@MODULE[ModuleLiftingSurface],!MODULE[ModuleAblator]] Edited December 22, 2016 by blowfish Quote Link to comment Share on other sites More sharing options...
captinjoehenry Posted December 22, 2016 Share Posted December 22, 2016 2 hours ago, blowfish said: @PART:HAS[@MODULE[ModuleLiftingSurface],!MODULE[ModuleAblator]] Thanks! That works Quote Link to comment Share on other sites More sharing options...
Errol Posted December 23, 2016 Share Posted December 23, 2016 (edited) Question. I'm trying to write an MM config for a mod that requires adding modules to many parts. I'm really new to coding, so I'm not familiar with the correct terminology, but hopefully my question makes sense. So the mod in question is engine ignitor. The .cfg defines additions to a bunch of specific parts, then I want to use a catch all like the provided example from that mod to cover any undefined engines. I am trying to refine to filtering on this catch all so that it is more selective on which engines to add modules too, because I don't want too many mod parts that aren't intended to logically rely on liquid fuel engine ignition logic to throttle up. So this bit of code looks for parts that have NOT received updates yet: @PART[*]:HAS[@MODULE[ModuleEngine*],!RESOURCE[SolidFuel],!RESOURCE[Karbonite],!MODULE[ModuleEngineIgnitor]]:FINAL And that part works beautifully so far. But when I try adding these clauses: !PROPELLANT[MonoPropellant],!PROPELLANT[XenonGas],!PRPOPELLANT[AblativeOil],!PROPELLANT[IntakeAir],!PROPELLANT[IntakeAtm], Thinking that I'm clever and I can get it to omit all of those engines too, but it doesn't seem to notice any of those parts. Is there something fundamentally different about the RESOURCE property and the PROPELLANT property I am missing? Did I just spell something wrong? I've spent most of my day correcting capitolization in the default .cfg, so I wouldn't be surprised if I'm missing things at this point. Though I am happy with the progress I've made so far, mod is working a lot better. Anyway, any help would be appreciated. Those parts don't contain a RESOURCE so I don't know what else I can use to identify them with. EDIT: @PART[*]:HAS[@MODULE[ModuleEngine*],!RESOURCE[SolidFuel],!RESOURCE[Karbonite],!MODULE[ModuleEngineIgnitor],!MODULE[ModuleEngines]:HAS[!PROPELLANT[MonoPropellant],!PROPELLANT[XenonGas],!PRPOPELLANT[AblativeOil],!PROPELLANT[IntakeAir],!PROPELLANT[IntakeAtm]]]:FINAL Also did not work. EDIT2: IGNORE THIS WHOLE POST! So I just realized that I didn't really have that many engines that don't have definitions that would need a catch all default cfg. Many less then the number of engines that shouldn't have anything added that I'm trying to omit. So I decided to just comment the whole thing out to check it in game. Yep, so I'll just be adding a few more definitions for the boat tailed engines from the overhaul and maybe the mk2 expansion engines if I feel up to it tonight. I'll post my results in the thread when I am done. Edited December 23, 2016 by Errol Quote Link to comment Share on other sites More sharing options...
blowfish Posted December 23, 2016 Share Posted December 23, 2016 1 hour ago, Errol said: So this bit of code looks for parts that have NOT received updates yet: @PART[*]:HAS[@MODULE[ModuleEngine*],!RESOURCE[SolidFuel],!RESOURCE[Karbonite],!MODULE[ModuleEngineIgnitor]]:FINAL And that part works beautifully so far. But when I try adding these clauses: !PROPELLANT[MonoPropellant],!PROPELLANT[XenonGas],!PRPOPELLANT[AblativeOil],!PROPELLANT[IntakeAir],!PROPELLANT[IntakeAtm], I know you said ignore, but just for future reference I will explain how this works. The key point here is that PROPELLANT is a feature of MODULE[ModuleEngines] and not of the PART itself, and that you can nest HAS blocks @PART[*]:HAS[@MODULE[ModuleEngine*]:HAS[!PROPELLANT[MonoPropellant],!PROPELLANT[XenonGas],!PRPOPELLANT[AblativeOil],!PROPELLANT[IntakeAir],!PROPELLANT[IntakeAtm]],!RESOURCE[SolidFuel],!RESOURCE[Karbonite],!MODULE[ModuleEngineIgnitor]]:FINAL Note that the @MODULE[ModuleEngine*] has its own HAS block, and that is where the PROPELLANT checking is done. Quote Link to comment Share on other sites More sharing options...
Errol Posted December 23, 2016 Share Posted December 23, 2016 (edited) Yeah, ok, thanks. I had kind of tried that, but couldn't figure out the correct syntax. Here's what I had tried: @PART[*]:HAS[@MODULE[ModuleEngine*],!RESOURCE[SolidFuel],!RESOURCE[Karbonite],!MODULE[ModuleEngineIgnitor],!MODULE[ModuleEngines*]:HAS[!PROPELLANT[MonoPropellant],!PROPELLANT[XenonGas],!PRPOPELLANT[AblativeOil],!PROPELLANT[IntakeAir],!PROPELLANT[IntakeAtm]]]:FINAL EDIT: I tried your version and it did not work to stop engines using those propellant from receiving the modules. Edited December 23, 2016 by Errol Quote Link to comment Share on other sites More sharing options...
FreeThinker Posted December 23, 2016 Share Posted December 23, 2016 Question, is is possible yet to target a partupgrade? @PARTUPGRADE[UpgradeName] It doesn't appear to work (yet), or is broken .. Quote Link to comment Share on other sites More sharing options...
blowfish Posted December 23, 2016 Share Posted December 23, 2016 3 minutes ago, FreeThinker said: Question, is is possible yet to target a partupgrade? @PARTUPGRADE[UpgradeName] It doesn't appear to work (yet), or is broken .. It should function just like any other node. I'd check the log and config cache to see what's going on... Quote Link to comment Share on other sites More sharing options...
Jso Posted December 23, 2016 Share Posted December 23, 2016 23 minutes ago, FreeThinker said: Question, is is possible yet to target a partupgrade? @PARTUPGRADE[UpgradeName] It doesn't appear to work (yet), or is broken .. I had trouble with that as well. The changes appear in the cache but not in game. I think the tech tree needs to be reloaded or something. Quote Link to comment Share on other sites More sharing options...
blowfish Posted December 23, 2016 Share Posted December 23, 2016 1 hour ago, Jso said: I had trouble with that as well. The changes appear in the cache but not in game. I think the tech tree needs to be reloaded or something. Interesting. My guess would be that the part upgrades are parse from the game database before MM has a chance to run. In that case, ModuleManager would need to force them to reload after applying all of the patches (I think something similar is done for resources). @sarbian thoughts on this? I can do some research if need be to figure out exactly what would be required. Quote Link to comment Share on other sites More sharing options...
Errol Posted December 23, 2016 Share Posted December 23, 2016 When posting MM code, what is the best code highlighting preset to use in the forums code block? Quote Link to comment Share on other sites More sharing options...
Sigma88 Posted December 24, 2016 Share Posted December 24, 2016 5 hours ago, FreeThinker said: Question, is is possible yet to target a partupgrade? @PARTUPGRADE[UpgradeName] It doesn't appear to work (yet), or is broken .. 5 hours ago, Jso said: I had trouble with that as well. The changes appear in the cache but not in game. I think the tech tree needs to be reloaded or something. Are you starting a new game to check the tech tree or loading an older one? Try starting a new game, that might be the issue Quote Link to comment Share on other sites More sharing options...
Jso Posted December 24, 2016 Share Posted December 24, 2016 39 minutes ago, Sigma88 said: Are you starting a new game to check the tech tree or loading an older one? Try starting a new game, that might be the issue New game, old game it's the same. I could see changing nodes getting iffy, but even changing something simple like the title doesn't stick. Quote Link to comment Share on other sites More sharing options...
Jacke Posted December 24, 2016 Share Posted December 24, 2016 In a MM script, will a "-MODULE[name] {}" cause an error if there isn't an existing MODULE[name] ? Like in this code. Spoiler @PART[*]:HAS[@MODULE[ModuleCommand]|@MODULE[KerbalSeat]]:NEEDS[MechJeb2]:FINAL { -MODULE[MechJebCore] {} MODULE { name = MechJebCore MechJebLocalSettings { MechJebModuleCustomWindowEditor { unlockTechs = start } // flightControl MechJebModuleSmartASS { unlockTechs = start } // flightControl MechJebModuleManeuverPlanner { unlockTechs = start } // advFlightControl MechJebModuleNodeEditor { unlockTechs = start } // advFlightControl MechJebModuleTranslatron { unlockTechs = start } // advFlightControl MechJebModuleWarpHelper { unlockTechs = start } // advFlightControl MechJebModuleAttitudeAdjustment { unlockTechs = start } // advFlightControl MechJebModuleThrustWindow { unlockTechs = start } // advFlightControl MechJebModuleRCSBalancerWindow { unlockTechs = start } // advFlightControl MechJebModuleRoverWindow { unlockTechs = start } // fieldScience MechJebModuleAscentGuidance { unlockTechs = start } // unmannedTech MechJebModuleLandingGuidance { unlockTechs = start } // unmannedTech MechJebModuleSpaceplaneGuidance { unlockTechs = start } // unmannedTech MechJebModuleDockingGuidance { unlockTechs = start } // advUnmannedTech MechJebModuleRendezvousAutopilotWindow { unlockTechs = start } // advUnmannedTech MechJebModuleRendezvousGuidance { unlockTechs = start } // advUnmannedTech } } } Quote Link to comment Share on other sites More sharing options...
Sigma88 Posted December 24, 2016 Share Posted December 24, 2016 3 minutes ago, Jacke said: In a MM script, will a "-MODULE[name] {}" cause an error if there isn't an existing MODULE[name] ? Like in this code. Reveal hidden contents @PART[*]:HAS[@MODULE[ModuleCommand]|@MODULE[KerbalSeat]]:NEEDS[MechJeb2]:FINAL { -MODULE[MechJebCore] {} MODULE { name = MechJebCore MechJebLocalSettings { MechJebModuleCustomWindowEditor { unlockTechs = start } // flightControl MechJebModuleSmartASS { unlockTechs = start } // flightControl MechJebModuleManeuverPlanner { unlockTechs = start } // advFlightControl MechJebModuleNodeEditor { unlockTechs = start } // advFlightControl MechJebModuleTranslatron { unlockTechs = start } // advFlightControl MechJebModuleWarpHelper { unlockTechs = start } // advFlightControl MechJebModuleAttitudeAdjustment { unlockTechs = start } // advFlightControl MechJebModuleThrustWindow { unlockTechs = start } // advFlightControl MechJebModuleRCSBalancerWindow { unlockTechs = start } // advFlightControl MechJebModuleRoverWindow { unlockTechs = start } // fieldScience MechJebModuleAscentGuidance { unlockTechs = start } // unmannedTech MechJebModuleLandingGuidance { unlockTechs = start } // unmannedTech MechJebModuleSpaceplaneGuidance { unlockTechs = start } // unmannedTech MechJebModuleDockingGuidance { unlockTechs = start } // advUnmannedTech MechJebModuleRendezvousAutopilotWindow { unlockTechs = start } // advUnmannedTech MechJebModuleRendezvousGuidance { unlockTechs = start } // advUnmannedTech } } } No Quote Link to comment Share on other sites More sharing options...
SmarterThanMe Posted December 27, 2016 Share Posted December 27, 2016 I've adapted a CFG in Kerbalism to convert Coatl and Remotetech antennae that I thought would have worked. Any chance anyone could give it a look over? https://drive.google.com/file/d/0B7hRsbsJ_xotd0Z3dzdmZ1FJdms/view?usp=sharing The point was to convert the antennae over to work with Kerbalism's signal system. Seems to have worked with the Coatl antennae, but not the RT ones. TIA. Quote Link to comment Share on other sites More sharing options...
shoe7ess Posted December 28, 2016 Share Posted December 28, 2016 I could use some MM setup help. I'm used to making MM configs, but this one is a little tricky. I'm using a lot of probe packs and trying to add in the new 1.2 probe modules. What I'm trying to do (since I'm playing in RSS) is create two MM configs. One for non-squad probes, and one FOR squad probes (editing optimum range for the squad probes). For testing, I'm using a non-RSS with the following MM: @PART[*]:HAS[@vesselType[Probe],!author[Squad]]:HAS[!MODULE[ModuleProbeControlPoint&ModuleDataTransmitter]]:FINAL Below it I have the Modules added in that the code above looks for "ModuleProbeControlPoint, etc.". I feel like the problem is trying to set it up so it knows the author isn't squad, I feel like I may have it set up incorrectly, but not entirely sure. That or the & in the !MODULE section. Could someone take a look and fix what mistakes it has? Quote Link to comment Share on other sites More sharing options...
Warezcrawler Posted December 28, 2016 Share Posted December 28, 2016 9 hours ago, shoe7ess said: I could use some MM setup help. I'm used to making MM configs, but this one is a little tricky. I'm using a lot of probe packs and trying to add in the new 1.2 probe modules. What I'm trying to do (since I'm playing in RSS) is create two MM configs. One for non-squad probes, and one FOR squad probes (editing optimum range for the squad probes). For testing, I'm using a non-RSS with the following MM: @PART[*]:HAS[@vesselType[Probe],!author[Squad]]:HAS[!MODULE[ModuleProbeControlPoint&ModuleDataTransmitter]]:FINAL Below it I have the Modules added in that the code above looks for "ModuleProbeControlPoint, etc.". I feel like the problem is trying to set it up so it knows the author isn't squad, I feel like I may have it set up incorrectly, but not entirely sure. That or the & in the !MODULE section. Could someone take a look and fix what mistakes it has? My guess is, that your author part is wrong. Key operations are # for has and ~ for not having. The following would be my next try, but I haven't tried it out, so more syntax errors could be in there. @PART[*]:HAS[@vesselType[Probe],~author[Squad],!MODULE[ModuleProbeControlPoint&ModuleDataTransmitter]]:FINAL See https://github.com/sarbian/ModuleManager/wiki/Module-Manager-Handbook for references. I merged you two HAS operation, since I could not figure out if it was needed having it split into two. Quote Link to comment Share on other sites More sharing options...
sidfu Posted December 28, 2016 Share Posted December 28, 2016 anyone know how to fix this so that it dont get removed? @PART[*]:HAS[#CrewCapacity[>0]]:NEEDS[ProfileTAC]:FOR[Kerbalism] { @MODULE[Configure] { @slots = 2} } right now the issue i have is that it gets added to the capsules but then removed with it saying the needs isnt meet but i know it is cause its fine when just the basic mod setup, Quote Link to comment Share on other sites More sharing options...
Warezcrawler Posted December 28, 2016 Share Posted December 28, 2016 1 minute ago, sidfu said: anyone know how to fix this so that it dont get removed? @PART[*]:HAS[#CrewCapacity[>0]]:NEEDS[ProfileTAC]:FOR[Kerbalism] { @MODULE[Configure] { @slots = 2} } right now the issue i have is that it gets added to the capsules but then removed with it saying the needs isnt meet but i know it is cause its fine when just the basic mod setup, If you are trying to change something in Kerbalism mod, then you should use the AFTER instead of FOR statements. I don't now the ProfileTAC mod, are you sure it is called that if you are having trouble with it not meeting it's needs statements, you should through another look at that part. Quote Link to comment Share on other sites More sharing options...
sidfu Posted December 28, 2016 Share Posted December 28, 2016 (edited) ok seems like its not the :FOR seems like another mod has a bad cfg for tac and its even preventing b9 from getting life support. time to bad cfg huntt sigh. Edited December 28, 2016 by sidfu Quote Link to comment Share on other sites More sharing options...
Aelfhe1m Posted December 29, 2016 Share Posted December 29, 2016 22 hours ago, shoe7ess said: I could use some MM setup help. I'm used to making MM configs, but this one is a little tricky. I'm using a lot of probe packs and trying to add in the new 1.2 probe modules. What I'm trying to do (since I'm playing in RSS) is create two MM configs. One for non-squad probes, and one FOR squad probes (editing optimum range for the squad probes). For testing, I'm using a non-RSS with the following MM: @PART[*]:HAS[@vesselType[Probe],!author[Squad]]:HAS[!MODULE[ModuleProbeControlPoint&ModuleDataTransmitter]]:FINAL Below it I have the Modules added in that the code above looks for "ModuleProbeControlPoint, etc.". I feel like the problem is trying to set it up so it knows the author isn't squad, I feel like I may have it set up incorrectly, but not entirely sure. That or the & in the !MODULE section. Could someone take a look and fix what mistakes it has? Not all Squad parts have the author field set to Squad (I've definitely seen NovaSilisko and Porkjet as authors - probably others as well). The list of squad probes is quite short so you could so something like: @PART[probeCoreCube|probeCoreHex|probeCoreOcto|probeCoreOcto2|probeStackLarge|probeStackSmall|probeCoreSphere|mk2DroneCore|roverBody|avionicsNoseCone] { isSquadProbe = true // set a temporary marker } @PART[*]:HAS[#isSquadProbe[true]]..... // squad patches @PART[*]:HAS[~isSquadProbe[]]..... // non-squad patches @PART[*]:HAS[#isSquadProbe[true]] { !isSquadProbe = DELETE // remove temp marker } Quote Link to comment Share on other sites More sharing options...
shoe7ess Posted December 29, 2016 Share Posted December 29, 2016 51 minutes ago, Aelfhe1m said: Not all Squad parts have the author field set to Squad (I've definitely seen NovaSilisko and Porkjet as authors - probably others as well). The list of squad probes is quite short so you could so something like: @PART[probeCoreCube|probeCoreHex|probeCoreOcto|probeCoreOcto2|probeStackLarge|probeStackSmall|probeCoreSphere|mk2DroneCore|roverBody|avionicsNoseCone] { isSquadProbe = true // set a temporary marker } @PART[*]:HAS[#isSquadProbe[true]]..... // squad patches @PART[*]:HAS[~isSquadProbe[]]..... // non-squad patches @PART[*]:HAS[#isSquadProbe[true]] { !isSquadProbe = DELETE // remove temp marker } I may give that one a try. What I ended up doing is using the % function per each of the new probe modules for all parts, so basically if it doesn't have Module name = X it adds in the module, otherwise it leaves it alone. To tweak it to RSS I just gotta change the effective ranges either per squad probe (in which case I'll be using your example for sure) or just give all probes the same optimal range (gotta make sure my scanning probes have an optimal range far enough in space to make sense in RSS). Thanks for the reply, the examples/tutorials I found on setting up arrays all confused me too much to bother, but now I understand it a lot better so I can use it for other MM patches as well Quote Link to comment Share on other sites More sharing options...
Warezcrawler Posted December 29, 2016 Share Posted December 29, 2016 Doing mat operations with MM, is it possible to use fractions? I currently have the following. %totalCap = #$RESOURCE[LiquidFuel]/maxAmount$ @totalCap += #$RESOURCE[Oxidizer]/maxAmount$ %LFORE = #$totalCap$ @LFORE *= 3 @LFORE /= 5.7 %ORELF = #$totalCap$ @ORELF *= 2.7 @ORELF /= 5.7 Is it possible to do something like %totalCap = #$RESOURCE[LiquidFuel]/maxAmount$ @totalCap += #$RESOURCE[Oxidizer]/maxAmount$ %LFORE = #$totalCap$ @LFORE *= 3/5.7 %ORELF = #$totalCap$ @ORELF *= 2.7/5.7 I ask, because not all fractions are simple decimal figures, and the first MM syntax quickly becomes very long. Quote Link to comment Share on other sites More sharing options...
Sigma88 Posted December 29, 2016 Share Posted December 29, 2016 3 hours ago, Warezcrawler said: Doing mat operations with MM, is it possible to use fractions? I currently have the following. %totalCap = #$RESOURCE[LiquidFuel]/maxAmount$ @totalCap += #$RESOURCE[Oxidizer]/maxAmount$ %LFORE = #$totalCap$ @LFORE *= 3 @LFORE /= 5.7 %ORELF = #$totalCap$ @ORELF *= 2.7 @ORELF /= 5.7 Is it possible to do something like %totalCap = #$RESOURCE[LiquidFuel]/maxAmount$ @totalCap += #$RESOURCE[Oxidizer]/maxAmount$ %LFORE = #$totalCap$ @LFORE *= 3/5.7 %ORELF = #$totalCap$ @ORELF *= 2.7/5.7 I ask, because not all fractions are simple decimal figures, and the first MM syntax quickly becomes very long. No you can't do the latter, only the former. What you could do is get the result from 3/5.7 and multiply for that I usually use excel to do those things. 15 decimal places are more than enough Quote Link to comment Share on other sites More sharing options...
Warezcrawler Posted December 29, 2016 Share Posted December 29, 2016 56 minutes ago, Sigma88 said: No you can't do the latter, only the former. What you could do is get the result from 3/5.7 and multiply for that I usually use excel to do those things. 15 decimal places are more than enough Not the answer I was hoping for. But thanks 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.