Building a Basic Dream Bot

by the skullkitty (10th May, 2007 @ 1:24 pm)

FurBot: Main Window Every dream needs a bot. Well, this probably isn’t strictly true but bots can definitely add some ease-of-use functionality to your dream, particularly with their ability to auto-summon players. They’re also useful for various other sneaky dream maintenance tasks like logging visitors, and acting as a kind of ‘messaging service’ for people to leave comments about how awesome your dream is.

The good news is that bots are not hard to make. In fact, by the end of this post you will not only have a bot that does all of the above, but will also hopefully become familiar enough with the interface to extend its functionality to suit your own dream. So let’s get started.

First off, you’re going to need to download FurBot. Originally developed by sanctimonious, it is probably the most popular bot client currently running in Furcadia. As a bonus to anyone experienced with dreamweaving, the command scripting interface is fairly similar to the DragonSpeak editor, which is always nice.

Okay, so go download FurBot and run the installer. I’ll wait here until you get back…

… okay great. Now it’s time to open the client. You should be presented with a window similar to the one above. We don’t currently have a bot open, so it’s a good idea to create one straight away (it’s highly likely that you will crash the client, so remember to save early and save often). The first thing we need to do is check some settings, so go File > Configuration. In the configuration window, make sure the following information is filled in:

FurBot: Configuration

Obviously make sure that the Furcadia client program points to your Furcadia.exe application. There’s also a caveat here with the Who Is Online Detection setting; I can never make this work by simply ticking the box (it always unticks itself). Instead, change the number in the Execute map Who every box and hit Save. You can tell if the WhoIs is working (and we will need it) because — once connected to Furcadia — the results will appear in the log message on the main FurBot screen. But we’re getting a bit ahead of ourselves.

FurBot: Bot

