Jump to content

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


sarbian

Recommended Posts

Just now, R-T-B said:

Intel's Thread Director tech and the windows scheduler should do that automatically.  

Should, but it's doing it? And how? KSP predates all this stuff, so any protocol to communicate the system the best way to be handled just isn't there, and so ITD will need to:

  1. Guess
  2. Use a lookup table to decide

So it appears Windows users need to read some Intel documentation to be sure.

I don't have any machine with this e/p cores stunt* so I just can't help on this one.

 

 

*well, I have… my Android mobile, but I doubt it will be of help.

Link to comment
Share on other sites

5 hours ago, Lisias said:

Should, but it's doing it? And how? KSP predates all this stuff

Shouldn't matter, it's literally designed to detect gaming workloads that were developed before this architecture was made.

Of course, there is theory, and then there is practice...

How well it works, I can't say.  I've heard mixed reports... heh.  If it's basing it on a strong singlecore load though, KSP might actually trigger it.

Edited by R-T-B
Link to comment
Share on other sites

Greetings to the brain trust here.  I have failed after several hours of labor to crack how a particular type of patch gets done.  I'm hoping someone can find a moment to offer some help other than check the help threads, etc.  (Believe me, part of why I'm hours into this is going thru the various wiki/thread help offerings.  I'm just unable to understand how to apply the information to my case)

The code is in an existing mod, and it botches up the ISP on a number of engines.  I want to patch it back to working.  The (abbreviated) MM Code I'm trying to patch:

