Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

FAQ: How do I debug in MD?

Erich Gubler edited this page Nov 21, 2011 · 6 revisions

This answer assumes you're using valid YAML in your config file - to check this, use this online YAML parser.

ModDamage has some included debugging features that can be very useful for troubleshooting your syntax and ingame config operations. Understanding how to use these can save you a lot of time and frustration when you've got a large, untested MD configuration written out - which is precisely what was in mind when MD was coded.

Syntax debugging can be done both from the console and ingame - it's really a matter of preference. If you use Linux or a frontend like Crafty, which highlights log messages according to their severity, you may find it easier to debug your configuration from the Bukkit console. If not, MD also offers the same functionality ingame. Most syntax debugging is done with the Reload command ("/moddamage reload", or "/md r" for short) and the "/md check" command ("/md c").

When ModDamage is loaded, it outputs and records all log messages to a cache, and can be recalled via the Check command later. Using the Reload command will recache your /ModDamage/config.yml without the need to restart the server. It should be noted that a basic reload (only "md r") does not reload the routines library. A complete reload is an expensive operation to perform, and should only be done when you need to reload routines from external ModDamage libraries like the one included in the God of Thunder plugin. You do not need to reload your configuration to check it with a different debug setting.

Console Debugging

From the console, simply type "md c" and the entire log record you see whenever you reload will print to the screen.

As an example, let's use this config for demonstration:

Damage:
    - 'if event.environment.nether':
        - 'message.target.You are in Nether!' #Forgot mah period. D:
debugging: normal

Join the server after ModDamage loads...

![Console - Shot 1](images/Tut 1 - Screenshot 1.png)

...and use "/md c" to bring up a screen that looks like this:

![Console - Shot 2](images/Tut 1 - Screenshot 2.png)

We can demonstrate troubleshooting by inserting the following mistake:

Damage:
    - 'if event.environment.nether':
        - 'messagetarget.You are in the Nether!' #Forgot mah period. D:
debugging: normal

Let's reload the config with "md r".

![Console - Shot 3](images/Tut 1 - Screenshot 3.png)

ModDamage reports the overall status of a reload upon completion - and there seems to be an error. Upon closer examination, YAML can parse our configuration, but ModDamage cannot; there's an error in the configuration loading. If you ever need to review the configuration again, you can simply use "md c" again:

![Console - Shot 4](images/Tut 1 - Screenshot 4.png)

Note that this Check command is being run while "normal" debugging is enabled - you can change debugging for more or less detailed output. A quick rundown of the debug settings is as follows, from least to most verbose:

  • "Quiet" - Suppresses all but critical config output. This will only output relevant information if there are errors in the configuration. This setting is recommended when you have a configuration that you know works and you probably won't be changing soon.

  • "Normal" - Reads back the configuration as it is loaded, for both successes and errors. This is generally the most useful for MD configuration editing, and recommended for virtually all situations.

  • "Verbose" - Prints ALL debug messages to console. This generally gives more detail "Normal" debugging and adds some more spacious formatting for readability, but can be very space-consuming. Use this when you're reporting a bug, asking for support, or otherwise truly struggling to make MD work for you.

Ingame Debugging

Using the Check command ingame is a relatively streamlined process. When you first type "/md c", a screen similar to below is displayed:

Ingame - Shot 1

This is the Config Overview. It displays MD Config Overview - a panel of information that quickly allows the user to quickly assess the overall load status and any problem areas of their configuration. Note that since we have loaded a configuration, there's more detail available - bring up the first (and only) page for this configuration with "/md c 1".

Ingame - Shot 2

Reinserting our error from the example with the console and using our debugging commands again:

/md r...

Ingame - Shot 3

/md c...

Ingame - Shot 4

Typing "/md c 1"...

Ingame - Shot 5

As of MD 0.9.6, Message routines can also be used to provide specific points of information about the event's information. Any number reference or one of the following strings properties can be used with a Message routine when encapsulated in percent symbols:

* $entity.armorset

* $entity.group # ALL groups.

* $entity.name

* $entity.region # ALL regions.

* $entity.tag # ALL tags.

* $entity.type

* $entity.wielding

* event.world

* event.environment

In this example, we'll use the following config to tell the player what world they're in:

Damage: 'message.target.You took damage in world %event.world%!'
debugging: normal

Another straightforward application of Message

If for any reason debug modes and the documentation included on this wiki don't help with a configuration issue, try filing an issue in the issue tracker or chatting with a developer in theModDamage IRC.

Clone this wiki locally