Skip to content

Debug console

Snark edited this page Nov 5, 2016 · 4 revisions

What's this about?

Since KSP 1.2, the game's debug console (the one you get by pressing Alt+F12) allows entering console commands (these start with a "/" character).

IndicatorLights provides its own console command, /il, which allows you to do various things with it that can be helpful for debugging purposes. This can be especially useful to modders.

How do I use the IndicatorLights debug console command?

Just open up the debug console window via Alt+F12, and type the command /il followed by the appropriate arguments to get it to do what you want. It works both in the editor and in flight.

To find out what it can do and what the arguments are, consult the documentation below, or just type /il help for an in-game guide.

What can it do?

The following functionality is currently supported:

  • List all the parts on the ship that have IndicatorLights functionality on them
  • Find out the names of the meshes on a part (which you can use in setting up a ModuleControllableEmissive)
  • List detailed info about a particular part (e.g. what meshes, emissives, and controllers there are)
  • Make a "live" edit to the IndicatorLights syntax controlling a module, and instantly see the effect in-game
  • Flip a global on/off switch that controls all indicator lights (when turned off, they all go dark).

More functions may be added over time, if there's demand.

Syntax

/il parts

Lists all IndicatorLights-enabled parts on the current vessel.

Example: you type,

/il parts

...and it then displays something like this:

[IndicatorLights] 7 IndicatorLights parts found:
0: Small Inline Reaction Wheel
1: Double-C Seismic Accelerometer
2: 2HOT Thermometer
3: PresMat Barometer
4: Z-400 Rechargeable Battery
5: Z-400 Rechargeable Battery
6: HG-5 High Gain Antenna

/il part <index>

Displays information about the specified part. The index is one that you get from the /il parts command (see above).

Example: Having gotten the parts list above, you decide you want to examine the seismograph. So you type:

/il part 1

...and it displays something like this:

[IndicatorLights] Part 'Double-C Seismic Accelerometer' has 2 meshes, 1 emissives, 2 controllers.

/il part <index> meshes

Lists the names of all meshes on the part. (It lists all the meshes, not just the ones that IndicatorLights uses.) This is useful when setting up meshes in part config.

Example: You decide to look at the meshes on the seismograph. So you type:

/il part 1 meshes

...and it displays this:

[IndicatorLights] Part 'Double-C Seismic Accelerometer' has 2 meshes:
0: accelerometer
1: IndicatorLights/Meshes/nubbinLamp

/il part <index> emissives

Lists all the IndicatorLights emissives on the part.

Example: You decide to look at the emissives on the seismograph. So you type:

/il part 1 emissives

...and it displays this:

[IndicatorLights] Part 'Double-C Seismic Accelerometer' has 1 emissives:
0: indicator: target "IndicatorLights/Meshes/nubbinLamp"

Note that in the above, it shows you the emissive name ("indicator", in this case), which is what you would use when pointing a ModuleEmissiveController at it; and the mesh (or meshes) that the emissive is working with.

/il part <index> controllers

Lists all the IndicatorLights controllers on the part.

Example: You decide to look at the controllers on the seismograph. So you type:

/il part 1 controllers

...and it displays this:

[IndicatorLights] Part 'Double-C Seismic Accelerometer' has 2 controllers:
0: ModuleScienceDataIndicator, emissive "indicator": status = False
1: ModuleScienceAvailabilityIndicator, no emissive: status = True

/il part <index> controller <index>

Shows detailed information about the specified controller on the specified part.

Example: Having seen the above list of controllers on the seismograph, you decide you want to take a closer look at the science availability indicator. It's index 1 in the list. So you type:

/il part 1 controller 1

...and it displays this:

[IndicatorLights] Double-C Seismic Accelerometer's ModuleScienceAvailabilityIndicator:
3 parseable ID fields:
lowValueColor: $Off
mediumValueColor: blink(dim($MediumScience, 0.9), 150, $Off, 1050)
highValueColor: blink($HighScience, 200, $Off, 200)
To temporarily override a field: /il part 1 controller 1 set <name> <value>

...Hmm, that last bit about overriding a field sounds interesting! Let's see what we can do with that.

/il part <index> controller <index> set <name> <value>

This is a powerful debugging tool that lets you tinker with the IndicatorLights syntax on a part, instantly seeing the results in-game. This can be very useful for modding, when you're tinkering with the syntax to try to get exactly the visual effect you want. It's much less painful than "edit the config, start KSP, see how it looks, tweak the config, restart KSP".

Caveat: This feature only allows making a temporary edit in-game. You can use it to see what visual effect a given syntax will produce, nothing more. Your changes aren't persisted or saved in any way, and will be lost the next time the ship is loaded.

Example: You're looking at the seismograph, and it's blinking green at you to indicate "there's high-value science available to acquire here." You decide you don't like the visual style. You want it to blink magenta instead of green, and you want it to blink faster. So you type this command:

/il part 1 controller 1 set highValueColor blink(#FF00FF, 100, $Off, 100)

...Result: The seismograph immediately starts blinking magenta really fast, and you see this confirmation message in the debug window:

[IndicatorLights] Double-C Seismic Accelerometer's ModuleScienceAvailabilityIndicator: Setting highValueColor to: blink(#FF00FF, 100, $Off, 100)