Spoiler

    PART
    {
...snipped out...
        MODULE
        {
            name = ModuleEnginesFX
...snipped out...
            atmosphereCurve
            {
                key = 0 240
                key = 1 120
                key = 4 0.001
            }
            UPGRADES
            {
                UPGRADE
                {
                    name__ = ca-upgrade-isp1
                    description__ = ISP Boosted to 245/110
                    atmosphereCurve
                    {
                        key = 0 245
                        key = 1 110
                        key = 3 0.001
                    }
                }
                UPGRADE
                {
                    name__ = ca-upgrade-isp2
                    description__ = ISP Boosted to 250/1105
                    atmosphereCurve
                    {
                        key = 0 250
                        key = 1 105
                        key = 3 0.001
                    }

The issue is the key = 4 in the atmosphere curve for the engine module and the entries for  key = 3 in the upgrades.  From what I can tell they're messing with the ISP so badly that the engine consumes thousands of units of fuel in a split second.

What I'm trying to do is remove the key = 4 in atmosphere curve of the engine, and the two key= 3 entries in their respective upgrade atmosphereCurve blocks.

I'm guessing the atmosphereCurve used to be something other than 0 = vacuum, 1 = Kerbin sea level. 

I was able to cobble a patch that removes the engines atmosphereCurve and re-adds it, but that's rather inelegant.  And I'm just unable to get 'inside' the atmosphereCurve segments in the upgrades.  I wish to learn to patch it the right way.

TIA!

Link to comment
Share on other sites

  • 2 weeks later...
  1. Can someone PLEASE collate the information in this thread and update the wiki? It's so out of date it's not even funny.
  2. Is there any syntax that can match "has this node this many times"? I'm trying to write a patch that deletes nodes that have been double-applied and being able to say @Part:HAS[Node:count>2] { -Node,1 } instead of having to list every part with a duplicate node would be really helpful.
Link to comment
Share on other sites

9 hours ago, Tahvohck said:
  1. Can someone PLEASE collate the information in this thread and update the wiki? It's so out of date it's not even funny.
  2. Is there any syntax that can match "has this node this many times"? I'm trying to write a patch that deletes nodes that have been double-applied and being able to say @Part:HAS[Node:count>2] { -Node,1 } instead of having to list every part with a duplicate node would be really helpful.

Sometimes it helps to break things down into multiple passes and try working around the problem. I haven't tested this, but I think something like this might work:

Spoiler
@PART:HAS[@NODE]
{
	@NODE,*
	{
		%temporaryWorkingIndex = 2 // add a temporary value to all matched NODEs
	}
}

@PART:HAS[@NODE]
{
	@NODE,0
	{
		%temporaryWorkingIndex = 1 // reset only the first NODEs index
	}
}

@PART:HAS[@NODE[#temporaryWorkingIndex[>1]]]
{
	!NODE:HAS[#temporaryWorkingIndex[>1]],* {} // remove all higher indexed NODEs
}

@PART:HAS[@NODE]
{
	@NODE
	{
		!temporaryWorkingIndex = delete // clean up temporary values
	}
}

 

Obviously, @NODE will need to be replaced with whatever you're trying to affect.

Link to comment
Share on other sites

I think that will work perfectly, thanks.

EDIT: Okay, that was a pain, I'm apparently really rusty with module manager patches; had to debug with the dump command... Here's a patch for Modular Fuel Tanks that gets rid of an issue they have where one of their files has duplicate entries for... everything, as far as I can tell. This is most obvious when you're using CryoTanks, since it would give it two switcher dialogues.

@PART[*]:HAS[@MODULE[ModuleFuelTanks]]:AFTER[modularFuelTanks] {
    @MODULE[ModuleFuelTanks],* {
		%FlagForDeletion = yes
	}
}

@PART[*]:HAS[@MODULE[ModuleFuelTanks]]:AFTER[modularFuelTanks] {
    @MODULE[ModuleFuelTanks],0 {
		%FlagForDeletion = no
	}
}

@PART[*]:HAS[@MODULE[ModuleFuelTanks]]:AFTER[modularFuelTanks] {
    -MODULE[ModuleFuelTanks]:HAS[#FlagForDeletion[yes]],* {}
}

@PART[*]:HAS[@MODULE[ModuleFuelTanks]]:AFTER[modularFuelTanks] {
    @MODULE[ModuleFuelTanks] {
		-FlagForDeletion = delete
	}
}

 

Edited by Tahvohck
Patch worked yay
Link to comment
Share on other sites

  • 3 weeks later...
  • 4 weeks later...

Minor problem here, but I don't have the mental energy to search 304 pages for the answer.

How do you edit all instances of a node? I'm trying to alter multiple copies of RCS modules (Bluedog Design Bureau often has more than one RCS per part) but the handbook just doesn't seem to explain it, or maybe I'm just too oblivious to comprehend.

Link to comment
Share on other sites

17 hours ago, jediKatana said:

Minor problem here, but I don't have the mental energy to search 304 pages for the answer.

How do you edit all instances of a node? I'm trying to alter multiple copies of RCS modules (Bluedog Design Bureau often has more than one RCS per part) but the handbook just doesn't seem to explain it, or maybe I'm just too oblivious to comprehend.

I think this is what you need:

@PART[*]:HAS[@MODULE[ModuleRCS*]:HAS[@PROPELLANT[MonoPropellant]]]:FOR[YourModName] {
    @MODULE[ModuleRCS*],* {
        //DoSomething
    }
}

The * after the comma targets all modules. You could also target by module order, like @MODULE[ModuleRCS*],0 or @MODULE[ModuleRCS*],1

Edited by mateusviccari
Link to comment
Share on other sites

Sorry is this is a stupid question but is there a way that I can re-load edited/changed modulemanager configs in-game without having to exit and restart the entire game. To be clear lets say i have a patch im testing for tweakscale and i try a first option  using xx module type, and that didnt work, so i re-write that patch using a xx module type and want to test if that takes care of the problem i need, but instead of having to save my game, exit, and close out KSP and then open and reload everything...... any way i can force my ksp to  reload the config while i stay in the editor..... ya know... to save like 20 damn minutes lol. 

Let me also state that I have tried the CTRL+ALT F10 modmgr menu but it never seems to really workj right. Sooo... any ideas??

 

And for anyone that may post a reply or fix, will that work for any type of config using modulemanager syntax? As in, for any mod i can write configs/patches for using module manager syntax?

 

What about Kopernicus? Or is that a whole other ballgame? Tbh I'd love to be able to refresh and reload stars and planets i work on without having to reboot game everytime

Edited by Astra Infinitum
Link to comment
Share on other sites

@Astra Infinitum alt-F11 reload database is the way to do it, IIRC. Except that there was an issue where it messed up R&D configs. And even some part's might not re-initialize properly. It was enough of an issue that personally I just restarted my game. It's been quite awhile though so maybe the issues were resolved. (they were stock issues, not MM issues)

Link to comment
Share on other sites

@Astra Infinitum You don't necessarily have to wait for the whole game to load. You can open ModuleManager.configCache from GameData as soon as the patches finish applying, then alt+f4 and look for one of the parts you are modifying. Even with heavy modded installs it shouldn't take than long to save the cache. Still not ideal but way less time consuming than waiting for the whole game to load.

Link to comment
Share on other sites

  • 3 weeks later...
6 minutes ago, Monniasza said:

How do I get properties from a FSfuelSwitch module in a part? The following code does not work:

@MODULE[FSfuelSwitch],*{
	%testqty = #$resourceNames[0]$
	@testqty = #$testqty[0,;]$
}
@title = #$title$ $/MODULE[FSFuelSwitch]/resourceNames$

Well, module manager complained about:

[ModuleManager] ERROR: Error - Cannot parse variable search when editing key title = #$title$ $/MODULE[FSFuelSwitch]/resourceNames$

So we know WHERE the problem is. Looking carefully on the pinpointed line, and knowing that MM didn't managed to parse the variable, besides the value being present on the Module, the problem should be so on the definition of the module - where I found you mistyped FSfuelSwitch to FSFuelSwitch. :)

Fixing the typo will solve the problem (from the configcache):

        PART
        {
                name = FSdropTank
                <yada yada yada>
                title = FS3FD Fuel Drop Tank LiquidFuel;Oxidizer;MonoPropellant;ElectricCharge
                <yada yada yada>
                }
                MODULE
                {
                        name = FSfuelSwitch
                        resourceNames = LiquidFuel;Oxidizer;MonoPropellant;ElectricCharge
                        resourceAmounts = 50;50;60;200
                        basePartMass = 0.25
                        tankMass = 0.5;0;0.1
                        testqty = LiquidFuel
                }

Cheers!

Link to comment
Share on other sites

  • 4 months later...

Hello I am trying to edit this mod Science - Full Transmit

@PART[*]:HAS[@MODULE:HAS[#experimentID[*]&#xmitDataScalar[<1]]]
{
  @MODULE:HAS[#experimentID[*]&#xmitDataScalar[<1]]
  {
    // For each Module with an experimentID and a transmit penalty, adjust xmitDataScalar to eliminate the penalty.
    @xmitDataScalar = 1.0
  }
}

It looks like it just takes any xmitDataScalar that's less than 1 and makes it 1, what I'd like to do is only apply this to experiments with an xmitDataScalar that's less than 1 AND greater than 0, that way it doesn't affect experiments that can't be transmitted at all like surface samples. Is there any way to do a double inequality like that? I couldn't find anything about it on the module manager wiki.

Link to comment
Share on other sites

On 12/29/2023 at 7:20 AM, Mancher said:

Hello I am trying to edit this mod Science - Full Transmit

It looks like it just takes any xmitDataScalar that's less than 1 and makes it 1, what I'd like to do is only apply this to experiments with an xmitDataScalar that's less than 1 AND greater than 0, that way it doesn't affect experiments that can't be transmitted at all like surface samples. Is there any way to do a double inequality like that? I couldn't find anything about it on the module manager wiki.

You can just chain the conditions to get a range.

@PART[*]:HAS[@MODULE:HAS[#experimentID[*]&#xmitDataScalar[>0]&#xmitDataScalar[<1]]]
{
  @MODULE:HAS[#experimentID[*]&#xmitDataScalar[>0]&#xmitDataScalar[<1]]
  {
    // For each Module with an experimentID and a transmit penalty, adjust xmitDataScalar to eliminate the penalty.
    @xmitDataScalar = 1.0
  }
}

 

Edit: NB Surface samples have a default xmitDataScalar value of 0.25 and so would still be affected by this patch. If you have another mod/patch that changes their xds to 0 then you may need to check the patch ordering to make sure that it is not overridden. 

Edited by Aelfhe1m
added note about surface samples
Link to comment
Share on other sites

  • 1 month later...

Hi guys!

Im trying to make a MM patch for a specific mod, engines are under performing using RSS mod, but the patch is messing with other mods and parts, so please can someone tell me how to fix this, this is what i got so far:

 

Spoiler

// Simple patch to scale thrust .


@PART[*]:HAS[@MODULE[ModuleEngines*]]:NEEDS[BlueSteel]:FINAL
{
    @MODULE[ModuleEngines*]
    {
        @maxThrust *= 1.7

        @atmosphereCurve
        {
            @key[1, ] *= 1.7
            @key,1[1, ] *= 1.7
            @key,2[1, ] *= 1.7
        }
    }
}

Thanks :^)

Link to comment
Share on other sites

@Constel4cion

The way your patch is written, the NEEDS:[BlueSteel] means that if BlueSteel is installed, it will apply the patch to ALL parts, not just the ones from BlueSteel. What you should do is check if the parts in BlueSteel have part names (not in game titles) that start with the same word (Like how all Bluedog Design Bureau part names start with bluedog) and then use a wild card. Example:

Spoiler

@PART[BlueSteel*]:HAS[@MODULE[ModuleEngines*]]:NEEDS[BlueSteel]:FINAL
---Rest of Patch

This would theoretically apply the patch to all BlueSteel parts, if the part names started with BlueSteel. 

Link to comment
Share on other sites

4 hours ago, Kerb24 said:

@Constel4cion

The way your patch is written, the NEEDS:[BlueSteel] means that if BlueSteel is installed, it will apply the patch to ALL parts, not just the ones from BlueSteel. What you should do is check if the parts in BlueSteel have part names (not in game titles) that start with the same word (Like how all Bluedog Design Bureau part names start with bluedog) and then use a wild card. Example:

  Hide contents

@PART[BlueSteel*]:HAS[@MODULE[ModuleEngines*]]:NEEDS[BlueSteel]:FINAL
---Rest of Patch

This would theoretically apply the patch to all BlueSteel parts, if the part names started with BlueSteel. 

Took a quick look at the Commonwealth Aeronautics "Blue Steel" mod on GitHub and the engines all seem to be named "blue_steel_engine_<whatever>" so the edit to the patch should be:

Spoiler

@PART[blue_steel_engine_*]:HAS[@MODULE[ModuleEngines*]]:NEEDS[BlueSteel]:FINAL
---Rest of Patch

 

Link to comment
Share on other sites

21 hours ago, Kerb24 said:

@Constel4cion

The way your patch is written, the NEEDS:[BlueSteel] means that if BlueSteel is installed, it will apply the patch to ALL parts, not just the ones from BlueSteel. What you should do is check if the parts in BlueSteel have part names (not in game titles) that start with the same word (Like how all Bluedog Design Bureau part names start with bluedog) and then use a wild card. Example:

  Hide contents

@PART[BlueSteel*]:HAS[@MODULE[ModuleEngines*]]:NEEDS[BlueSteel]:FINAL
---Rest of Patch

This would theoretically apply the patch to all BlueSteel parts, if the part names started with BlueSteel. 

 

17 hours ago, Aelfhe1m said:

Took a quick look at the Commonwealth Aeronautics "Blue Steel" mod on GitHub and the engines all seem to be named "blue_steel_engine_<whatever>" so the edit to the patch should be:

  Hide contents

@PART[blue_steel_engine_*]:HAS[@MODULE[ModuleEngines*]]:NEEDS[BlueSteel]:FINAL
---Rest of Patch

 

Oh boy works just fine!

Thanks a lot guys :^)

Link to comment
Share on other sites

  • 2 months later...

Hello, I am trying to access value 2 of a list, but there are multiple versions of the list itself, eg, (list, 1, 2), where we are looking for the second value in the first list. Can I chain together indices like that? For reference, this is the full patch:

Spoiler

@PART:HAS[@MODULE[ModuleB9PartSwitch]:HAS[#baseVolume,#baseVolume[>0]]]:FINAL
{
    
    
    TEMPSTORAGE
    {
        v = #$../MODULE[ModuleB9PartSwitch,0]/baseVolume$ , #$../MODULE[ModuleB9PartSwitch,0]/baseVolume$
        v = #$../MODULE[ModuleB9PartSwitch,1]/baseVolume$ , #$../MODULE[ModuleB9PartSwitch,1]/baseVolume$
        v = #$../MODULE[ModuleB9PartSwitch,2]/baseVolume$ , #$../MODULE[ModuleB9PartSwitch,2]/baseVolume$
    }

    @TEMPSTORAGE:HAS[#v[0],*[>0]]
    {
        @v:HAS[#v,0][>0]]
        {
            #v,0 -= 1
        }
        -#v:HAS[v,0=0]
        MMPatchLoop {}
    }
        capacityFactor = #$../TEMPSTORAGE/v,1$
}

Where I am trying to find the highest baseVolume value from all ModuleB9PartSwitch modules. 

Link to comment
Share on other sites

So I've found a patch to try and change a fuel cell from LF/OX to CRP's Hydrogen and Oxygen.

Spoiler

@PART[benjee10_shuttle_midFuselage]:NEEDS[CommunityResourcePack]:AFTER[Benjee10_shuttleOrbiter]
{
    @MODULE[ModuleResourceConverter]
    {
        //Using FlowMode STAGE_PRIORITY_FLOW allows for a future EDO or using Universal Storage parts
        @INPUT_RESOURCE[LiquidFuel]
        {
            @ResourceName = Hydrogen
            @Ratio = 0.010
            @FlowMode = STAGE_PRIORITY_FLOW
        }
        @INPUT_RESOURCE[Oxidizer]
        {
            @ResourceName = Oxygen
            @Ratio = 0.005
            @FlowMode = STAGE_PRIORITY_FLOW
        }
        @OUTPUT_RESOURCE[ElectricCharge]
        {
            @Ratio = 7
            @DumpExcess = false
        }
        OUTPUT_RESOURCE
        {
            ResourceName = Water
            Ratio = 0.000006599
            DumpExcess = true
        }
    }
}

But for whatever reason, the only thing that changes is that the water output gets added, while neither the resources or ratios of the converter get changed.

Link to comment
Share on other sites

4 hours ago, Delta 86 said:

So I've found a patch to try and change a fuel cell from LF/OX to CRP's Hydrogen and Oxygen.

[SNIP]

But for whatever reason, the only thing that changes is that the water output gets added, while neither the resources or ratios of the converter get changed.

Try this instead:

Spoiler
@PART[benjee10_shuttle_midFuselage]:NEEDS[CommunityResourcePack]:AFTER[Benjee10_shuttleOrbiter]
{
    @MODULE[ModuleResourceConverter]
    {
        //Using FlowMode STAGE_PRIORITY_FLOW allows for a future EDO or using Universal Storage parts
        @INPUT_RESOURCE:HAS[#ResourceName[LiquidFuel]]
        {
            @ResourceName = Hydrogen
            @Ratio = 0.010
            @FlowMode = STAGE_PRIORITY_FLOW
        }
        @INPUT_RESOURCE:HAS[#ResourceName[Oxidizer]]
        {
            @ResourceName = Oxygen
            @Ratio = 0.005
            @FlowMode = STAGE_PRIORITY_FLOW
        }
        @OUTPUT_RESOURCE:HAS[#ResourceName[ElectricCharge]]
        {
            @Ratio = 7
            @DumpExcess = false
        }
        OUTPUT_RESOURCE
        {
            ResourceName = Water
            Ratio = 0.000006599
            DumpExcess = true
        }
    }
}

 

The @NODE[value] selector is shorthand for @NODE:HAS[#name[value]]. If the identity field is called anything except "name" then the longer version is needed.

NOTE: I only fixed the syntax in the patch and have not tested it.

Link to comment
Share on other sites

43 minutes ago, Aelfhe1m said:

The @NODE[value] selector is shorthand for @NODE:HAS[#name[value]]. If the identity field is called anything except "name" then the longer version is needed.

NOTE: I only fixed the syntax in the patch and have not tested it.

It worked like a charm, many thanks! At some point I grew desperate and just edited the parts themselves. Now I can adapt this to patch other parts.

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