Jump to content

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


sarbian

Recommended Posts

  On 10/19/2018 at 4:27 PM, blowfish said:
  1. You want %J = #$@F[g]/h$ to paste a variable from a different top-level node (@ tells it to look at the top level)
  2. You're missing the /h part
  3. :HAS is not valid when creating a node.  It checks the node you're modifying, so if you had @MODULE:HAS[...] that would check the conditions on the existing MODULE node
  4. See 3
Expand  

Thanks. So code would like this:

  Reveal hidden contents

What I am thinking is that b.cfg is the definition file for a part called something.
I am trying to add a module to something depending on the value of H.
How about I use a :NEEDS that checks the value of #J?

Link to comment
Share on other sites

  On 10/19/2018 at 12:40 PM, Burning Kan said:

Thanks for the warning ,test it when i start my kerbalismcareer(few weeks),i dont want to use MKS that why i need to deploy with EC

AFAIK in ksp all is calculated in metric tons so 1kg is 0.001

and nice ,will try it with engineer depency when the time come ,Cheers

Expand  

Hmm. Using the original patch..the ec to deploy the pilgrim was 6750. Which i was only able to double check using the kg value per this post. Im probably missing something obvious..just not to me lol

Link to comment
Share on other sites

  On 10/19/2018 at 4:39 PM, Apaseall said:

Thanks. So code would like this:

  Reveal hidden contents

What I am thinking is that b.cfg is the definition file for a part called something.
I am trying to add a module to something depending on the value of H.
How about I use a :NEEDS that checks the value of #J?

Expand  

NEEDS only checks the presence or absence of mods.  You'll need to split this into multiple patches.  I think this is what you want

F
{
    g = h
}

@PART[something] // whatever your patch actually is
{
    %j = #$@F[g]/h$
}

