Jump to content

[1.8.x-1.10.x] Module Manager 4.1.4 (July 7th 2020) - Locked inside edition


Recommended Posts

maxVolume = #$[COLOR=#ff0000]../[/COLOR]mvar$

The variable address is from your current node, not the root node

Changed code to this:


@PART
[*]:HAS[@MODULE[KASModuleContainer],!MODULE[ModuleKISInventory]]:NEEDS[KAS,KIS]
{
mvar = #$/MODULE[KASModuleContainer]/maxSize$
svar = #$mvar$
@svar *= 10
@mvar *= 0.01
mvaro = #$mvar$
@mvaro += 0.05

MODULE
{
name = ModuleKISInventory
maxVolume = #$../mvar$
externalAccess = true
internalAccess = true
slotsX = 3
slotsY = #$../svar$
slotSize = 50
itemIconResolution = 128
selfIconResolution = 128
openSndPath = KIS/Sounds/containerOpen
closeSndPath = KIS/Sounds/containerClose
defaultMoveSndPath = KIS/Sounds/itemMove
}


MODULE
{
name = ModuleKISItem
volumeOverride = #$../mvaro$
editorItemsCategory = false
}

!mvar = null
!svar = null
!mvaro = null
}

RESULT, still missing lines where I try to return the calculated variables:


MODULE
{
name = ModuleKISInventory
externalAccess = true
internalAccess = true
slotsX = 3
slotSize = 50
itemIconResolution = 128
selfIconResolution = 128
openSndPath = KIS/Sounds/containerOpen
closeSndPath = KIS/Sounds/containerClose
defaultMoveSndPath = KIS/Sounds/itemMove
}
MODULE
{
name = ModuleKISItem
editorItemsCategory = false
}

Link to post
Share on other sites

Actually deleting the var is tricky. Leaving them has no consequences for the game, but you could get var conflict between mods. so I would declare them with %

But if you delete them you can't use them in sub nodes (they are deleted before the node is processed)

Link to post
Share on other sites
What happens if you don't delete the values at the end? MM may processes all values and then all nodes rather than doing it in order

E: nvm, the examples show it being used like that too. I'm out of ideas

You were right, deleting the variables at the end of the script was the issue.

- - - Updated - - -

We can search for items with specific values, like in this string:


