Jump to content

[1.8.x-1.12.x] Module Manager 4.2.3 (July 03th 2023) - Fireworks season


sarbian

Recommended Posts

11 minutes ago, evileye.x said:

I'm trying to rebalance AIES engines ISP with MM patch.

The idea is

If Vacuum ISP >330 , then ISP = ISP *,9


@PART[*]:NEEDS[AIES_Aerospace]:HAS[@MODULE[ModuleEngines*],#manufacturer[AIES?Aerospace]]
{	
	@MODULE[ModuleEngines*]
	{
		@atmosphereCurve
		{
			%selectcur = #$key,0[1, ]$
		}			
	}
}	
@PART[*]:NEEDS[AIES_Aerospace]:HAS[@MODULE[ModuleEngines*],#manufacturer[AIES?Aerospace],#selectcur[>330]]
{
@MODULE[ModuleEngines*]
	{
			@atmosphereCurve
		{
			key0 = #$key,0[1, ]$
			@key0 *= 0.9
			@key,0 = #0 $key0$
			key1 = #$key,1[1, ]$
			@key1 *= 0.9
			@key,1 = #1 $key1$	
		}			
	}
}		

Doesn't work.

I don't get how to use conditions based on variables

As you have it, selectcur will be inside ModuleEngines*/atmosphereCurve, but your patch is looking for it in the root part node.  Best option is probably to put the  check on atmosphereCurve: @atmosphereCurve:HAS[#selectcur[>330]]

Link to comment
Share on other sites

selectcur is inside a ModuleEngines and atmosphereCurve. 

@PART[*]:NEEDS[AIES_Aerospace]:HAS[@MODULE[ModuleEngines*]:HAS[@atmosphereCurve:HAS[#selectcur[>330]]],#manufacturer[AIES?Aerospace]]

Link to comment
Share on other sites

46 minutes ago, FlarpingFlipperFlapper said:

What are the rules on using the //  for commenting?

Ive noticed  this:

{code}  // stuff about the parts bla bla here 

 

but then:

//{code}

where they did not use a space. What is the correct way?

 

 

Anything after the // will be ignored.  So in the second example, the code will not do anything, but in the first it will.  Spaces are ignored regardless (at least in this context)

Edited by blowfish
Link to comment
Share on other sites

Is it possible to copy a string from a node on a part and add it to the end of another string? If so how can I modify this code to work better? Thanks!  Example

Spoiler

@PART[*]:HAS[@MODULE[MissileLauncher]]
{
	@description ^= :$: #$/MODULE[MissileLauncher]/targetingType$.:
}

 

 

Edited by Svm420
Link to comment
Share on other sites

26 minutes ago, Svm420 said:

Is it possible to copy a string from a node on a part and add it to the end of another string? If so how can I modify this code to work better? Thanks!  Example

  Hide contents



@PART[*]:HAS[@MODULE[MissileLauncher]]
{
	@description ^= :$: #$/MODULE[MissileLauncher]/targetingType$.:
}

 

 

I would go with

 

@description = #$description$$/MODULE[MissileLauncher]/targetingType$

 

that line would add the content of targetingType at the end of the content of description

Link to comment
Share on other sites

On 10/25/2013, 9:01:36, sarbian said:

There is a ingame DB reload/dump menu you can open with ALT-F11

I think I found a minor bug with the "Dump DB to file" feature. SCANsat comes with a config to create an Agent with the name, "SCAN: Scientific Committee on Advanced Navigation" - and the "Dump DB to file" feature creates config files named with a path down to the Agent name. And the file can't be created since it contains a colon. At least I think that's what's going on...

IsolatedStorageException: Could not find a part of the path "D:\KSP\KSP v1.00.5 (Win) - Mods\_MMCfgOutput\SCANsat.Flags.Agents.SCAN: Scientific Committee on Advanced Navigation.cfg".
  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0 

  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share) [0x00000] in <filename unknown>:0 

  at System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) [0x00000] in <filename unknown>:0 

  at System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding) [0x00000] in <filename unknown>:0 

  at System.IO.File.WriteAllText (System.String path, System.String contents, System.Text.Encoding encoding) [0x00000] in <filename unknown>:0 

  at System.IO.File.WriteAllText (System.String path, System.String contents) [0x00000] in <filename unknown>:0 

  at ModuleManager.ModuleManager.OutputAllConfigs () [0x00000] in <filename unknown>:0 

  at ModuleManager.ModuleManager+<DataBaseReloadWithMM>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0

 

Link to comment
Share on other sites

I've been trying to accomplish a particular task and have been scratching my head-- from the documentation, it seems like ModuleManager ought to be able to do this, but I can't for the life of me figure out what's wrong with my syntax.

What I'm trying to do is to create a filter that will address every part that has an engineer specialty.  (For example, consider the ISRU config file; the ModuleResourceConverter in it has "Specialty = Engineer".)

The "Specialty" field shows up on modules.  So basically, what I need is "every part which has any module that has a Specialty field whose value is Engineer."  This is what I've been trying:

@PART[*]:HAS[@MODULE[*]:HAS[#Specialty[Engineer]]] {
    // do stuff
}

...except that this doesn't seem to work. It doesn't match any parts.  (For example, if I stick a "@description ^= :(.)$:$0 Specialty for engineers.:" inside the body, nothing's description gets decorated.)  I've gone round and round on this, but haven't been able to find a variation that works.

On the other hand, it appears to work if I replace the MODULE designator so that it uses a specific module name instead of a wildcard, like this:

@PART[*]:HAS[@MODULE[ModuleResourceConverter]:HAS[#Specialty[Engineer]]] {
    // do stuff
}

Any advice?  Is this:

  • a bug?
  • behavior as designed?
  • something I'm doing wrong?
Edited by Snark
Link to comment
Share on other sites

30 minutes ago, Snark said:

I've been trying to accomplish a particular task and have been scratching my head-- from the documentation, it seems like ModuleManager ought to be able to do this, but I can't for the life of me figure out what's wrong with my syntax.

What I'm trying to do is to create a filter that will address every part that has an engineer specialty.  (For example, consider the ISRU config file; the ModuleResourceConverter in it has "Specialty = Engineer".)

The "Specialty" field shows up on modules.  So basically, what I need is "every part which has any module that has a Specialty field whose value is Engineer."  This is what I've been trying:


@PART[*]:HAS[@MODULE[*]:HAS[#Specialty[Engineer]]] {
    // do stuff
}

...except that this doesn't seem to work. It doesn't match any parts.  (For example, if I stick a "@description ^= :(.)$:$0 Specialty for engineers.:" inside the body, nothing's description gets decorated.)  I've gone round and round on this, but haven't been able to find a variation that works.

On the other hand, it appears to work if I replace the MODULE designator so that it uses a specific module name instead of a wildcard, like this:


@PART[*]:HAS[@MODULE[ModuleResourceConverter]:HAS[#Specialty[Engineer]]] {
    // do stuff
}

Any advice?  Is this:

  • a bug?
  • behavior as designed?
  • something I'm doing wrong?

I think your problem is that the second "HAS" checks only the first MODULE of any given PART

try this:

@PART,*
{
	@MODULE:HAS[#Specialty[Engineer]]
	{
		// stuff
	}
}

I had a similar issue in the past and I'm not sure there's a solution.

 

If you want to edit stuff outside the @MODULE node you can do something like this:

@PART:HAS[@MODULE]
{
	@MODULE,*
	{
		%editPart = False
	}
	@MODULE:HAS[#specialty[Engineer]]
	{
		%editPart = True
	}
}
@PART:HAS[@MODULE]
{
	%editPart = #$MODULE/editPart$
}
@PART:HAS[#editPart[True]]
{
	// changes
}
@PART:HAS[#editPart[*]]
{
	!editPart = DEL
	@MODULE,*
	{
		!editPart = DEL
	}
}

there's probably a more elegant way to do it, but at least this should work :D

Edited by Sigma88
Link to comment
Share on other sites

Can I use the following config to edit the presenceChance both resource types of XenonGas all in one (it is both atmospheric and oceanic):

@GLOBAL_RESOURCE:HAS[#ResourceName[XenonGas]]
{	
	@Distribution
	{
		@PresenceChance = 100
	}
}

 

Or do I have to do it for each resource type like so:

@GLOBAL_RESOURCE:HAS[#ResourceName[XenonGas],#ResourceType[1]]
{	
	@Distribution
	{
		@PresenceChance = 100
	}
}

@GLOBAL_RESOURCE:HAS[#ResourceName[XenonGas],#ResourceType[2]]
{	
	@Distribution
	{
		@PresenceChance = 100
	}
}

 

For reference this is the config I am trying to alter.

GLOBAL_RESOURCE
{
	ResourceName = XenonGas
	ResourceType = 2
	
	Distribution
	{
		PresenceChance = 75
		MinAbundance = .001
		MaxAbundance = 1
		Variance = 5
	}
}
GLOBAL_RESOURCE
{
	ResourceName = XenonGas
	ResourceType = 1
	
	Distribution
	{
		PresenceChance = 75
		MinAbundance = .001
		MaxAbundance = 1
		Variance = 50
	}
}

 

Edited by Spagoose
Link to comment
Share on other sites

2 hours ago, Sigma88 said:

I think your problem is that the second "HAS" checks only the first MODULE of any given PART

...

If you want to edit stuff outside the @MODULE node you can do something like this:

<code>

there's probably a more elegant way to do it, but at least this should work :D

Excellent, that's just what I needed!  Thanks.

Link to comment
Share on other sites

I'm trying to go through configurable tanks and re-volume them. Below is what I have (no errors, but no success). Ironically, it doesn't ruin the part as I thought it would. I expected to fail because entries in "resourceAmounts" are not exclusively comma delimited. So my hunch was that when I replaced resource amounts, var* would be empty and I'd get a bunch of zeros.

But that's not what happened... instead, there was no discernible effect at all.  I included a sample part in the example.

 

@PART[TPtank1m0mA]:FOR[FuelTanksPlus]:NEEDS[!InterstellarFuelSwitch|InterstellarFuelSwitch&!CryoEngines]
{
	MODULE
	{
		name:NEEDS[!InterstellarFuelSwitch|CryoEngines] = FSfuelSwitch
		name:NEEDS[InterstellarFuelSwitch&!CryoEngines] = InterstellarFuelSwitch
		resourceGui:NEEDS[InterstellarFuelSwitch] = LiquidFuel+Oxidizer;LiquidFuel;Oxidizer
		resourceNames = LiquidFuel,Oxidizer;LiquidFuel;Oxidizer
		resourceAmounts = 45,55;90;110
		basePartMass = 0.0625
	}
}   

@PART[TP*]:HAS[MODULE[FSfuelSwitch]]
{
	@MODULE[FSfuelSwitch]
	{
		var0 = #$resourceAmounts[0]$
		var1 = #$resourceAmounts[1]$
		var2 = #$resourceAmounts[2]$
		var3 = #$resourceAmounts[3]$
		@var0 *= 1.5
		@var1 *= 1.5
		@var2 *= 1.5
		@var3 *= 1.5
		@resourceAmounts = #$var0$,$var1$;$var3$;$var4$
	}
}

@PART[TP*]:HAS[MODULE[InterstellarFuelSwitch]]
{
	@MODULE[InterstellarFuelSwitch]
	{
		var0 = #$resourceAmounts[0]$
		var1 = #$resourceAmounts[1]$
		var2 = #$resourceAmounts[2]$
		var3 = #$resourceAmounts[3]$
		@var0 *= 1.5
		@var1 *= 1.5
		@var2 *= 1.5
		@var3 *= 1.5
		@resourceAmounts = #$var0$,$var1$;$var3$;$var4$
	}
}

Any suggestions? Or is this not supported in MM?

Link to comment
Share on other sites

8 hours ago, blowfish said:

Going to need some context on that.

Its in some of RaiderNIcks parts. Its a MODULE with brackets and a name = TankPriorityModule. Its believed to cause a bug where a fuel tank that has a built engine will fire on the launch pad for no reason even though it is way up in the staging order.

38 minutes ago, NathanKell said:

IIRC that's from asmi's ECLSS ?

I have no clue what that is :/

Link to comment
Share on other sites

OK so I today I noticed quite a few of my command pods do not have aero/thermal re-entry effects. In my physics tab in the alt+f12 menu show that the ModuleManager physics is loaded an not physics.cfg. I can't seem to figure out how to set physics.cfg as the default. Is there a way to do it? I'm running the 64bit work around and have a ton of mods. I hope it's an easy fix and I won't have to go mod by mod to find the culprit. I'm not home currently so I can't post a log at the moment. any suggestions?

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...