@PART[something]:HAS[#j[h]]
{
    MODULE
    {
        // ...
    }
}

@PART[something]:HAS[#j[*]]
{
    !j = del // del part can be anything, just needs to be an equal sign here
}

 

Link to comment
Share on other sites

  On 10/19/2018 at 10:18 PM, blowfish said:

NEEDS only checks the presence or absence of mods.  You'll need to split this into multiple patches.  I think this is what you want.

Expand  

Oh. Can I get away with:

  Reveal hidden contents

Since b.cfg is a part definition file, it will be creating part whose name = something. The first piece of b.cfg then would be creating a part, the second piece would be amending that part?
Hmm. Lots of thoughts come to me here. Irrespective of you answer to the code in this post, I might be able to swing what I am looking for in the use I am aiming at.
But would be nice to know if this code IS an option.

Oh and blowfish, you are a STAR. My sincerest thanks for sharing your knowledge with me.

Link to comment
Share on other sites

  On 10/19/2018 at 10:33 PM, Apaseall said:

Oh. Can I get away with:

  Reveal hidden contents

Since b.cfg is a part definition file, it will be creating part whose name = something. The first piece of b.cfg then would be creating a part, the second piece would be amending that part?
Hmm. Lots of thoughts come to me here. Irrespective of you answer to the code in this post, I might be able to swing what I am looking for in the use I am aiming at.
But would be nice to know if this code IS an option.

Oh and blowfish, you are a STAR. My sincerest thanks for sharing your knowledge with me.

Expand  

You do have to put it in a patch.  Variable replacements and other MM things aren't processed on non-patch root level nodes (i.e. PART { }).  This may change at some point in the future but is the case for now.

Link to comment
Share on other sites

  On 10/19/2018 at 10:36 PM, blowfish said:

You do have to put it in a patch.  Variable replacements and other MM things aren't processed on non-patch root level nodes (i.e. PART { }).  This may change at some point in the future but is the case for now.

Expand  

Hmm. So if for example I had b.cfg as a part definition file, which is .cfg, then I would do things in this order:

  Reveal hidden contents

Are you absolutely certain that this is not valid:
 

  Reveal hidden contents

?

Edited by Apaseall
Link to comment
Share on other sites

  On 10/19/2018 at 10:44 PM, Apaseall said:

Hmm. So if for example I had b.cfg as a part definition file, which is .cfg, then I would do things in this order:

  Reveal hidden contents

Are you absolutely certain that this is not valid:
 

  Reveal hidden contents

?

Expand  

:NEEDS is the exception I forgot to mention.  No other MM features work in root non-patch nodes

The order only matters between patches.  Non-patch nodes are all added at the same time before any patches are run (or rather, everything is added to the same place and then MM extracts patches and then applies them in order)

Link to comment
Share on other sites

  On 10/20/2018 at 1:43 AM, blowfish said:

:NEEDS is the exception I forgot to mention.  No other MM features work in root non-patch nodes

The order only matters between patches.  Non-patch nodes are all added at the same time before any patches are run (or rather, everything is added to the same place and then MM extracts patches and then applies them in order)

Expand  

Cheers thanks for clearing that one up for me.
Simple order then 1 create non-patch node, 2 MM extracts and processes patches. No need to bother with name selection to provide process ordering until we come to MM patch processing. Cool.
Thanks for your help.

Link to comment
Share on other sites

Hey guys, I need a little help with my syntax for a little patch I wrote..  The goal was to improve performance on my little old potato by reducing part count by not having to spam solar panels en mass...

What I have currently:

 

@PART[*]:has[@RESOURCE[ElectricCharge]]:Final
{
    MODULE
    {
        name = ModuleGenerator
        isAlwaysActive = true
        OUTPUT_RESOURCE
        {
            name = ElectricCharge
            rate = 0.1
        }
    }
}

 

 

This WORKS but I would like to change it so that the actual generation is dependent on the parts amount of EC stored.  So something like [rate = (ElectricCharge*0.002)].  But I don't know the syntax for that, and booting the game up for testing takes 15 minutes each time...  (told you it's a potato) so experimenting is not exactly the best option for me currently.

Link to comment
Share on other sites

@Atlessa do you want to use the capacity  of your battery to determine rate? You can use that as a variable, there is an example of using variables a few posts back.

Or are you trying to use the current amount of EC to change the rate of production dynamically? I don’t think that would be possible with MM.

Link to comment
Share on other sites

  On 10/20/2018 at 3:19 PM, Atlessa said:

Yes. Capacity of course.  I know MM only does it's thing once, on startup. 

Expand  

The syntax would be something like:

  Reveal hidden contents

You would need to create the variable in the right place and make sure that you delete it from there also.
Also ResourceAmount is not the name you would be changing.
What I would do is examine an example part. Locate the Module that contains the value you want to change. Of course this may not be named Module but something like Resource.
Then in your code you would drill down to where that value is, put the multiplier just before it, do the multiplication then delete the variable.

Here is an example:

  Reveal hidden contents

Although I only included the one part named PAL_Claw, because in reality I made changes to PAL_Claw or PAL_Magnet or PAL_Gripper or PAL_Crane or PAL_Forklift I chose to delete the variable once, rather than inside each part.
Hope this helps.

Link to comment
Share on other sites

Edit:  I've figured it out, mostly. I just need to get MM to set my variable to the Electric Charge of the module being edited.  So far I've got

 

        %ATMMABC = 1
        @$ATMMABC$ *= [[RESOURCE]ElectricCharge]]

 

