Jump to content

Getting started with the KSP config language


Recommended Posts

I have some questions, that I'm sure other beginners have.

  1. What is the name of the language? Did it exist before, was it invented by Squad, or was it extended from something else?
  2. Does documentation exist? Can you link it?
  3. In what order are statements evaluated?
  4. What are the types? When is a variable visible to the script?
  5. Are there any hidden name dependencies? (E.g. Maybe modules have to start with "Module"?)
  6. What do all the symbols (*, ~, #) mean?

I added what I've been able to figure out to the wiki page on configs. Assuming some comprehensive but impossible to find community documentation doesn't already exist, I'd love it if you could add your answers directly there.

Link to comment
Share on other sites

1) I do not know where the language used comes from. My best guess is a modified JSON objects list but that is probably wrong.

2) Unfortunately documentation is pretty much non-existant. The best bet is to find a mod that does something similar and check out its code.

3) Statement order: Not sure what you are asking, in the stock game it is simply done from top to bottom, there is only one .cfg per part. (See my note about Module Manager below.)

4) Valid entries in a .cfg file are determined by the associated PartModule in code. Everything that is tagged KSPField will be imported from the .cfg file.

5) None that I am aware of. PartModules starting with module is a naming convention to try and keep things straight for the humans reading it.

6) The symbols are not part of the stock game. They are used by the mod ModuleManager to allow mod makers to edit part .cfg files without having to overwrite the file. For further info on this I'll have to direct you to the ModuleManager thread.

I see you've edited the wiki page to add the symbols in without making any note that ModuleManager is required for those to work, I'd recommend removing those as I believe the intent of that page is to be stock-game compatible (so without ModuleManager installed.)

D.

Link to comment
Share on other sites

Mike (Mu) created it for .20, IIRC. It doesn't have a name other than ConfigNode (the name of the object).

I think you're confusing confignodes with what Module Manager does to them. ConfigNodes are just a way of parsing text: it's a simple tree composed of nodes and values.

Values are

name = value

Nodes are

node

{

stuff

}

where stuff can be values and/or nodes (or nothing at all).

name, value, and node are all any-old-string. node names can't have spaces in them, but value names (and value values) can.

// is a comment.

That's it.

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