Skip to content

Simple Plugins

James Seward edited this page Jun 4, 2016 · 2 revisions

Simple plugins match a line of text on IRC. They fire with a given probability. They have a list of possible responses, and if they fire they pick one and output it.

Simple plugins are defined in BMOTION/plugins/LANG/simple_*.tcl (where BMOTION is the directory bMotion is installed in, and LANG is the current language - probably en).

Writing your own

To write your own simple plugin you should first create a file in BMOTION/plugins/LANG/ called simple_SOMETHING.tcl. SOMETHING can be whatever you like and has no bearing on the plugin(s) you put in the file. Maybe your name is a good choice :)

In your file, put a line like this:

bMotion_plugin_add_simple "somename" "some text" 100 [list "a response"] "en"

This line all all you need to define a working simple plugin!

There's a plugin generator at http://sakaki.jamesoff.net/bmotion_tools/generate_simple_plugin.php which you can use to make the line of code you need.

The syntax is:

bMotion_plugin_add_simple <friendly_name> <trigger_text> <probability> <output_list> <language>

  • friendly_name is just a name used to refer to the plugin. It shows up in e.g. .bmotion plugin list.
  • trigger_text is a regular expression to match the line. Note that this is a substring match - it doesn't have to match the whole line, only part of it. If you want it to match the whole line, put ^ at the start and $ at the end.
  • probability is a whole number from 0 to 100. The higher the number, the more likely the plugin will fire when trigger_text matches.
  • output_list is a TCL list of bMotion abstracts. See below for an important note, and see Output Macros for what can go in here.
  • language is the language the plugin should be valid for. Use en for English, or all if your plugin is valid in any language.

Once your plugin file is saved, you can .bmotion rehash your bot on the partyline. After it's rehashed, you can check it loaded with .bmotion plugin list and looking for your plugin's friendly name. Then just say the trigger text on IRC!

The output_list must take this format: [list "thing1" "thing2" "thing3" "and so on"]. If you only have one thing, you must still use the [list ...] syntax!

Clone this wiki locally