Jump to content

[1.3.1] Persistent Dynamic Pod Names release


Recommended Posts

Persistent Dynamic Pod Names

This mod has two related functions:
1.  Allow you to name each individual command pod in a vessel.  These names will be assigned to the entire vessel when the command pod becomes active
2.  Allow you to create one or more templates in a cfg file which can then be assigned to either a vessel and/or individual command pods.  The template is used when the vessel is launched (in the case where the template is assigned to the vessel in the editor), and when templates are assigned  to individual command pods, the template is processed when that command pod becomes active.

This mod includes version checking using MiniAVC, which can be downloaded from "http://forum.kerbalspaceprogram.com/threads/79745".  If you opt-in, it will use the internet to check whether there is a new version available. Data is only read from the internet and no personal information is sent. For a more comprehensive version checking experience, please download the KSP-AVC plugin from "http://forum.kerbalspaceprogram.com/threads/79745".
 

If you develop a template which you would like to share, please send it to me and I'll include it.

License: Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License

Donations gratefully accepted

Patreon.png

https://www.patreon.com/linuxgurugamer

You can get it from the following locations:

Spacedock: http://spacedock.info/mod/813/Persistent Dynamic Pod Names

Github: https://github.com/linuxgurugamer/PersistentDynamicPodNames/releases

It has been added to CKAN, should be available in a day or so

Files

PluginData/PDPN_Default_Templates.cfg    A file containing several simple templates as examples.  If no template file (next line) this file will be used
PluginData/PDPN_Templates.cfg            A text file created by the mod the first time it runs, and edited by the user to store templates
PluginData/PDPN_Settings.cfg            Currently stores a single setting regarding new templates.  This is a manually edit at this time.


Dialog Windows

There are several dialog windows used to control this mod.

Available Templates
This is accessed using the toolbar button (PDPN) while in the Space Center scene. This window will list all available templates, and allow you to specify which templates are active (active in this case means that it will appear in the template lists in the editors).
There are buttons which will allow you to enable or disable all of the templates.

toolbar.png

availableTemplates.png

 

PDPN Menu
There will be a PDPN button in the editor.  It has two functions.  Hovering the mouse above the button will display a menu with the following entries:

    Command Pods (opens a dialog)
    Set Priority to stage
    Set Priority to reverse stageClicking the button will bring up the Primary Ship Name Template Selection dialog


editorMenu.png

 

