blowfish Posted April 22, 2016 Share Posted April 22, 2016 (edited) 2 hours ago, Brucey said: I'd call myself a novice. I know enough to go find all the parts with a text editor and make changes manually. I'm wondering if there's code that just says, "for all parts with reaction wheels, multiply torque values by x" Okay, I'll walk you through it. In spoiler tags for those who don't wish to see a long tutorial Spoiler 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. Edited April 22, 2016 by blowfish Quote Link to comment Share on other sites More sharing options...
Brucey Posted April 22, 2016 Share Posted April 22, 2016 24 minutes ago, blowfish said: Okay, I'll walk you through it. In spoiler tags for those who don't wish to see a long tutorial Reveal hidden 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. Super-duper helpful! Thanks you so much. Quote Link to comment Share on other sites More sharing options...
Sigma88 Posted April 22, 2016 Share Posted April 22, 2016 @blowfish you could also remove the [*] and use just @PART:HAS[] Quote Link to comment Share on other sites More sharing options...
jpinard Posted April 23, 2016 Share Posted April 23, 2016 A super dumb question that I am very sorry if it's already been asked and answered. If I am not making my own mods, do I need to add module manager to the list of mods CKAN downloads? I am a little confused on if everyone includes this automatically with their mods, and if adding a specific mm download messes that up. Quote Link to comment Share on other sites More sharing options...
blowfish Posted April 23, 2016 Share Posted April 23, 2016 1 minute ago, jpinard said: A super dumb question that I am very sorry if it's already been asked and answered. If I am not making my own mods, do I need to add module manager to the list of mods CKAN downloads? I am a little confused on if everyone includes this automatically with their mods, and if adding a specific mm download messes that up. If any of your mods depend on ModuleManager, then CKAN should install it automatically assuming their metadata is set up correctly. CKAN usually doesn't install dependencies from specific mods' downloads, but rather downloads the dependencies separately and installs them. Quote Link to comment Share on other sites More sharing options...
jpinard Posted April 23, 2016 Share Posted April 23, 2016 9 hours ago, blowfish said: If any of your mods depend on ModuleManager, then CKAN should install it automatically assuming their metadata is set up correctly. CKAN usually doesn't install dependencies from specific mods' downloads, but rather downloads the dependencies separately and installs them. Great, thanks for explaining that blowfish! Quote Link to comment Share on other sites More sharing options...
Mokmo Posted April 23, 2016 Share Posted April 23, 2016 (edited) I'm trying to understand a thing, patch has this: @PART[S_HAHM_P]:NEEDS[RemoteTech] { !MODULE[ModuleDataTransmitter]{} @MODULE[ModuleAnimateGeneric] { %allowManualControl = true } %TechRequired = precisionEngineering %MODULE[ModuleRTAntenna] { %Mode0DishRange = 0 %Mode1DishRange = 60000000 %EnergyCost = 0.1 %MaxQ = 6000 %DishAngle = 3 %DeployFxModules = 0 %TRANSMITTER { %PacketInterval = 0.3 %PacketSize = 2 %PacketResourceCost = 0.5 } } %MODULE[ModuleSPUPassive] {} } But RemoteTech isn't installed. Looking into alt-F12 menus, i see that the patch was applied even though the condition wasn't fulfilled, and yes i did reverify that RemoteTech wasn't there. Edited April 23, 2016 by Mokmo Missing words Quote Link to comment Share on other sites More sharing options...
Alshain Posted April 23, 2016 Share Posted April 23, 2016 (edited) Hey guys, what am I doing wrong here. I have this script that used to work in 1.0.5 but now it seems as though it does not on 1.1 with the latest module manager. Any ideas? @PHYSICSGLOBALS { prelaunchDefaultThrottle = 0 } The logs seems to indicate the patch is being loaded, but the throttle does not start at 0. Edited April 23, 2016 by Alshain Quote Link to comment Share on other sites More sharing options...
razark Posted April 23, 2016 Share Posted April 23, 2016 4 minutes ago, Alshain said: Hey guys, what am I doing wrong here. I have this script that used to work in 1.0.5 but now it seems as though it does not on 1.1 with the latest module manager. Any ideas? I do not grok the module manager syntax, but might it be because the prelaunchDefaultThrottle line now exists in 1.1 by default, and it didn't in 1.0.5? Quote Link to comment Share on other sites More sharing options...
Alshain Posted April 23, 2016 Share Posted April 23, 2016 (edited) 2 minutes ago, razark said: I do not grok the module manager syntax, but might it be because the prelaunchDefaultThrottle line now exists in 1.1 by default, and it didn't in 1.0.5? Hmm, could be. Maybe I have to modify the value instead of adding it now. EDIT: Yep, that was it. New Script: @PHYSICSGLOBALS { @prelaunchDefaultThrottle = 0 } Edited April 23, 2016 by Alshain Quote Link to comment Share on other sites More sharing options...
sarbian Posted April 23, 2016 Author Share Posted April 23, 2016 42 minutes ago, Mokmo said: I'm trying to understand a thing, patch has this: [...] But RemoteTech isn't installed. Looking into alt-F12 menus, i see that the patch was applied even though the condition wasn't fulfilled, and yes i did reverify that RemoteTech wasn't there. Hard to tell without a log. Are you sure you do not have a RemoteTech directory ? Quote Link to comment Share on other sites More sharing options...
Mokmo Posted April 23, 2016 Share Posted April 23, 2016 30 minutes ago, sarbian said: Hard to tell without a log. Are you sure you do not have a RemoteTech directory ? Question: After looking into my logs, another mod is using "FOR[RemoteTech]" and the "Non-DLL mods added (:FOR[xxx]):" has it listed. Does it mean the patcher now assumes RemoteTech is there ? I might have found my issue Quote Link to comment Share on other sites More sharing options...
sarbian Posted April 23, 2016 Author Share Posted April 23, 2016 10 minutes ago, Mokmo said: Question: After looking into my logs, another mod is using "FOR[RemoteTech]" and the "Non-DLL mods added (:FOR[xxx]):" has it listed. Does it mean the patcher now assumes RemoteTech is there ? I might have found my issue Yes, it should do a NEED instead FOR. Quote Link to comment Share on other sites More sharing options...
Mokmo Posted April 23, 2016 Share Posted April 23, 2016 12 minutes ago, sarbian said: Yes, it should do a NEED instead FOR. ok i'll advise the modder in question Quote Link to comment Share on other sites More sharing options...
TheUnamusedFox Posted April 23, 2016 Share Posted April 23, 2016 (edited) Could someone explain to me :FOR ? Such as in planetary base systems, @PART[KKAOSS_LS_container_greenhouse]:FOR[PlanetarySurfaceStructures]:NEEDS[TacLifeSupport] , what exactly does the :FOR[PlanetarySurfaceStructures] do? Edited April 23, 2016 by lagcity613 Quote Link to comment Share on other sites More sharing options...
sarbian Posted April 23, 2016 Author Share Posted April 23, 2016 For tell MM that a mod called "PlanetarySurfaceStructures" is present. So other patch with :NEED[PlanetarySurfaceStructures] will be executed. Quote Link to comment Share on other sites More sharing options...
TheUnamusedFox Posted April 23, 2016 Share Posted April 23, 2016 (edited) 5 minutes ago, sarbian said: For tell MM that a mod called "PlanetarySurfaceStructures" is present. So other patch with :NEED[PlanetarySurfaceStructures] will be executed. Thank you ^.^ I'd seen this in other mod's patches, but I could never find what it was meant to do. Is it possible to edit something like "PART:NEEDS[TacLifeSupport|USILifeSupport|IFILifeSupport|Snacks]" With a patch, to add |Kerbalism ? Edited April 23, 2016 by lagcity613 Quote Link to comment Share on other sites More sharing options...
FireFaced Posted April 23, 2016 Share Posted April 23, 2016 (edited) How does one have MM execute math in relation to variables in configs it's editing? Edited April 23, 2016 by FireFaced Quote Link to comment Share on other sites More sharing options...
blowfish Posted April 23, 2016 Share Posted April 23, 2016 11 minutes ago, FireFaced said: How does one have MM execute math in relation to variables in configs it's editing? See the second example here. The allowed operators (IIRC) are +=, -=, *=, /=, and != Quote Link to comment Share on other sites More sharing options...
blowfish Posted April 23, 2016 Share Posted April 23, 2016 @sarbian I just tried compiling MM from source and running the included test cases and I got a failure. Is this something to be worried about, or just an issue with my setup? Spoiler [ModuleManager] Test NodeInsert[0] failed as expected output and actual output differ. expected: MMTEST { name = nodeInsert MODULE { name = module0 } MODULE { name = module1 } MODULE { name = module2 } MODULE { name = module999 } } Actually got: MMTEST { name = nodeInsert MODULE { name = module1 } MODULE { name = module2 } MODULE,0 { name = module0 } MODULE,9999 { name = module999 } } Quote Link to comment Share on other sites More sharing options...
Jacke Posted April 23, 2016 Share Posted April 23, 2016 Tried searching but this IPS4 forum software is crap for fiddly details. I think there's there a MM syntax qualifier similar to ":FINAL" but executes the changes first, before other changes without qualifiers. Is it ":START" or ":FIRST" or something else? Quote Link to comment Share on other sites More sharing options...
blowfish Posted April 23, 2016 Share Posted April 23, 2016 @Jacke: It's :FIRST Quote Link to comment Share on other sites More sharing options...
Andem Posted April 23, 2016 Share Posted April 23, 2016 Ok, the wiki has been vague at best, could somebody please walk me through changing the attatchment nodes on the megalador solar panels? Quote Link to comment Share on other sites More sharing options...
Rexeh Posted April 24, 2016 Share Posted April 24, 2016 While loading on startup, I pause at this point. Spoiler I looked at some fixes, but they did not work. This is happening with 1.1. Is anyone else having this? Quote Link to comment Share on other sites More sharing options...
sarbian Posted April 24, 2016 Author Share Posted April 24, 2016 (edited) v2.6.23 is out @blowfish patch to add & operator: insert only if it doesn't already exist Fix for the insert NODE at position keeping the index in the node name that blowfish found fix for nested constraint not looking past the first result @Andem Changing a node is easy. I don't have the cfg for the part you talk about but it should look like : @PART[megalador] { @node_attach = the new values you want } It should work unless it uses more advanced config. Edited April 24, 2016 by sarbian 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.