Badsector Posted February 18, 2016 Share Posted February 18, 2016 Can work this patch ? @PART[PotatoRoid] { @MODULE[ModuleAsteroid] { @mass = #$mass/10 } RESOURCE { name = Rock amount = 3600 maxAmount = 3600 @amount *= #$/mass$ @maxAmount *= #$/mass$ } } what i want is have mass=mass/10 and the resource mass/10*amount Link to comment Share on other sites More sharing options...
sarbian Posted February 18, 2016 Author Share Posted February 18, 2016 (edited) 18 minutes ago, Badsector said: This should do it if I understood what you want @PART[PotatoRoid] { @MODULE[ModuleAsteroid] { @mass /= 10 } RESOURCE { name = Rock amount = 3600 maxAmount = 3600 @amount *= #$../MODULE[ModuleAsteroid]/mass$ @maxAmount *= #$../MODULE[ModuleAsteroid]/mass$ } } Edited February 18, 2016 by sarbian Link to comment Share on other sites More sharing options...
Badsector Posted February 18, 2016 Share Posted February 18, 2016 5 minutes ago, sarbian said: Thanks, i have do one misspelling but probably the correct code is @PART[PotatoRoid] { @mass = #$mass/10 RESOURCE { name = Rock amount = 3600 maxAmount = 3600 @amount *= #$../mass$ @maxAmount *= #$../mass$ } } on this way if asteroid have mass = 150 the result is mass = 15 RESOURCE { name = Rock amount = 54000 (3600*15) maxAmount = 54000 (3600*15) } Link to comment Share on other sites More sharing options...
Sigma88 Posted February 18, 2016 Share Posted February 18, 2016 15 minutes ago, Badsector said: @mass = #$mass/10 this makes no sense if you want to divide the mass by 10 you need to use @mass /= 10 Link to comment Share on other sites More sharing options...
Badsector Posted February 18, 2016 Share Posted February 18, 2016 Tanks for the explanations, but i have find that, mining asteroid already reduce the mass and i don't need to add extra resources Thanks again Regards Luca Link to comment Share on other sites More sharing options...
Kerbas_ad_astra Posted February 18, 2016 Share Posted February 18, 2016 A bug report in my SMURFF thread got me thinking about errors and caching. Currently, as Module Manager does its work, it makes a note in the log of errors that it encounters -- which file and patch caused them, and maybe what part it was acting on (it's been a while since I've seen an MM error). However, when KSP gets restarted, assuming nothing changes, Module Manager loads the cache, errors and all, and doesn't say anything in the log because it's "forgotten" that any errors occurred at all. I'm not sure that errors should force a reload of all patches (presumably, if the cache is loaded, nothing's changed, so the errors would just happen again anyway), but I think at the least, errors should be stored in the cache as well, so that when MM loads the cache, it can add a reminder that those errors were thrown when the patches were originally processed. Link to comment Share on other sites More sharing options...
Sigma88 Posted February 18, 2016 Share Posted February 18, 2016 9 minutes ago, Kerbas_ad_astra said: A bug report in my SMURFF thread got me thinking about errors and caching. Currently, as Module Manager does its work, it makes a note in the log of errors that it encounters -- which file and patch caused them, and maybe what part it was acting on (it's been a while since I've seen an MM error). However, when KSP gets restarted, assuming nothing changes, Module Manager loads the cache, errors and all, and doesn't say anything in the log because it's "forgotten" that any errors occurred at all. I'm not sure that errors should force a reload of all patches (presumably, if the cache is loaded, nothing's changed, so the errors would just happen again anyway), but I think at the least, errors should be stored in the cache as well, so that when MM loads the cache, it can add a reminder that those errors were thrown when the patches were originally processed. I've had this issue many times as well I usually end up asking the player to delete the cache before generating the logs Link to comment Share on other sites More sharing options...
sarbian Posted February 18, 2016 Author Share Posted February 18, 2016 Indeed, this is a bad behavior. Fixed in 2.6.20. Link to comment Share on other sites More sharing options...
ShadyAct Posted February 24, 2016 Share Posted February 24, 2016 I'm trying to get the value of the baseVolume variable from a module and change that part's title to it (for debugging purposes) Spoiler @PART[*]:HAS[@MODULE[ModuleB9PartSwitch]]:HAS[#moduleID[fuelSwitch]]:FINAL { LFAmount = 1 @MODULE[ModuleB9PartSwitch] { @$/../LFAmount$ = #$baseVolume$ } @title = #$LFAmount$ } But with this the title just ends up being "1". Link to comment Share on other sites More sharing options...
sarbian Posted February 24, 2016 Author Share Posted February 24, 2016 Yes, because the order of execution is not what your think. MM see only the config after they are parsed by KSP so what it actually see (and do) is : @PART[*]:HAS[@MODULE[ModuleB9PartSwitch]]:HAS[#moduleID[fuelSwitch]]:FINAL { LFAmount = 1 @title = #$LFAmount$ @MODULE[ModuleB9PartSwitch] { @$/../LFAmount$ = #$baseVolume$ } } To do this kind of things you need to apply 2 patch. Link to comment Share on other sites More sharing options...
blowfish Posted February 24, 2016 Share Posted February 24, 2016 1 hour ago, ShadyAct said: I'm trying to get the value of the baseVolume variable from a module and change that part's title to it (for debugging purposes) Reveal hidden contents @PART[*]:HAS[@MODULE[ModuleB9PartSwitch]]:HAS[#moduleID[fuelSwitch]]:FINAL { LFAmount = 1 @MODULE[ModuleB9PartSwitch] { @$/../LFAmount$ = #$baseVolume$ } @title = #$LFAmount$ } But with this the title just ends up being "1". A few things If you're just debugging, you might want to look at ModuleManager.configcache in GameData. It contains the final state of everything in the game database after MM runs (and right before the parts are loaded). I wouldn't recommend relying on moduleID to identify the fuel switching modules. I tried to use conventions throughout B9, but the only requirement is that it is unique per ModuleB9PartSwitch. If you're trying to do something with the volume, you might want to look at the RF/MFT patches in B9 Link to comment Share on other sites More sharing options...
ShadyAct Posted February 24, 2016 Share Posted February 24, 2016 (edited) 24 minutes ago, blowfish said: A few things If you're just debugging, you might want to look at ModuleManager.configcache in GameData. It contains the final state of everything in the game database after MM runs (and right before the parts are loaded). I wouldn't recommend relying on moduleID to identify the fuel switching modules. I tried to use conventions throughout B9, but the only requirement is that it is unique per ModuleB9PartSwitch. If you're trying to do something with the volume, you might want to look at the RF/MFT patches in B9 Thanks. Once I get better at this I'm going to publish a book called, "Module Manager for Dummies". Edit: Is there a programming language that resembles Module Manager code? I want to get better syntax highlighting in Notepad++, if possible. Edited February 24, 2016 by ShadyAct Link to comment Share on other sites More sharing options...
Badsector Posted February 26, 2016 Share Posted February 26, 2016 is possible change asteroid mesh with modulemanager ? i have try this but don't seems to work @PART[PotatoRoid]:FOR[DST_Potato] { !mesh = PotatoRoid.mu mesh = DST_Potato/Potato.mu } Link to comment Share on other sites More sharing options...
sarbian Posted February 26, 2016 Author Share Posted February 26, 2016 To change a value you just need to do a @valuename = new value. But your problem is not ModuleManager here. The mesh value only work for model that are in the same directory than the cfg. You need a MODEL node to change that AFAIK but that s a bit outside my experience field. Have a look at post like this one Link to comment Share on other sites More sharing options...
Sigma88 Posted February 26, 2016 Share Posted February 26, 2016 @sarbian I was trying out the new loop feature (very cool btw) and I noticed that every time the loop repeats it writes in the cache a new node called MM_PATCH_LOOP {} Is this intentional/needed? Link to comment Share on other sites More sharing options...
sarbian Posted February 26, 2016 Author Share Posted February 26, 2016 nope. I need to have a look since NK also reported trouble Link to comment Share on other sites More sharing options...
Sigma88 Posted February 26, 2016 Share Posted February 26, 2016 3 minutes ago, sarbian said: nope. I need to have a look since NK also reported trouble for what is worth, the patch I wrote worked very well. There was only that weird leftover, but it had zero impact on the result. Link to comment Share on other sites More sharing options...
Miravlix Posted February 28, 2016 Share Posted February 28, 2016 [LOG 12:11:16.053] [ModuleManager] Saving cache [LOG 12:11:16.255] [ModuleManager] NullReferenceException while saving the cache System.NullReferenceException: Object reference not set to an instance of an object at (wrapper stelemref) object:stelemref (object,intptr,object) at ConfigNode.WriteNodeString (System.IO.StreamWriter sw, System.String indent) [0x00000] in <filename unknown>:0 at ConfigNode.WriteNodeString (System.IO.StreamWriter sw, System.String indent) [0x00000] in <filename unknown>:0 at ConfigNode.WriteRootNode (System.IO.StreamWriter sw) [0x00000] in <filename unknown>:0 at ConfigNode.WriteNode (System.IO.StreamWriter sw) [0x00000] in <filename unknown>:0 at ConfigNode.Save (System.String fileFullName, System.String header) [0x00000] in <filename unknown>:0 at ConfigNode.Save (System.String fileFullName) [0x00000] in <filename unknown>:0 at ModuleManager.MMPatchLoader.CreateCache () [0x00000] in <filename unknown>:0 [LOG 12:11:16.265] [ModuleManager] An error occured while creating the cache. Deleting the cache files to avoid keeping a bad cache [LOG 12:11:16.269] [ModuleManager] Exception while deleting the cache System.IO.IOException: Sharing violation on path C:/Program Files (x86)/Steam/steamapps/common/Kerbal Space Program/KSP_Data/../\GameData\ModuleManager.ConfigCache at System.IO.File.Delete (System.String path) [0x00000] in <filename unknown>:0 at ModuleManager.MMPatchLoader.CreateCache () [0x00000] in <filename unknown>:0 [LOG 12:11:16.288] [ModuleManager] ModuleManager: 6684 patches applied Was wondering why cache runs was so rare on my system lately. Not sure whats up with this, sometimes it create the cache just fine. That was a run where the only change was to MyMM.cfg, my own MM file and while exiting KSP gracefully. (Not due to Memory crash) [LOG 12:45:44.461] [ModuleManager] Saving cache [LOG 12:45:45.128] [ModuleManager] ModuleManager: 6684 patches applied Now the second run, again due to editing MyMM.cfg, it happily creates the cache. I would have added a third run, without changing anything, where the cache should be loaded, but I couldn't help myself and added some comments to MyMM.cfg. Link to comment Share on other sites More sharing options...
KerbonautInTraining Posted February 28, 2016 Share Posted February 28, 2016 Just to be sure, if I delete all but the latest version of MM will I have any backwards compatibility issues? Link to comment Share on other sites More sharing options...
blowfish Posted February 28, 2016 Share Posted February 28, 2016 1 hour ago, KerbonautInTraining said: Just to be sure, if I delete all but the latest version of MM will I have any backwards compatibility issues? Even if you don't the older versions should disable themselves, but yes - you are fine to delete them. Link to comment Share on other sites More sharing options...
KerbonautInTraining Posted February 28, 2016 Share Posted February 28, 2016 38 minutes ago, blowfish said: Even if you don't the older versions should disable themselves, but yes - you are fine to delete them. Thanks! Link to comment Share on other sites More sharing options...
sarbian Posted March 1, 2016 Author Share Posted March 1, 2016 On 28/2/2016 at 0:59 PM, Miravlix said: [LOG 12:11:16.053] [ModuleManager] Saving cache [LOG 12:11:16.255] [ModuleManager] NullReferenceException while saving the cache System.NullReferenceException: Object reference not set to an instance of an object at (wrapper stelemref) object:stelemref (object,intptr,object) at ConfigNode.WriteNodeString (System.IO.StreamWriter sw, System.String indent) [0x00000] in <filename unknown>:0 at ConfigNode.WriteNodeString (System.IO.StreamWriter sw, System.String indent) [0x00000] in <filename unknown>:0 at ConfigNode.WriteRootNode (System.IO.StreamWriter sw) [0x00000] in <filename unknown>:0 at ConfigNode.WriteNode (System.IO.StreamWriter sw) [0x00000] in <filename unknown>:0 at ConfigNode.Save (System.String fileFullName, System.String header) [0x00000] in <filename unknown>:0 at ConfigNode.Save (System.String fileFullName) [0x00000] in <filename unknown>:0 at ModuleManager.MMPatchLoader.CreateCache () [0x00000] in <filename unknown>:0 [LOG 12:11:16.265] [ModuleManager] An error occured while creating the cache. Deleting the cache files to avoid keeping a bad cache [LOG 12:11:16.269] [ModuleManager] Exception while deleting the cache System.IO.IOException: Sharing violation on path C:/Program Files (x86)/Steam/steamapps/common/Kerbal Space Program/KSP_Data/../\GameData\ModuleManager.ConfigCache at System.IO.File.Delete (System.String path) [0x00000] in <filename unknown>:0 at ModuleManager.MMPatchLoader.CreateCache () [0x00000] in <filename unknown>:0 [LOG 12:11:16.288] [ModuleManager] ModuleManager: 6684 patches applied Was wondering why cache runs was so rare on my system lately. Not sure whats up with this, sometimes it create the cache just fine. That was a run where the only change was to MyMM.cfg, my own MM file and while exiting KSP gracefully. (Not due to Memory crash) [LOG 12:45:44.461] [ModuleManager] Saving cache [LOG 12:45:45.128] [ModuleManager] ModuleManager: 6684 patches applied Now the second run, again due to editing MyMM.cfg, it happily creates the cache. I would have added a third run, without changing anything, where the cache should be loaded, but I couldn't help myself and added some comments to MyMM.cfg. I feel that an Antivirus or Window protection blocked the file operations in "C:/Program Files (x86)". I strongly suggest you create an new Steam library outside "C:/Program Files (x86)" and reinstall KSP there. Link to comment Share on other sites More sharing options...
maculator Posted March 4, 2016 Share Posted March 4, 2016 Hi, I'm kind of stuck here can anyone have a quick look at this and tell me what I'm doing wrong? @PART[*]:HAS[@MODULE[ModuleFuelJettison]] { %SimpleAm = #$RESOURCE[Ore]/maxAmount$ %DoubleAm = #$SimpleAm$ @DoubleAm *= 2 %Weight = #$mass$ MODULE { name = InterstellarFuelSwitch resourceNames = Ore;Metal;RocketParts resourceAmounts = #$SimpleAm$;#$SimpleAm$;#$DoubleAm$ tankMass = #$Weight$;#$Weight$;#$Weight$ basePartMass = 0.0 displayCurrentTankCost = true hasGUI = true availableInFlight = false availableInEditor = true showInfo = true } } For some reason it refuses to work the way I want. The intended use is to apply the fuelswitch to all ore tanks at once. Link to comment Share on other sites More sharing options...
sarbian Posted March 4, 2016 Author Share Posted March 4, 2016 5 hours ago, maculator said: Hi, I'm kind of stuck here can anyone have a quick look at this and tell me what I'm doing wrong? For some reason it refuses to work the way I want. The intended use is to apply the fuelswitch to all ore tanks at once. This should do it. I added a check for Ore since checking for ModuleFuelJettison only seem a bit hazardous. And I fixed the variable syntax (# is only used once per line) and variable search (../ for a variable in a lower context) @PART[*]:HAS[@MODULE[ModuleFuelJettison],@RESOURCE[Ore]] { %SimpleAm = #$RESOURCE[Ore]/maxAmount$ %DoubleAm = #$SimpleAm$ @DoubleAm *= 2 %Weight = #$mass$ MODULE { name = InterstellarFuelSwitch resourceNames = Ore;Metal;RocketParts resourceAmounts = #$../SimpleAm$;$../SimpleAm$;$../DoubleAm$ tankMass = #$../Weight$;$../Weight$;$../Weight$ basePartMass = 0.0 displayCurrentTankCost = true hasGUI = true availableInFlight = false availableInEditor = true showInfo = true } } Link to comment Share on other sites More sharing options...
maculator Posted March 5, 2016 Share Posted March 5, 2016 Thanks. Can you also tell me what this: ../ does? Because obviously thats the part I didn' understand :/ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now