@PART
[*]:HAS[@MODULE[KASModuleContainer]:HAS[#maxSize[60]],!MODULE[ModuleKISInventory]]:NEEDS[KAS,KIS]

@sarbian Is there a way to make this query broader, like searching for items with maxSize =>60 or between 60 and 160?

Link to post
Share on other sites
Actually deleting the var is tricky. Leaving them has no consequences for the game, but you could get var conflict between mods. so I would declare them with %

But if you delete them you can't use them in sub nodes (they are deleted before the node is processed)

You may want to correct the example here then. It makes it look like everything is processed in order of appearance, but if values and nodes are processed seperately that won't work

Link to post
Share on other sites

Is this correct code to detect all LFO fuel tanks and decrease their mass? I want to make a minimod for FAR and NEAR to decrease fuel density but keep tank mass fraction, as rockets are all extremely small now.

@PART[*]:HAS[#category[FuelTank]]:HAS[!RESOURCE[*],@RESOURCE[LiquidFuel],@RESOURCE[Oxidizer]]]

{

@mass *= 0.75

}

Link to post
Share on other sites

That...doesn't really make sense.

I think you mean:

@PART[*]:HAS[#category[FuelTank],@RESOURCE[LiquidFuel]]:FOR[whateverYouWantToCallYourMod]

{

@mass *= 0.75

}

Unless you want to also skip the Mk1/2/3 liquid-fuel-only tanks, in which case add a ,@RESOURCE[Oxidizer] as well to the chain.

Link to post
Share on other sites

Question, would it be possible to do the following MM script shorter:


@PART[FNInlineRefineryLarge]:NEEDS[NearFutureElectrical|SETI]:FOR[WarpPlugin]
{
@MODULE[FNModuleResourceExtraction],0
{
@powerConsumptionLand *= 0.02
@powerConsumptionOcean *= 0.02
}

@MODULE[FNModuleResourceExtraction],1
{
@powerConsumptionLand *= 0.02
@powerConsumptionOcean *= 0.02
}

@MODULE[FNModuleResourceExtraction],2
{
@powerConsumptionLand *= 0.02
@powerConsumptionOcean *= 0.02
}

@MODULE[FNModuleResourceExtraction],3
{
@powerConsumptionLand *= 0.02
@powerConsumptionOcean *= 0.02
}

@MODULE[FNModuleResourceExtraction],4
{
@powerConsumptionLand *= 0.02
@powerConsumptionOcean *= 0.02
}

@MODULE[FNModuleResourceExtraction],5
{
@powerConsumptionLand *= 0.02
@powerConsumptionOcean *= 0.02
}
}

Link to post
Share on other sites
Question, would it be possible to do the following MM script shorter:


@PART[FNInlineRefineryLarge]:NEEDS[NearFutureElectrical|SETI]:FOR[WarpPlugin]
{
@MODULE[FNModuleResourceExtraction],0
{
@powerConsumptionLand *= 0.02
@powerConsumptionOcean *= 0.02
}

@MODULE[FNModuleResourceExtraction],1
{
@powerConsumptionLand *= 0.02
@powerConsumptionOcean *= 0.02
}

@MODULE[FNModuleResourceExtraction],2
{
@powerConsumptionLand *= 0.02
@powerConsumptionOcean *= 0.02
}

@MODULE[FNModuleResourceExtraction],3
{
@powerConsumptionLand *= 0.02
@powerConsumptionOcean *= 0.02
}

@MODULE[FNModuleResourceExtraction],4
{
@powerConsumptionLand *= 0.02
@powerConsumptionOcean *= 0.02
}

@MODULE[FNModuleResourceExtraction],5
{
@powerConsumptionLand *= 0.02
@powerConsumptionOcean *= 0.02
}
}

Couldn't you just do this?


@PART[FNInlineRefineryLarge]:NEEDS[NearFutureElectrical|SETI]:FOR[WarpPlugin]
{
@MODULE[FNModuleResourceExtraction],*
{
@powerConsumptionLand *= 0.02
@powerConsumptionOcean *= 0.02
}
}

Someone correct me if I'm wrong...

Link to post
Share on other sites

And here is ModuleManager 2.5.13

- < and > compare on value check.

 

 
@PART[*]:HAS[#mass[<1]]:Final
{    
    @mass = 0.01
}

 

- # operator to copy-paste whole node from anywhere. The syntax look like the one for the variables. I hope the example make the syntax clear :

 

 
MY_NODE_LIBRARY
{
   MODULE
    {
        name = MechJebCore		
    }
}

@PART[*]:HAS[@MODULE[ModuleCommand],!MODULE[MechJebCore]]
{    
    #@MY_NODE_LIBRARY/MODULE[MechJebCore] { }

    MODULE 
    {
       name = tobepasted
    }   

    OTHER
    {
       fun = 9001
    }

    OTHER2
    {
       fun = 9001
    }

    MODULE
    {
       #../MODULE[tobepasted] { }

       #../OTHER { }

       #/OTHER2 { }
    }
}

 

Edited by sarbian
Link to post
Share on other sites
Having an issue with productivity on my modules. I have a base with a Science Lab module and a survey module stocked with intelligent engineers but neither are showing any productivity, can anyone point me in the right direction?

I think you got the wrong thread there ;)

Productivity is an EPL mechanic AFAIK: http://forum.kerbalspaceprogram.com/threads/59545-0-90-Extraplanetary-Launchpads-v5-1-2

Link to post
Share on other sites
And here is ModuleManager 2.5.13

- < and > compare on value check.


@PART
[*]:HAS[#mass[<1]]:Final
{
@mass = 0.01
}

- # operator to copy-paste whole node from anywhere. The syntax look like the one for the variables. I hope the example make the syntax clear :


MY_NODE_LIBRARY
{
MODULE
{
name = MechJebCore
}
}

@PART
[*]:HAS[@MODULE[ModuleCommand],!MODULE[MechJebCore]]
{
#@MY_NODE_LIBRARY/MODULE[MechJebCore] { }

MODULE
{
name = tobepasted
}

OTHER
{
fun = 9001
}

OTHER2
{
fun = 9001
}

MODULE
{
#../MODULE[tobepasted] { }

#../OTHER { }

#/OTHER2 { }
}
}

Oh my!

The < and > checks look incredibly usefull! Finally a way to add the KASattach module to all small lightweight parts without having to create incredibly long config files :D (if i am understanding its usefulness correctly :P)

Thanks for all the work on this sarbian!

Edited by rabidninjawombat
Link to post
Share on other sites

Hi there, I am trying to multiply a value using a MM patch, but I can´t figure out the correct syntax to target the correct value:

I want to set a multiplier to an atmosphere curve with two keys, but I dont want to change the atmosphere pressure part, just the specific impulse.

So:


@PART[xxx]:Final
{
@MODULE[ModuleEngines]
{
atmosphereCurve
{
key = 0 200
key = 1 125
}
}
}

does not become when multiplied by 0.5:

key = 0 100
key = 0.5 62.5

Thanks in advance :)

Edited by DaniDE
Link to post
Share on other sites
Hi there, I am trying to multiply a value using a MM patch, but I can´t figure out the correct syntax to target the correct value:

I want to set a multiplier to an atmosphere curve with two keys, but I dont want to change the atmosphere pressure part, just the specific impulse.

So:


@PART[xxx]:Final
{
@MODULE[ModuleEngines]
{
atmosphereCurve
{
key = 0 200
key = 1 125
}
}
}

does not become when multiplied by 0.5:

key = 0 100
key = 0.5 62.5

Thanks in advance :)

You're missing the splice operators. Also, you need to specify for each key which key it is (key,0 and key,1 for first and second)


@PART[xxx]:Final
{
@MODULE[ModuleEngines]
{
@atmosphereCurve
{
@key,0 = 0 100
@key,1 = 1 62.5
}
}
}

Link to post
Share on other sites
Thanks guys. I gonna go google "splice operators" and "MYSPECIFICLIB" and try to make sense of it now :D

Warning, 'splice operator' is probably not technically correct since we're not dealing with lists, tables or dictionaries. Nevertheless I tend to think of it that way so I tend to call them that.

When dealing with Module Manager, the @ is used either as a conditional to see if a node exists or to edit an existing node, key or field.

Link to post
Share on other sites
Thanks guys. I gonna go google "splice operators" and "MYSPECIFICLIB" and try to make sense of it now :D

That was a question of mine with example code, don't google it :) I wanted to know if you could include ( well, "paste" ) an entire block like that.

Link to post
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...