Next we need to turn on the parts of our bot that we will be using. Bots can perform several different tasks:

  • Actions are triggered when the bot ‘hears’ another furre. Whispers, speech and emits can all be triggers for actions.
  • Filters don’t actually make the bot ‘do’ anything. Instead they govern what data is recorded in the logs and presented in the main bot window.
  • Timers cause something to happen after a certain period of time has elapsed.
  • Triggers are a bit like actions but are (a-har) triggered by non-speech events.
  • Finally, who detection commands manipulate data returned by the bot’s `who tick.

We are going to be using actions, triggers and who detection, so make sure these three options are ticked.

Our next step is to actually make a character to use as our bot. Boot up the Furcadia client and make a character in the usual way. I’ve called mine F!W Test Bot. Get it into the game and park it somewhere reasonably private (preferably a private dream). Remember, that while bots are legal on Furcadia they are still governed by the same rules as normal players. It’s highly likely that at least once you’ll end up making your bot do something stupid (such as spam random text), so it’s best to put it somewhere it won’t bother other users (and they won’t bother it). Once you’re happy with your spot, log out of the client.

Back in FurBot, Click the Edit button under Current bot.

FurBot: Edit Bot

From this window, click Load from .INI… and select the .ini file for the bot character you just made. Make sure all the details are correct, and press Save.

FurBot: The BotNow we save the bot (File > Save bot). Make sure to put it somewhere you’ll easily find it again; I put mine inside My Documents/Furcadia/Bots. Now it’s time to connect the bot to the game, so from the main FurBot window press Connect. If all is well and good, the Furcadia client should open up and your bot should appear on the screen, standing wherever it was when you logged it out. Assuming you’ve set FurBot’s options correctly, after a few moment a message should appear in the client window telling you that you may close the client (that’s Furcadia, not FurBot). Do so. If you look back at the FurBot window, it should still appear connected. The easiest way to tell is to look at the icon in the system tray (next to the clock); if the traffic light is green, the bot is online. Also make sure that your bot is who’ing appropriately; you should see the output of the who appear in FurBot’s log every now and again. If it doesn’t, open back up the configuration window and change the time increment until it starts.

FurBot: Edit TriggersOkay, so we’ve got a bot but it doesn’t actually do anything at the moment. Time to fix that. First off, we’re going to make it auto-summon. Open up the Editing Triggers window and click Add. Fill in the details as shown. To get the Editing Effects pane open, click Add underneath the the ‘then’ textbox. To save the trigger, click Save, then Update, then Save Changes (and yes, it’s convoluted; I ‘drop’ rules all the time due to mis-clicks!).

FurBot: Join Bot 1
FurBot: Join Bot 2

Once you’ve clicked save (or Apply) in the triggers window, save your bot again. Now it’s time to test your rule. Boot up Furcadia again and open a different character. Request to join your bot; hopefully, you should be instantly whisked away to its location!

FurBot: Log Arrivals FurBot: Log Departures

Now we’re going to make the log arrivals and departures rule. For this, we’re going to need open up Edit Who Detection. In a similar way that you created the auto-summon trigger, fill in the WhoIs window as above. This time we’re making two separate rules, so you’ll have to go through the process twice. You’ll notice we’ve got some words in square brackets. These represent variables in FurBot. A variable is a word that, when the script is executed, will be replaced with another value. There are quite a number of internal FurBot variables (full details can be found on the website), and you can define your own using WolfScript, but for now the ones we’ll be using are as follows:

  • [DATE] will be replaced by the current date in US format (mm-dd-yyyy).
  • [TIME] will be replaced by the current time (24-hours, no seconds).
  • [PLAYER] will be replaced by the name of the furre that triggers the script (in this case, the furre entering or leaving the dream).
  • [APPDIR] will be replaced by the path to the directory where the bot is run from; usually the FurBot install directory. You can replace this with a hard-coded path (i.e. to the folder where you saved your bot).

You’ll also notice that where it says If _______ comes to the map we have an asterisk (*) in place of a name. The asterisk is what’s known as a wildcard character, and in this case it will match anything. You can, of course, put an actual name in this space however that would mean the script was triggered only when that furre entered the dream. Since we want this to log everyone, we use the wildcard.

Save your two new detections and it’s time to test them out once more. To do this, simply leave and then re-enter the dream containing your bot (or, if you’re on a public or otherwise popular map, just let it run for a while). Note that FurBot gets its player information on each tick of the `who command, so it’s theoretically possible to jump in an out of a dream quickly enough to not be ‘detected’ by the bot. If you’re having a problem with ‘missing’ players in this fashion, you can simply set the who tick to a shorter duration. Anyway, when you think you’ve got a few records, open up your visitors.log file from wherever you decided to save it (it’s a plain text file, so opening it with Notepad is okay). If all is well, you should see some lines that look similar to:

"05-10-2007 12:04 IN Loki|Laufeyjarson"
"0"
"05-10-2007 12:06 OUT Loki|Laufeyjarson"
"0"

Don’t worry about the numbers in the quotation marks for now; these are markers for more complex log manipulations by FurBot.

FurBot: Whisper Reply FurBot: Whisper Log

We’re almost done. The final thing we want out bot to do is reply to anyone who whispers it, and to log their message in a file so we can read it later. Open up Editing Actions and create a new action as follows. This action has two parts to its Then clause instead of the one we’ve previously been using. The first one replies to the whisperer (note that to get the ‘large’ editing text box, simply double-click in the small text box normally provided). If you want to insert your own dream URL into the message as opposed to F!Ws (though of course we wouldn’t say no to the publicity), you can use [DREAMURL]. Note that this will take the last dream retrieved from `who, so it will only work if your bot is sitting in your own dream.

The next part of the rule we’re going to add will log the message that was whispered to our bot; this is similar to what we did for logging arrivals and departures, except this time our 0 Record Name line looks like:

[DATE] [TIME] [PLAYER]: [MESSAGE]

[MESSAGE] is another internal variable which returns the message from the triggering player (more technically, it’s everything after the first space character).

FurBot: Auto-Reply

Save your new action (and your bot) and test it out by booting up Furcadia and whispering your bot. You should get a response back, and your whispers.log should record the message.

And that’s it! Congratulations, you’ve successfully made a very simple yet hugely useful dream bot.

More…

Popularity: 32% [?]