Site Tools


debugging

Debugging Scripts

Several tools exist in the client which can aid in debugging and testing scripts.

  • /set debug
    Allows the client to show which commands are actually being executed, how they are being parsed, and what alias and variable substitutions are taking effect.
  • /pretend
    Causes the client to “pretend” it received a given line of text from the server. Use with caution.
  • /shook
    Causes a given hook to be triggered as if the event had actually occurred.
  • /xdebug inbound (not officially supported)
    Shows all data received from the server. This generates a lot of duplicate output.
  • /xdebug outbound (not officially supported)
    Shows all data sent to the server. This generates a lot of output.
  • /eval
    About the only time you should use this, at the command line to see if a fragment of code behaves as expected.
  • /echo
    Adding a few well placed /echo statements are a good way to check to make sure that things are as they seem. You can use them to make sure code that is supposed to be executed really is, and to check on the state of variables.
  • /package, /unload
    These provide a way to unload scripts, saving you repeated restarts of the client.
  • /dump
    Purge hooks, variables, and or aliases. This can be used to restore the client to a known state.

There is also a contributed script, debug.irc included with the client. This serves as an example of how to use /set debug debugging modes in a script with a large number of /on hooks to debug only specific sections of code.

debugging.txt · Last modified: 2006/08/29 20:18 by 127.0.0.1