Jump to content

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


sarbian

Recommended Posts

6 hours ago, RobertaME said:

Trying to create a MM patch to change the Tech Tree, but5 I can't wrap my head around how to do something. I want to change one of the two Parent objects for a Node without changing the other. Here's the source from Techtree.cfg in the Squad folder:

Spoiler


	RDNode
	{
		id = stability
		title = #autoLOC_501028 //#autoLOC_501028 = Stability
		description = #autoLOC_501029 //#autoLOC_501029 = Reaching for the stars starts with keeping our spacecraft pointed generally in the right direction.
		cost = 18
		hideEmpty = False
		nodeName = node2_stability
		anyToUnlock = True
		icon = RDicon_stability
		pos = -2170,1201,0
		scale = 0.6
		Parent
		{
			parentID = engineering101
			lineFrom = RIGHT
			lineTo = LEFT
		}
		Parent
		{
			parentID = basicRocketry
			lineFrom = RIGHT
			lineTo = LEFT
		}
	}

So I want to change ONLY the "parentID = basicRocketry" to "parentID = subsonicFlight" without changing "parentID = engineering101". is there a way to change ONLY a specific instance? If so, I haven't figured it out.

Thanks in advance!

Just appropriate application of :HAS blocks

@TechTree:FOR[SomeMod]
{
    @RDNode:HAS[#id[stability]]
    {
        @Parent:HAS[#parentID[basicRocketry]]
        {
            @parentID = subsonicFlight
        }
    }
}

(replacing :FOR[SomeMod] with an appropriate pass specifier of course)

Edited by blowfish
Link to comment
Share on other sites

5 hours ago, blowfish said:

Just appropriate application of :HAS blocks


@TechTree:FOR[SomeMod]
{
    @RDNode:HAS[#id[stability]]
    {
        @Parent:HAS[#parentID[basicRocketry]]
        {
            @parentID = subsonicFlight
        }
    }
}

(replacing :FOR[SomeMod] with an appropriate pass specifier of course)

See, I didn't know you could nest HAS blocks like that! Thanks!

Since the FOR would be my own personal TechTree mods, it would be whatever I chose it to be, right? I'm fairly new to Modding KSP, (though not programming... my knowledge base may be outdated by newer languages, but the logic doesn't change much) so I'm not as familiar with the syntax yet. How exactly do mods set their name... I mean the name that MM will recognize for ordering purposes?

Thanks again for cluing me in on nested functions. I'll try playing around with them some to see what else I can do! ::grin::

Link to comment
Share on other sites

On 8/7/2019 at 11:06 PM, blowfish said:

The RO thing was a backport to make it work with KSP 1.3.x.  I don't think it's necessary anymore.

things seem to be applied ok in KSP 1.4.5  (i.e. atm seem to be present with expected parameters) with MM 4.0.2 with TRAPIST1 for Principia adjustments to SLIPPIST1,

but with MM 4.0.3 I am seeing the following type of  'maths' error for the x2 multiplication that Principia's configs do to the atm curves defined for kopernicus in SLIPPIST1 configs:

the full logs for the loads with MM 4.0.2 and MM 4.0.3 are located in the folders at this google drive link:

https://drive.google.com/drive/folders/1mWnOI6lPHlbHVEvrHMrasqK9efZEldKw?usp=sharing

[LOG 23:10:57.106] Applying update SLIPPIST-1/Scatterer/Sunflares/Sun/@Scatterer_sunflare:HAS[@SlippistSettings:HAS[#SystemPlacement[Home]]]:AFTER[aSLIPPIST-1] to scatterer/config/Sunflares/Sun.cfg/Scatterer_sunflare
[LOG 23:10:57.107] Applying update Trappist-1 for Principia/trappist_gravity_model_slippist1/@Kopernicus:AFTER[aSLIPPIST-1] to Kopernicus/Config/System.cfg/Kopernicus[Kerbol System]
[ERR 23:10:57.110] Error - Failed to do a maths replacement: @temperatureCurve : original value="0	1446	0.00000E+00	-2.92000E-02" operator=Multiply mod value="2"
[ERR 23:10:57.110] Error - Failed to do a maths replacement: @temperatureCurve : original value="5000	1300	-2.92000E-02	-2.66667E-02" operator=Multiply mod value="2"
[ERR 23:10:57.110] Error - Failed to do a maths replacement: @temperatureCurve : original value="20000	900	-2.66667E-02	-5.00000E-03" operator=Multiply mod value="2"
[ERR 23:10:57.110] Error - Failed to do a maths replacement: @temperatureCurve : original value="30000	850	-5.00000E-03	-1.50000E-02" operator=Multiply mod value="2"
[ERR 23:10:57.110] Error - Failed to do a maths replacement: @temperatureCurve : original value="40000	700	-1.50000E-02	-1.25000E-03" operator=Multiply mod value="2"
[ERR 23:10:57.110] Error - Failed to do a maths replacement: @temperatureCurve : original value="120000	600	-1.25000E-03	-6.14754E-05" operator=Multiply mod value="2"
[ERR 23:10:57.110] Error - Failed to do a maths replacement: @temperatureCurve : original value="5000000	300	-6.14754E-05	0.00000E+00" operator=Multiply mod value="2"
[ERR 23:10:57.110] Error - Failed to do a maths replacement: @temperatureSunMultCurve : original value="0	1	0.00000E+00	-6.00000E-05" operator=Multiply mod value="2"
[ERR 23:10:57.110] Error - Failed to do a maths replacement: @temperatureSunMultCurve : original value="20000	-0.2	-6.00000E-05	1.33333E-05" operator=Multiply mod value="2"
[ERR 23:10:57.110] Error - Failed to do a maths replacement: @temperatureSunMultCurve : original value="50000	0.2	1.33333E-05	0.00000E+00" operator=Multiply mod value="2"
[ERR 23:10:57.110] Error - Failed to do a maths replacement: @temperatureSunMultCurve : original value="60000	0.2	0.00000E+00	0.00000E+00" operator=Multiply mod value="2"
[ERR 23:10:57.110] Error - Failed to do a maths replacement: @temperatureSunMultCurve : original value="240000	0.2	0.00000E+00	0.00000E+00" operator=Multiply mod value="2"
[ERR 23:10:57.110] Error - Failed to do a maths replacement: @pressureCurve : original value="0	1.51988E+03	0.00000E+00	-2.15362E-02" operator=Multiply mod value="2"
[ERR 23:10:57.110] Error - Failed to do a maths replacement: @pressureCurve : original value="23000	9.92660E+02	-2.29651E-02	-2.29651E-02" operator=Multiply mod value="2"
[ERR 23:10:57.110] Error - Failed to do a maths replacement: @pressureCurve : original value="45000	5.59191E+02	-1.63286E-02	-1.63286E-02" operator=Multiply mod value="2"
[ERR 23:10:57.111] Error - Failed to do a maths replacement: @pressureCurve : original value="68000	2.82573E+02	-8.53220E-03	-8.53220E-03" operator=Multiply mod value="2"
[ERR 23:10:57.111] Error - Failed to do a maths replacement: @pressureCurve : original value="90000	1.43778E+02	-4.49386E-03	-4.49386E-03" operator=Multiply mod value="2"
[ERR 23:10:57.111] Error - Failed to do a maths replacement: @pressureCurve : original value="113000	6.91151E+01	-2.24416E-03	-2.24416E-03" operator=Multiply mod value="2"
[ERR 23:10:57.111] Error - Failed to do a maths replacement: @pressureCurve : original value="135000	3.36220E+01	-1.10095E-03	-1.10095E-03" operator=Multiply mod value="2"
[ERR 23:10:57.111] Error - Failed to do a maths replacement: @pressureCurve : original value="157000	1.63922E+01	-5.33946E-04	-5.33946E-04" operator=Multiply mod value="2"
[ERR 23:10:57.111] Error - Failed to do a maths replacement: @pressureCurve : original value="180000	7.76632E+00	-2.51595E-04	-2.51595E-04" operator=Multiply mod value="2"
[ERR 23:10:57.111] Error - Failed to do a maths replacement: @pressureCurve : original value="202000	3.81545E+00	-1.22964E-04	-1.22964E-04" operator=Multiply mod value="2"
...

I am grateful for any insights on what might be causing this with MM 4.0.3.  Thanks! & Kind regards.

 

Link to comment
Share on other sites

Hmm. I guess those math replacements only work in comma separated arrays?

A few days ago I created a patch where I had to do a regex replacement in a "key" array of all empty spaces to commas, then do the math, then do another regex replacement from commas to spaces...

^This with MM 4.0.3

Edited by Gordon Dry
Link to comment
Share on other sites

On 8/14/2019 at 7:26 AM, AloE said:

things seem to be applied ok in KSP 1.4.5  (i.e. atm seem to be present with expected parameters) with MM 4.0.2 with TRAPIST1 for Principia adjustments to SLIPPIST1,

but with MM 4.0.3 I am seeing the following type of  'maths' error for the x2 multiplication that Principia's configs do to the atm curves defined for kopernicus in SLIPPIST1 configs:

the full logs for the loads with MM 4.0.2 and MM 4.0.3 are located in the folders at this google drive link:

https://drive.google.com/drive/folders/1mWnOI6lPHlbHVEvrHMrasqK9efZEldKw?usp=sharing

I am grateful for any insights on what might be causing this with MM 4.0.3.  Thanks! & Kind regards.

 

I think this happens because the values are tab separated but the patch expects them to be space separated.

Link to comment
Share on other sites

38 minutes ago, blowfish said:

values are tab separated but the patch expects them to be space separated.

ok good was hoping it may be related to delimiters...I'll try converting things to spaces & see if the errors go away.  Is there a post/document you recommend that describes delimiter conventions?    The main reference I am using to get more familiar with MM/KSP configs is the Primer & its associated links.  I welcome your recommendation of link(s) to other information dense documents relevant to MM 4.0.3 Thanks!

Link to comment
Share on other sites

4 minutes ago, AloE said:

ok good was hoping it may be related to delimiters...I'll try converting things to spaces & see if the errors go away.  Is there a post/document you recommend that describes delimiter conventions?    The main reference I am using to get more familiar with MM/KSP configs is the Primer & its associated links.  I welcome your recommendation of link(s) to other information dense documents relevant to MM 4.0.3 Thanks!

The documentation isn't complete sadly.  But the delimiter is specified by the patch

@key,*[0, ] *= 2

The [0, ] part says to modify the entry at index 0 separated by the character after the comma which in this case is a space

Link to comment
Share on other sites

1 hour ago, blowfish said:

@key,*[0, ] *= 2

The [0, ] part says to modify the entry at index 0 separated by the character after the comma which in this case is a space

@eggrobin @GregroxMun this looks like it explains the strange temp, etc readings I have been seeing...the Principia TRAPPIST1 patch appears to not be fully applied to SLIPPIST1...I'll clean the tabs out of the keys in my copy of the SLIPPIST1 0.8.0 configs at least for 1e, switch to MM 4.0.3 & see if my flight recorder plots look better...thanks all!

Link to comment
Share on other sites

EDIT: Upon closer examination of the output log I found the problem: an old docking mod DLL from 2014 in the plugins folder that escaped deletion. Removing it fixes the crash. At least I'm one post closer to not needing mod approval for my next issue.

I'm crashing while loading on game start. I've uninstalled all other mods, and cleaned out my gamedata folder so all that is in there is Squad and Modulemanager.4.0.3.dll

Running KSP x64 on Windows 7.

output_log.txt:

[SNIP]

error.log:

[SNIP]

log files were too large for pastebin; I hope spoiler tagging them is an adequate workaround. This is my first problem with a mod i've been unable to resolve myself or find an existing solution for, so I've never posted here before.

Any help or suggestion is welcome.

Edited by Gargamel
Huge walls of text redacted.
Link to comment
Share on other sites

9 hours ago, AloE said:

@eggrobin @GregroxMun this looks like it explains the strange temp, etc readings I have been seeing...the Principia TRAPPIST1 patch appears to not be fully applied to SLIPPIST1...I'll clean the tabs out of the keys in my copy of the SLIPPIST1 0.8.0 configs at least for 1e, switch to MM 4.0.3 & see if my flight recorder plots look better...thanks all!

For what it's worth you can use any number of spaces as the separator

Link to comment
Share on other sites

18 hours ago, blowfish said:

you can use any number of spaces as the separator

that is very helpful...made the delimiter changes last night & indeed no MM errors anymore with 4.0.3.  Thanks!

Link to comment
Share on other sites

2 hours ago, captinjoehenry said:

Is there anyway I can mark a mod or a part to not be touched by any MM patch?  As I have one mod in particular I really like the way it is but it's being MM patched to hell and for the life of me I can't find what patch is messing it up

I put all my final touches into my own "mod folder" and put zzz at the beginning of the name so it is read last.

Not sure if doing that would help though.

Link to comment
Share on other sites

2 hours ago, captinjoehenry said:

Is there anyway I can mark a mod or a part to not be touched by any MM patch?  As I have one mod in particular I really like the way it is but it's being MM patched to hell and for the life of me I can't find what patch is messing it up

You can check the MM log to figure out, which patches are applied to specific parts. MM writes a separate log into "Kerbal Space Program/Logs/ModuleManager/MMPatch.log" (usually it's also dumped into the regular log files of KSP but this one contains just the MM patch information).

Search for the name of the part and you should find something like this:

Applying update CommunityResourcePack/SurfaceScanner/@PART[SurfaceScanner] to Squad/Parts/Resources/SurfaceScanner/SurfaceScanner.cfg/PART

This should allow you to identify every patch which is applied to a part. To prevent these patches to be applied, you have to know how these parts are identified, for example by the part name, the name of a module, etc...
Then, you can add a patch to change this identifier in the part, for example by renaming it and run this patch in :FIRST and another patch to undo these changes in :FINAL.

Link to comment
Share on other sites

33 minutes ago, KerbMav said:

I put all my final touches into my own "mod folder" and put zzz at the beginning of the name so it is read last.

Not sure if doing that would help though.

That doesn’t really do much. What decides when a patch is run is set by the timing in the patch (FIRST/FOR/BEFORE/AFTER/LAST/FINAL)

You should probably use those wisely. You can technically run them all at FINAL, but you should avoid that where possible. 

If you’re changing another mod’s changes, use AFTER[thatMod]. It’ll also NOT run if thatMod isn’t present. 

If you want to make your own changes to stock parts, you should do so in FOR[myFolder]. 

If you want to do something to parts before another mod touches it, you can use BEFORE[thatMod], or if many mods may touch it, you could use FIRST.

 

Link to comment
Share on other sites

Hi,

I'm returning to KSP since Breaking Ground, and am trying to use a small patch I've used successfully in the past, 

 

@EXPERIMENT_DEFINITION:Final
{
    @baseValue *= 0.667
}

 

The idea is to take all science experiments, and require you to run them about 3 times more than you would in stock to get full science reward from them.  However, MM appears to be setting baseValue to = 0.667, rather than multiplying by a factor of 0.667.  Has there been any change to MM that I should be aware of for how this patch should be written?

 

Thanks

 

 

EDIT: Never mind, this appears to have been caused by a conflict with a tech tree mod I was trying out.  Patch is working as expected now that is removed.

Edited by eatU4myT
Resolved
Link to comment
Share on other sites

42 minutes ago, zer0Kerbal said:

So what colors does MM recognize in patches?

<color=green> text. </color>

I know red, green, blue, orange, yellow work.

Is there a list?

can use (#0000ff) hex codes instead?

I don't think MM 'recognizes' colors. That goes through KSP/Unity.

Link to comment
Share on other sites

Hi!

So, I'm a bit rusty with ModuleManager...

I have 3 questions:

  1. Let's say I have this key in a node:
    title = #autoLOC_501028

    (I took the first one on this page :D)
    From what I understood after reading several pages in this topic, because of the way KSP process theses localization keywords, and because ModuleManager comes AFTER KSP has processed theses localization keywords, I can't do things like this:

    @PART[*]:HAS[#title[#autoLOC_501028]]

    nor this:

    PART
    {
      name = myPart
      title = #autoLOC_501028
    }

    (Can even ModuleManager not be confused by this character '#'? I doubt it.)

  2. Now, let's say I want to test if the last parameter of node_stack_whatever exist. Is this even possible?
    Again, I've read several pages of this topic and still don't have an answer. I know you can index them inside nodes (I saw several examples for curves values), but can you test them in a :HAS block? And if so, how?
    I've tried something like this but...yeah:

    @PART[*]:HAS[#node_stack_whatever[6,],#myAnnoyingSecondTest[*]]
    @PART[*]:HAS[#node_stack_whatever,6[>0],#myAnnoyingSecondTest[*]]
  3. I don't remember my third question... :blush:

:confused:  :D

Thank you for reading! ;)

Link to comment
Share on other sites

25 minutes ago, dueb said:

From what I understood after reading several pages in this topic, because of the way KSP process theses localization keywords, and because ModuleManager comes AFTER KSP has processed theses localization keywords, I can't do things like this:;)

That is correct.  I've looked into changing this, it's certainly possible but it would break a bunch of existing patches that rely on the post-localization values.

26 minutes ago, dueb said:

Now, let's say I want to test if the last parameter of node_stack_whatever exist. Is this even possible?
Again, I've read several pages of this topic and still don't have an answer. I know you can index them inside nodes (I saw several examples for curves values), but can you test them in a :HAS block? And if so, how?
I've tried something like this but...yeah:

There's no way to index within a HAS block unfortunately.

Link to comment
Share on other sites

So I've been learning how to manipulate CFGs using MM over the last month and I think I have it down pretty good, but I'd like another set of eyes to look over my understanding of how things work. (old programmer habits die hard)

Here is a sample of a MM edit I'm working on. This one should remove the ability for K&K nuclear reactors and centrifuges to store their own fuel and byproducts. (thus forcing the player to actually use the storage tanks) If someone could verify my code before I commit it I'd appreciate it!

@PART[KKAOSS_Centrifuge|KKAOSS_Nuclear_Reactor]:NEEDS[PlanetarySurfaceStructures]:FOR[RemodeledTechTree]
{
	!Resource,* {} // Remove all resources from the parts
	!MODULE:HAS[#name[ModuleKPBSNuclearStorage]] // Remove the Nuclear Storage Module from the parts
	@MODULE:HAS[#name[ModuleResourceConverter]] // Find all Resource Converter Modules
	{
		@INPUT_RESOURCE:HAS[#FlowMode[NO_FLOW]] // Find all NO_FLOW FlowModes within Input Resources within all Resource Converter Modules
		{
			@FlowMode = STAGE_PRIORITY_FLOW // Replace all NO_FLOW Flowmodes with STAGE_PRIORITY_FLOW
           			 			// This allows the resources to move to and from the storage tanks
		}
		@OUTPUT_RESOURCE:HAS[#FlowMode[NO_FLOW]] // Same as above but for Output Resources
		{
			@FlowMode = STAGE_PRIORITY_FLOW
		}
	}
}

Any pointers if I messed something up would be appreciated! Thanks!

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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