Primary Ship Name Template Selection
Accessed by clicking the PDPN button in the editor, this window presents a list of all active templates.  The selected template will be assigned to the vessel currently under construction.  After selection and closing the window, the template name will be put in the vessel name field at the top of the screen, with asterisks on either side (astericks are used to indicate it's a template).  If there is  nothing in the description field, a copy of the template will be put there.

primaryShipNameTemplSel.png

 

Command Pods
This dialog is accessed using the first menu item.  It displays a list of all the command pods (manned and unmanned) in the current vessel, in the priority order in which they will be used by this mod.  It displays each pod, the name or template selected, and what kind of vessel that command pod is set to.  Moving the mouse over each line will highlight the appropriate command pod.
At the right of each line will be an up and down arrow, this is used to move the pods up and down the priority list.
Double-clicking on an entry field  (either the name or the ship type) will bring up a pair of arrows (right/left) on each side of the field.  You can use those arrows to scroll through the available entries for that field;  name field will scroll through all active templates, ship type field will scroll through all the ship types.

commandPods1.png


commandPods2.png

 

Enter Persistent Pod Name
This dialog is accessed by right-clicking on a command pod and using the right-click menu item "Persistent pod name".  You can enter a sihp name, use the right/left arrows on either side of the entry field to scroll through the active templates, and select the vessel type by clicking the appropriate button.  This option is available in the flight scene as well.

rightclick.png


enterPersistentPodName.png

 

Template Layouts

A template can consist of the following types of information:

    Plain text, which is not touched and put into the final name exacty as entered
    [name]            The name will be processed and replaced immediately upon launch (or when the command pod becomes active)
    <name>            The name will be processed after launch and at every staging event
    (userDefName)    The userDefName is a user-selectedZ value.  The values will be defined in the cfg file
    #cntId#            This is a counter, which will start at 1 and increase by one every time a launch is done using this id.  You can have as many different counters as you like.  

The following example shows the syntax needed for defining a template.
All templates need to be specified using the "templateName".  In the example below, there are two templates defined, "exampleTemplate" and "Kepollo".
Then, the template is defined using the normal config file syntax
First line in the template is the template definition, followed by any special values.

The first template in the following example is a simple template called "exampleTemplate".
The template is defined as:  
    KSP-<year>:#usm#-(destination)
which is read as follows:
the <year> is replaced by the year of the launch
#usm# is a counter which increments by one for every launch
(destination) will have the user select a destination, defined below as planets

The second template, Kepollo, shows the use of one of the predefined name called "weightclass".  

    PersistentDynamicPodNames
    {
        templateName = exampleTemplate
        templateName = Kepollo

        exampleTemplate
        {
            template = KSP-<year>:#usm#-(destination)
            destination
            {
                values = planets
            }
        }

        Kepollo
        {
            template = Kepollo-[weightclass] #apolloCnt#

            weightclass
            {
                values = Light Intermediate Medium Heavy
                Light = 5
                Intermediate = 50
                Medium = 100
                Heavy = 250
            }
        }

    }

--

Special names

There are some special names known by the mod which have special meanings.  They are listed below, along with any explanation needed.

weightclass        Specifies a weight class the vessel is, based on total vessel mass.  The values are not fixed, you can specify as many as you like.  For each value specified, you need to put in a number which is the weight limit of that value.  An example definition is:

            # Weightclass, must be in order from lightest to heaviest.  Last one is the
            # catchall, for anything which is none of the earlier ones
            weightclass
            {
                values = Light Intermediate Medium Heavy
                Light = 5
                Intermediate = 50
                Medium = 100
                Heavy = 250
            }

All of the following special names have default values which can be replaced by defining the values you want in it's own section.  There are examples below for each of the special names listed below:

enginetype        A string of all enginetypes.  Enginetype is obtained from the game, and an abbreviation is created. Only one of each type will be added.  So for example, if a vessel has both solid and liquid fuel engines, a generated enginetype might be: 
fueltype        A string of all fuel types, ordered by engines/stages.
vesseltype        The vesseltype as defined by KSP
numstages        Number of stages in the vessel
curstagenum        Current stage number
propulsion        The type of propulsion
date            Game date
day                Day of year
year2            2 digit year
year3            3 digit year
year4            4 digit year
year
    
The following can only be used for a manual-inputted value
    destination        If nothing specified, will be all planets or moons.  
    planets            If nothing specified, then all planets
    moons            All moons in system

    # Weightclass, must be in order from lightest to heaviest.  Last one is the
    # catchall, for anything which is none of the earlier ones
    weightclass
    {
        values = Light Intermediate Medium Heavy
        Light = 5
        Intermediate = 50
        Medium = 100
        Heavy = 250
    }
    # fueltype is/are the type(s) of propellent(s) in the current stage.  The lines below the 
    # "values" line shows what will be replaced for each type;  ie:  a LiquidFuel engine would normall
    # default to "LF", but the below says to replace with "L"
    fueltype
    {
        values = LiquidFuel Oxidizer SolidFuel MonoPropellant XenonGas 
        LiquidFuel = L
        Oxidizer = O
        SolidFuel = S
        MonoPropellant = M
        XenonGas = X
    }

    vesseltype
    {
        values = Cargo SpacePlane Aircraft DisposableDrone ReusableDrone CrewTransfer Tanker Station Tug CompoundVehicle Rover
        Cargo = C 
        SpacePlane = SP
        Aircraft
        DisposableDrone = DD
        ReusableDrone = RD
        CrewTransfer = CT
        Tanker = T
        Station = S
        Tug = Tg
        CompoundVehicle = CV
        Rover = RV

    }

    # destination defaults to all planets
    # If values are specified, then only those are shown
    # special values:   planets moons all
    destination
    {
        values = planets
    #    values = Kerbin Mun Minmus Mono Eve Duna Dres Jool Eeloo AsteroidRedirectMission Solar Rescue
    #    Kerbin =
    #    Mun = Mu
    #    Minmus = Mi
    #    Mono = M
    #    Eve = E
    #    Duna = Du
    #    Dres = D
    #    Jool = J
    #    Eeloo = E
    #    AsteroidRedirectMission = ARM
    #    Solar = K
    }

    # Propulsion
    propulsion
    {
        values = Generic SolidBooster LiquidFuel Piston Turbine ScramJet Electric Nuclear MonoProp
        Generic = G
        SolidBooster = Srb
        LiquidFuel = L
        Piston = P
        Turbine = T
        ScramJet = SJ
        Electric = E
        Nuclear = N
        MonoProp = M
    }

    custom1
    {
        values = one two three four five
    }
    

Edited by linuxgurugamer
Link to comment
Share on other sites

OMG FINALLY!!! Have been holding my breath for the release ever since I stumbled upon that thread in plugin development. This definitely ranks among the most useful mechanics in all of KSP modding. So useful in fact, it should have been in stock ages ago. No more manually assigning debris name and type for discarded transfer tugs... yay!

Link to comment
Share on other sites

12 hours ago, linuxgurugamer said:

It has been added to CKAN, should be available in a day or so.

In fact its on CKAN at the moment, but it is marked as only compatible with 1.1.2 as the max version. Seeing as CKAN is referencing the .version file in your install for that, (which says the max version is 1.1.3) Im not too sure what the hold up is. Is a .version file meant to have both version and min/max version information?

Link to comment
Share on other sites

1 hour ago, blu3wolf said:

In fact its on CKAN at the moment, but it is marked as only compatible with 1.1.2 as the max version. Seeing as CKAN is referencing the .version file in your install for that, (which says the max version is 1.1.3) Im not too sure what the hold up is. Is a .version file meant to have both version and min/max version information?

It was a problem on the ksp-avc site, I just fixed it.  But it will probably be a few hours before CKAN sees it

thanks

Edited by linuxgurugamer
Link to comment
Share on other sites

1 hour ago, brusura said:

Nice! Downloading...

I am not sure how templates works ^_^ I am going to mess with it a bit

I included a number of sample templates.  Try starting with the simple ones, such as the Mercury, Gemini and Apollo to get a feel for how they work

Link to comment
Share on other sites

@linuxgurugamer I found some NRE, as I undock the rover and try to switch to it with brackets:

NRE

Spoiler

NullReferenceException: Object reference not set to an instance of an object
  at KnowledgeItem`1[System.String].get_Value () [0x00000] in <filename unknown>:0
  at MapObject.GetName () [0x00000] in <filename unknown>:0
  at PlanetariumCamera.SetTarget (.MapObject tgt) [0x00000] in <filename unknown>:0
  at PlanetariumCamera.onVesselSwitching (.Vessel from, .Vessel to) [0x00000] in <filename unknown>:0
  at EventData`2[Vessel,Vessel].Fire (.Vessel data0, .Vessel data1) [0x00000] in <filename unknown>:0
  at FlightGlobals.setActiveVessel (.Vessel v, Boolean force) [0x00000] in <filename unknown>:0
  at FlightGlobals.ForceSetActiveVessel (.Vessel v) [0x00000] in <filename unknown>:0
  at VesselSwitching.Update () [0x00000] in <filename unknown>:0 

Video: 

Spoiler

 

craft: http://s000.tinyupload.com/index.php?file_id=65653518471810660106

output_log:  http://s000.tinyupload.com/?file_id=61255478701184879931

installation is stock

Edited by brusura
Link to comment
Share on other sites

9 minutes ago, brusura said:

@linuxgurugamer I found some NRE, as I undock the rover and try to switch to it with brackets:

NRE

  Hide contents

NullReferenceException: Object reference not set to an instance of an object
  at KnowledgeItem`1[System.String].get_Value () [0x00000] in <filename unknown>:0
  at MapObject.GetName () [0x00000] in <filename unknown>:0
  at PlanetariumCamera.SetTarget (.MapObject tgt) [0x00000] in <filename unknown>:0
  at PlanetariumCamera.onVesselSwitching (.Vessel from, .Vessel to) [0x00000] in <filename unknown>:0
  at EventData`2[Vessel,Vessel].Fire (.Vessel data0, .Vessel data1) [0x00000] in <filename unknown>:0
  at FlightGlobals.setActiveVessel (.Vessel v, Boolean force) [0x00000] in <filename unknown>:0
  at FlightGlobals.ForceSetActiveVessel (.Vessel v) [0x00000] in <filename unknown>:0
  at VesselSwitching.Update () [0x00000] in <filename unknown>:0 

Video: 

  Reveal hidden contents

 

craft: http://s000.tinyupload.com/index.php?file_id=65653518471810660106

output_log:  http://s000.tinyupload.com/?file_id=61255478701184879931

installation is stock

What planet were you on? Did you hyperedit there?

What's strange is that the NRE doesn't mention PDPN at all

Link to comment
Share on other sites

Just now, linuxgurugamer said:

What planet were you on? Did you hyperedit there?

What's strange is that the NRE doesn't mention PDPN at all

kerbin ho hyperedit, just stock install with your mod

Link to comment
Share on other sites

Love it. However slight issue: debris and unnamed pods/probes get called "unknown Vessel" (with that capitalization) Can you make the defaults either the same as stock or, at least, something a bit better.

Link to comment
Share on other sites

6 hours ago, StarkRG said:

Love it. However slight issue: debris and unnamed pods/probes get called "unknown Vessel" (with that capitalization) Can you make the defaults either the same as stock or, at least, something a bit better.

I'll work on it,  I opened a github issue to track it.

Thanks for the report

Link to comment
Share on other sites

  • 4 weeks later...
On 8/6/2016 at 10:40 PM, blu3wolf said:

My button is in Blizzy's toolbar for some reason (I generally prefer that anyway). I dont have a hover menu though, and I cant seem to get to the command pods dialogue?

The blizzy code isn't well tested, and I don't recommend it at this time.

I did raise it as a Github issue so I won't lose track of it

Edited by linuxgurugamer
Link to comment
Share on other sites

  • 2 weeks later...

This is a great mod. It is just what KSP needs. Can I make a couple of suggestions.  First, If you have a ship and its name has a counter the counter will change the name of the ship every time you dock and undock it.  The counters are great but it would be better if when the mod readies a name with a counter is replaced with the new name.  This will stop ships from changing names every time you dock and undock a ship.

Example:
Command Module Name at launch: Eagle #EagleCounter#

Your mod changes he name of the ship to “Eagle 1”.

It should then replace that command Module with the “Eagle #EagleCounter#” as a name with “Eagle 1”.  

The second is more of a question and a suggest if the answer is no.  The Templates allow you to creat user defined lists which are very hopeful.  Is there a way to create a list out side of a template so it can be used in more then one template without copying it?

Third, Is it possible to Change the name of a ship when you click the “Control from Here” button?

Link to comment
Share on other sites

  • 2 weeks later...

Can anyone tell me what is wrong with this config file?  I get no errors and know of the templates show up in any save file (new or old).

 

PersistentDynamicPodNames
{
    templateName = Satellite
    templateName = ComSat
    templateName = Station
    templateName = GroundBase
    templateName = TestShip
    templateName = Ship

    Satellite
    {
        template = SAT-<year2>#SatCounter#-(Function)-(dest)
        Function
                {
            values = RD SAR MS RD/MS RD/SAR MS/SAR RD/MS/SAR M700 M700/RD M700/MS M700/SAR M700/RD/MS M700/RD/SAR M700/MS/SAR M700/RD/MS/SAR NBS NBS/M700 NBS/M700/RD NBS/M700/MS NBS/M700/SAR NBS/M700/RD/MS NBS/M700/RD/SAR NBS/M700/MS/SAR NBS/M700/RD/MS/SAR
        }
        dest
        {
            values = Ke Mu Mi Mo Ev Gi Du Ik Dr Jo La Va Ty Bo Po Ee ARM K
        }
    }
    ComSat
    {
        template = COMSAT-<year2>#SatCounter#-(OmniRange)-(DishRange)-(dest)
        OmniRange
        {
            values = 500K 2_5M 3M 5M
        }
        DishRange
        {
            values = 50M 90M 40G 60G 350G 400G
        }
        dest
        {
            values = Ke Mu Mi Mo Ev Gi Du Ik Dr Jo La Va Ty Bo Po Ee ARM K
        }
    }
    Station
    {
        templete = KSS-<year2>#BaseCounter#-(dest)
        dest
        {
            values = Ke Mu Mi Mo Ev Gi Du Ik Dr Jo La Va Ty Bo Po Ee ARM K
        }
    }
    GroundBase
    {
        templete = KGB-<year2>#BaseCounter#-(dest)
        dest
        {
            values = Ke Mu Mi Mo Ev Gi Du Ik Dr Jo La Va Ty Bo Po Ee ARM K
        }
    }
    TestShip
    {
        templete = X-<year2>#MissionCounter#
    }
    Ship
    {
        templete = (function)-<year2>#MissionCounter#
        function
        {
            values = ORB RV SP CT Ta Tg
        }
    }
}

 

 

Link to comment
Share on other sites

On 8/20/2016 at 0:59 AM, mcstalker2 said:

This is a great mod. It is just what KSP needs. Can I make a couple of suggestions.  First, If you have a ship and its name has a counter the counter will change the name of the ship every time you dock and undock it.  The counters are great but it would be better if when the mod readies a name with a counter is replaced with the new name.  This will stop ships from changing names every time you dock and undock a ship.

Example:
Command Module Name at launch: Eagle #EagleCounter#

Your mod changes he name of the ship to “Eagle 1”.

It should then replace that command Module with the “Eagle #EagleCounter#” as a name with “Eagle 1”.  

The second is more of a question and a suggest if the answer is no.  The Templates allow you to creat user defined lists which are very hopeful.  Is there a way to create a list out side of a template so it can be used in more then one template without copying it?

Third, Is it possible to Change the name of a ship when you click the “Control from Here” button?

For # 1, use the templates

For #2, not at the present time

For #3, not at the present time, and not sure if it even makes sense.

50 minutes ago, mcstalker2 said:

Can anyone tell me what is wrong with this config file?  I get no errors and know of the templates show up in any save file (new or old).

 

PersistentDynamicPodNames
{
    templateName = Satellite
    templateName = ComSat
    templateName = Station
    templateName = GroundBase
    templateName = TestShip
    templateName = Ship

    Satellite
    {
        template = SAT-<year2>#SatCounter#-(Function)-(dest)
        Function
                {
            values = RD SAR MS RD/MS RD/SAR MS/SAR RD/MS/SAR M700 M700/RD M700/MS M700/SAR M700/RD/MS M700/RD/SAR M700/MS/SAR M700/RD/MS/SAR NBS NBS/M700 NBS/M700/RD NBS/M700/MS NBS/M700/SAR NBS/M700/RD/MS NBS/M700/RD/SAR NBS/M700/MS/SAR NBS/M700/RD/MS/SAR
        }
        dest
        {
            values = Ke Mu Mi Mo Ev Gi Du Ik Dr Jo La Va Ty Bo Po Ee ARM K
        }
    }
    ComSat
    {
        template = COMSAT-<year2>#SatCounter#-(OmniRange)-(DishRange)-(dest)
        OmniRange
        {
            values = 500K 2_5M 3M 5M
        }
        DishRange
        {
            values = 50M 90M 40G 60G 350G 400G
        }
        dest
        {
            values = Ke Mu Mi Mo Ev Gi Du Ik Dr Jo La Va Ty Bo Po Ee ARM K
        }
    }
    Station
    {
        templete = KSS-<year2>#BaseCounter#-(dest)
        dest
        {
            values = Ke Mu Mi Mo Ev Gi Du Ik Dr Jo La Va Ty Bo Po Ee ARM K
        }
    }
    GroundBase
    {
        templete = KGB-<year2>#BaseCounter#-(dest)
        dest
        {
            values = Ke Mu Mi Mo Ev Gi Du Ik Dr Jo La Va Ty Bo Po Ee ARM K
        }
    }
    TestShip
    {
        templete = X-<year2>#MissionCounter#
    }
    Ship
    {
        templete = (function)-<year2>#MissionCounter#
        function
        {
            values = ORB RV SP CT Ta Tg
        }
    }
}

 

 

At a quick glance, you misspelled template as "templete", try fixing that first.

Not sure about the rest, will have to take a look at it tomorrow.  But see if fixing the spelling mistakes helps

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