Jump to content

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


sarbian

Recommended Posts

18 minutes ago, Whovian41110 said:

@PART[*]:HAS[#CrewCapacity[>0]]:NEEDS[UmbraSpaceIndustries]
{
    %RESOURCE[Supplies]
    {
        %amount = 15
        @amount *= #$/CrewCapacity$
        %maxAmount = #$amount$
    }
    %RESOURCE[Mulch]
    {
        %amount = 0
        @amount *= #$/CrewCapacity$ you don't need this line since you want initial amount to be always 0
        %maxAmount = 15
        @maxAmount *= #$/CrewCapacity$
    }
}

replace both red lines with

Quote

@amount *= #$../CrewCapacity$

 

Edited by Sigma88
Link to comment
Share on other sites

6 minutes ago, Sigma88 said:

replace both red lines with

@amount *= #$../CrewCapacity$

Shouldn't #$/CrewCapacity$ work though?  IIRC / refers to whatever root node you're currently part of, in this case the part.

Link to comment
Share on other sites

30 minutes ago, blowfish said:

Shouldn't #$/CrewCapacity$ work though?  IIRC / refers to whatever root node you're currently part of, in this case the part.

oh you are right :D (I'm not used to edit so close to the root)

@Whovian41110 just delete the second red line

Edited by Sigma88
Link to comment
Share on other sites

@blowfish I'm trying to make a patch which creates a new attachment node from the contents of the node_attach.

@PART[*]:HAS[@MODULE[ModuleDeployableSolarPanel]]
{
    %node_stack_root = #$node_attach$
    @attachRules = 1,1,0,0,1
    @bulkheadProfiles = size1, srf
}

The patched parts in configCache get 'equals' signs without the node names O.o

is that some kind of bug or I messed up my config?

Spoiler

UrlConfig
{
    name = solarPanels4
    type = PART
    parentUrl = Squad/Parts/Electrical/1x6SolarPanels/1x6SolarPanels
    url = Squad/Parts/Electrical/1x6SolarPanels/1x6SolarPanels/solarPanels4
    PART
    {
        name = solarPanels4
        module = Part
        author = NovaSilisko
        mesh = model.mu
        rescaleFactor = 1
        node_attach = 0.0, 0.0, 0.0, 1.0, 0.0, 0.0
        TechRequired = advElectrics
        entryCost = 3800
        cost = 380
        category = Utility
        subcategory = 0
        title = OX-4L 1x6 Photovoltaic Panels
        manufacturer = Probodobodyne Inc
        description = The OX-4 is similar in design to the SP series solar panels, but without the heavy casing.  Includes passive radiators on the reverse side for better heat dissipation. WARNING: Not retractable once deployed!
        attachRules = 0,1,0,0,1
        mass = 0.0175
        dragModelType = default
        maximum_drag = 0.2
        minimum_drag = 0.2
        angularDrag = 1
        crashTolerance = 8
        maxTemp = 1200
        bulkheadProfiles = srf
        thermalMassModifier = 2.0
        emissiveConstant = 0.95
        heatConductivity = 0.04
        tags = array charge deploy e/c elect energ extend generat (light photo power solar sun track unfold volt watt
         = 0.0, 0.0, 0.0, 1.0, 0.0, 0.0
         = 1,1,0,0,1
         = size1, srf

        MODULE
        {
            name = ModuleDeployableSolarPanel
            animationName = solarpanels4
            resourceName = ElectricCharge
            chargeRate = 1.64
            retractable = false
        }
    }
}

P.S. Does the And/Or sign work for modules? this one | . I'd like to expand the patch on wheels as well with  :HAS[@MODULE[ModuleDeployableSolarPanel|ModuleWheelBase]]

Edited by Enceos
Link to comment
Share on other sites

first of all if it's been covered before but I really couldn't found it.

Is there a way to select many parts, filtered by one word in the Title and  change said word for all of them?

 

So Far I've found how to filter a word from the title using variables:

@title = #$@PART[Word]/title$

But I don't know if it's possible to just change said word and keep the rest of the title intact.

 

For example I want to change from:

All Parts where "title =" contains the word "Belle" + more text

to:

Agena + more text

Just change one word and keep the rest.

Same example but real text:

From:

title = Belle-A-25 "Hadar" Liquid Fuel Engine

To:

title = Agena-A-25 "Hadar" Liquid Fuel Engine

 

Is that possible?

 

Thanks!!

 

 

Edited by Drakenex
Link to comment
Share on other sites

1 hour ago, Enceos said:

P.S. Does the And/Or sign work for modules? this one | . I'd like to expand the patch on wheels as well with  :HAS[@MODULE[ModuleDeployableSolarPanel|ModuleWheelBase]]

I have no idea about your first issue, but I don't think OR can work except in the Root node,

so @PART:HAS[@MODULE[A]|@MODULE[C]] should work, but @PART:HAS[@MODULE[A|C]] shouldn't

(there's a small chance I could be wrong on this

17 minutes ago, Drakenex said:

...words...

you could use the "find and replace" which is used like this:

@title ^= :Belle:Agena:

this will edit the key "title" changing all "Belle" to "Agena"

Edited by Sigma88
Link to comment
Share on other sites

18 minutes ago, Sigma88 said:

you could use the "find and replace" which is used like this:

@title ^= :Belle:Agena:

this will edit the key "title" changing all "Belle" to "Agena"

Ohh thaks! and to filter by a word in the name can I use wildcards? like:

@PART[*Agena*]

for

name = bluedog_AgenaA

 

Thanks in advance

 

Edit:

Just found it works like that!

 

(You'll get credit for the patch :wink:)

Edited by Drakenex
Link to comment
Share on other sites

17 minutes ago, Drakenex said:

to filter by a word in the name can I use wildcards? like:

@PART[*Agena*]

technically you don't even need to do that,

Find and Replace will not throw an error if it doesn't find the word you want to replace, so you can use @PART and everything will work out fine anyways.

if you wonder which of the two solutions would be the most efficient, that's something I still wasn't able to understand myself :)

 

but unless you want to put some additional restriction, using the filter should not matter.

even better, if you plan to change more words you could do it all in the same patch:

@PART
{
	@title ^= :first:1st:
	@title ^= :second:2nd:
	@title ^= :third:3rd:
}

Edit:

when a filter is not needed I usually end up omitting it just because it saves some characters in the cfg :D

Edited by Sigma88
Link to comment
Share on other sites

1 minute ago, Sigma88 said:

technically you don't even need to do that,

Find and Replace will not throw an error if it doesn't find the word you want to replace, so you can use @PART and everything will work out fine anyways.

if you wonder which of the two solutions would be the most efficient, that's something I still wasn't able to understand myself :)

 

but unless you want to put some additional restriction, using the filter should not matter.

even better, if you plan to change more words you could do it all in the same patch:


@PART
{
	@title ^= :first:1st:
	@title ^= :second:2nd:
	@title ^= :third:3rd:
}

 

Yup "your logic is undeniable" hehe, thanks a lot!

Link to comment
Share on other sites

1 hour ago, Enceos said:

@blowfish I'm trying to make a patch which creates a new attachment node from the contents of the node_attach.

@PART[*]:HAS[@MODULE[ModuleDeployableSolarPanel]]
{
    %node_stack_root = #$node_attach$
    @attachRules = 1,1,0,0,1
    @bulkheadProfiles = size1, srf
}

The patched parts in configCache get 'equals' signs without the node names O.o

is that some kind of bug or I messed up my config?

That looks right to me, so maybe a bug?  @sarbian would probably know better than I.

1 hour ago, Enceos said:

P.S. Does the And/Or sign work for modules? this one | . I'd like to expand the patch on wheels as well with  :HAS[@MODULE[ModuleDeployableSolarPanel|ModuleWheelBase]]

I'm pretty sure that only works on top-level nodes.

Link to comment
Share on other sites

13 hours ago, blowfish said:

That looks right to me, so maybe a bug?  @sarbian would probably know better than I.

I'm pretty sure that only works on top-level nodes.

Would you please kindly test that config on your KSP install? I'd wish to confirm that it has problems not only on my machine before @sarbian digs into the issue.

Edited by Enceos
Link to comment
Share on other sites

8 minutes ago, Enceos said:

Would you please kindly test that config on your KSP install? I'd wish to confirm that it has problems not only on my machine before @sarbian digs into the issue.

Well, could not replicate.  The URL configs look like I would expect them to.

Does ModuleManager give you any errors in your log? Are any exceptions thrown?

Edited by blowfish
Link to comment
Share on other sites

Spoiler

so, I am in a pickle :|

I need to check if a node contains a certain value which has square brackets, like this:

 


ROOTNODE
{
	MYNODE
	{
		key = abc,def[xyz],ghi
	}
}

I have no idea how to check for the presence of "def[xyz]"

I've tried :HAS[#key[*,def[xyz],*]] but it doesn't work

same for :HAS[#key[*,def?xyz?,*]]

I managed to separate "def" from "[xyz]" by using @key[*,[] ^= :$:,: which gives me key = abc,def,[xyz],ghi, 

But I don't think this will help me.

I've tried removing the brackets using: @key ^= :[:,: but that doesn't work either

@sarbian @blowfish do you have any idea of what might work?

solved, sorry for the ping :)

Edited by Sigma88
Link to comment
Share on other sites

Hi @sarbian

@severedsolo said I should post here and ask you to take a look. He thinks there might be a MM bug involved in this issue. So it seems that when we have the bases and stations contract pack with automatedsciencesampler we run into a problem where it seems to think station science is installed so it ends up causing an error and some of the contract pack gets disabled. At first he thought it was because automatedsciencesampler has a add on dll called stationscience.dll which Severedsolo thought was causing MM to think station science is installed. I had removed that dll and still had the problem. Once I removed the stationscience.cfg in the contract pack, contract config no longer showed the contracts as disabled. The stationscience.dll I deleted was the only one in my gamedata folder. 

I have 2 logs from contract config if they do you any good
Stationcore.log
http://pastebin.com/1LRUXWtF
Surfacesample.log
http://pastebin.com/3p0SVXEr

As well as the output_log
http://www.filedropper.com/outputlog_4

Hopefully I described the situation well enough for you. If you need anymore logs or information let me know. I do have a whole bunch of mods installed, I'm pretty sure when i made these logs I had all of these mods installed.
 

mods1.png

mods2.png

Link to comment
Share on other sites

The last time I did my own MM-patches.... well, it's been a while, and I've become obviously rusty.

 

Why the heck does this not work?

@PART[*]:HAS[@RESOURCE[Ore]]:HAS[#category[FuelTank]]:HAS[!MODULE[InterstellarFuelSwitch]] {
	%Ores = #$RESOURCE[Ore]/MaxAmount$
	%Parts = #$RESOURCE[Ore]/MaxAmount$
	@Parts *= 2

	MODULE
	{
		name = InterstellarFuelSwitch
		resourceNames = Ore;Metal;RocketParts
		resourceAmounts = #$../Ores$;#$../Ores$;#$../Parts$
		tankMass = #$../mass$
		basePartMass = 0.0
		displayCurrentTankCost = true
		hasGUI = true
		availableInFlight = true
		availableInEditor = true
		showInfo = true
	}
	!RESOURCE[Ore] {}
}

It should edit all ore-containing fuel-tanks without an IsFS to be able to also hold metal (same amount) and rocket parts (double the amount)

But it does nothign at all o.O

Link to comment
Share on other sites

21 minutes ago, cy-one said:

 


@PART:HAS[@RESOURCE[Ore],#category[FuelTank],!MODULE[InterstellarFuelSwitch]]
{
	MODULE
	{
		name = InterstellarFuelSwitch
		resourceNames = Ore;Metal;RocketParts
		resourceAmounts = #$../RESOURCE[Ore]/MaxAmount$;$../RESOURCE[Ore]/MaxAmount$;$../RESOURCE[Ore]/MaxAmount$
		@resourceAmounts[2,;] *= 2
		tankMass = #$../mass$
		basePartMass = 0.0
		displayCurrentTankCost = true
		hasGUI = true
		availableInFlight = true
		availableInEditor = true
		showInfo = true
	}
	!RESOURCE[Ore] {}
}

 

I cleaned it up a bit, this should work

I'm going with the assumption that you don't need "Ores" and "Parts" inside the Part node, if you do then you should readd those.

 

the only error you made as far as I can tell was to use multiple # in this line:

resourceAmounts = #$../Ores$;#$../Ores$;#$../Parts$

you just need to use # once, just after the = sign

 

Edited by Sigma88
Link to comment
Share on other sites

Testing it right now.

How exactly does the 

		@resourceAmounts[2,;] *= 2

part work? As far as I understand it atm, I would've just used @rA[2], not @rA[2,;]

Edit: Nope, doesn't work either :(

Edited by cy-one
Link to comment
Share on other sites

19 minutes ago, cy-one said:

Testing it right now.

How exactly does the 


		@resourceAmounts[2,;] *= 2

part work? As far as I understand it atm, I would've just used @rA[2], not @rA[2,;]

Edit: Nope, doesn't work either :(

@resourceAmounts[2,;] *= 2

 

means: <<in the first key "resourceAmouts", target the third element of the semi-colon separated list, and multiply it by 2>>

 

[2] would require a comma separated list ( example = a,b,c)

when you have a list with a different separator you need to use     [2,separator]

but maybe ; is a special character and messes up the code

 

try using your original patch, but remove the extra # from the resourceAmounts

Edited by Sigma88
Link to comment
Share on other sites

On 5/13/2016 at 6:38 PM, Svm420 said:

 

@sarbian

Did you ever get a chance to look in to this? Thanks!

I just did. 2.6.25 is out.

Technically you should check that the node_stack_top is here before trying to duplicate it :)

@PART[*]:HAS[#node_stack_top[*],~node_stack_top2[],@MODULE[ModuleEngines*]:HAS[!PROPELLANT[IntakeA*]]]:FINAL
{
	%node_stack_top2 = #$node_stack_top$
}

 

 

Link to comment
Share on other sites

On 22.4.2016 at 10:57 PM, blowfish said:

Okay, I'll walk you through it.  In spoiler tags for those who don't wish to see a long tutorial

  Hide 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.

 

this one doesn't work anymore?

Link to comment
Share on other sites

9 minutes ago, Tahib said:

I tried to change reaction wheels torque with this, but it has no effect

It has no effect as in what? As in you looked at the reaction wheel values in the editor part catalog and they aren't different from their original values? Or as in you looked at ModuleManager.ConfigCache and saw that the changed didn't apply?

If you want us to help you debug this, please do the following:

  • Post the exact patch you have and the path to the .cfg file that contains it (e.g. GameData/Stuff/MyPatch.cfg)
  • Delete GameData/ModuleManager.ConfigCache
  • Open KSP and let it load to the main menu
  • Post KSP.log (in the KSP root folder) and GameData/ModuleManager.ConfigCache

(these are really the steps for debugging any module manager patch)

The original person I wrote the tutorial for had no complaints, so it's probably some configuration issue on your end.

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...