But that won't do it.   I tried different variations of the syntax but just can't figure it out :(

 

 

Below this line is my original post which is now mostly redundant. I've left it in for clarity.

-----------------------------------------------

Thanks for that.  I think you misunderstood what I want to do, though...  (Or you just gave an example... works for me)

So here's what I think I need to do, pseudo code first:


 

  Reveal hidden contents

To create a NEW module on the part that generates ABC electric charge per second

 

I got that much... now I just need to figure out the correct syntax, and I have no clue where to look.  The posts above are WAY more complex than this and don't help me at all.

 

 

Edit: 

 

So I tried 

  Reveal hidden contents

 

And that didn't work.  :/

 

Edit: Checked the logs, found this;

[ERR 20:51:22.715] [ModuleManager] Error - Cannot parse variable search when inserting new key rate = #$ATMMABC$

 

So I'm guessing I can't set up a new generator with a variable rate?

Edited by Atlessa
Link to comment
Share on other sites

  On 10/21/2018 at 1:54 AM, Atlessa said:

Anyone?  I'm really at my wits end...  Is what I'm trying to do even possible with MM?

Expand  

People do have a life outside KSP.  Sometimes it may take a day or so to get an answer.  Be patient, and keep in mind that people wont post if they dont have an answer 

Link to comment
Share on other sites

  On 10/21/2018 at 1:54 AM, Atlessa said:

Anyone?  I'm really at my wits end...  Is what I'm trying to do even possible with MM?

Expand  

Or in my case, a little sleep :P
Please read my example again, pay attention to @.
Without some of those you ain't going to be modifying something that exists. etc.
You know to look inside modulemanager.configcache to check the results of any patches right?

Link to comment
Share on other sites

@Atlessa The way you have it it will interpret that the literal string "ElectricCharge" - ModuleManager has no knowledge of what a RESOURCE { } node is or what its amount/maxAmount mean, or that ElectricCharge is the name of some particular resource.  I encourage you to find examples in other mods in the future for your own learning but I'll give this one to you

  Reveal hidden contents

 

Edited by blowfish
Link to comment
Share on other sites

  On 10/21/2018 at 5:17 AM, blowfish said:

@Apaseall The way you have it it will interpret that the literal string "ElectricCharge" - ModuleManager has no knowledge of what a RESOURCE { } node is or what its amount/maxAmount mean, or that ElectricCharge is the name of some particular resource.  I encourage you to find examples in other mods in the future for your own learning but I'll give this one to you.

Expand  

Erm. I think you might have who wrote what a bit mixed up. My example was merely to show how to make a variable, how to use it as a multiplier and delete it. I did advise examining example parts to determine in which nodes the pieces you wanted to amend are located.

Link to comment
Share on other sites

  On 10/21/2018 at 5:30 AM, Apaseall said:

Erm. I think you might have who wrote what a bit mixed up. My example was merely to show how to make a variable, how to use it as a multiplier and delete it. I did advise examining example parts to determine in which nodes the pieces you wanted to amend are located.

Expand  

Oops, @ed the wrong person.  Fixing...

Link to comment
Share on other sites

  Reveal hidden contents

 

Thanks... I would have NEVER figured that out.  Heck, even looking at it, I don't understand why I would need the #$...$ for the electric charge, let alone where I should have found the  /maxAmount 

Link to comment
Share on other sites

  On 10/21/2018 at 4:16 PM, Atlessa said:
  Reveal hidden contents

Thanks... I would have NEVER figured that out.  Heck, even looking at it, I don't understand why I would need the #$...$ for the electric charge, let alone where I should have found the  /maxAmount 

Expand  

Did my explanation make sense?  I can go into a bit more depth if any of the parts are confusing.

Link to comment
Share on other sites

  On 10/21/2018 at 4:31 PM, blowfish said:

Did my explanation make sense?  I can go into a bit more depth if any of the parts are confusing.

Expand  

Sort of.  I think.

At least to the point that I realize; I'm too old to learn this sh...  this stuff.  And will probably have to rely on others to write awesome mods that make my life around Kerbol easier for me and more managable for my little potato.

 

Fly safe.

Link to comment
Share on other sites

Hi everyone, got a new question:

  Reveal hidden contents

I would replace :FINAL with a suitable :AFTER[]

Link to comment
Share on other sites

  On 10/22/2018 at 6:31 PM, Apaseall said:

Hi everyone, got a new question:

  Reveal hidden contents

I would replace :FINAL with a suitable :AFTER[]

Expand  

I think you want @MODULE[A]:HAS[~B[*D*]]

~ means "does not have value"

*D* means match anything containing D.  If you just had D it would only match if the value was D with nothing before or after it

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