Xpertmud - The Mud Experience
Mailing List
Plugin Tutorial

This tutorial explains how to create a little graphical Plugin for xpertmud. You should start by downloading the source code.

Start up QT Designer, select File->New and choose "C++ Project"

Set a Project Name.

Set the Template to "lib". Add the directory with kde-headers to Includepath.

Select File->new again, choose Widget.

Configure Name and Caption.

Resize the widget, add a Label, set its name to "CaptionLabel" and set a Text.

add a ProgressBar, set its name.

Layout the widgets. (Horizontal or Grid)

Time for the scripting interface. Add this slot, it will be called by the perl/python part of the plugin.

This signal allows to call perl/python methods from your C++ code.

Time to write some code. This is all c++ code we really need to write for the plugin, the rest is just copy'n'paste.

Add some glue code required for KDE libraries. If you're compiling for windows(tm), use the header files found in the compat subdir of xpertmud.

now the plugin is complete. "qmake tutorial.pro" and "make".

Create a perl module for accessing the plugin.

Same for python.

create a .la file for the .so file. This file is usually generated by libtool, we're using qmake, so we simply write it ourself. Only neccessary on linux.

install the plugin: (paths are relative to prefix of xpertmud)

tutorial.so and tutorial.la -> lib/kde3/
Tutorial.pm -> share/apps/xpertmud/perl/
Tutorial.py -> share/apps/xpertmud/python/

now all you need is a script using your plugin.

my $healthbar=new Tutorial("Health:");
addTrigger('HEALTH','^Health: (\d+)/(\d+)',sub { ... 
   ... });

For more information about plugins, ask in the forum or on the xpertmud-devel mailing list.

Mud Resources