The Bean Java Mud Client
The Bean was last updated on January 15 2006 14:15:17.
Quick start:
- If you are using Windows, and are not sure whether or not Java is installed on your machine, download the setup file
- If you already have Java 1.4, and want to use Java web start (allows you to get automatic updates etc), use this link (this may give you a security warning and you will have to click "Yes" to be able to play)
- If you already have Java 1.4 but can't or don't want to use Java web start, download this jar file and either double-click it (on Windows) or run the command "java -jar thebean.jar" (on Unix). This should work on Mac too
- If you want to play from your web browser, try the applet (some features are not available on the applet, though).
NOTE: Speedwalks are working now, and I have put a setting file on the server - simply use Load (in the file menu), select "Load Settings from Mud server" and fill the character name and the password to both be "thebean". Or, download this settings file.
This is The Bean, a mud client that I hope will be powerful and easy to use at the same time. It's getting pretty good, I am actually using it as my main client now. In this page I will attempt to explain how to use it, although I have been told my instructions always look like Japanese VCR instruction manuals. I hope this will be an exception.
Content
- About The Bean
- How to run (and download) it
- How to use it
- Regular expressions primer
- Ruby primer
- Tips and FAQs
- News
- Coming soon...
About The Bean
The Bean is a new Java mud client that I (Beanie, one of Netherland's admin and coder) am currently developping. It is designed to be:
- highly scriptable, without using a clumsy, ad hoc scripting language: to this end, a Ruby scripting engine is integrated in the applet. Ruby is a nice little language that fits perfectly as a helper for a mud client, because it has awesome text processing capabilities.
- easy to extend: there is a plugin framework that makes it easy (for me) to add extensions. This is not (yet) accessible to the user, although it should eventually be possible to write plugins in Ruby
- runnable from anywhere: the settings can be saved on the mud server (obviously this requires that the mud server support this). The program can be used as a stand-alone application as well as an applet.
- stable: no crash, no feature bloating - this is a mud client, not a freaking chat/editor/encrypter.
Personally, the one that I like the best is that wherever I am, friend's computer, library, etc, I can just load the client and use my remote settings.
The Bean is free to use and redistribute, but you must understand that there is no warranty associated with this program. The source code may also be downloaded and redistributed under the conditions of the GNU General Public License (GPL). This license contains some information (in lawyer dialect). Running the program implies your agreement with the license. Also note that The Bean include software developed by the Apache Software Foundation, released under this license, and jruby, which is released under the GPL or the LGPL license (at your choice) - that's it for the mandatory legal blurb.
For any question or comment you can contact me by email at: ngaller at gmail dot com, or contact Beanie on Netherland (netherland.ath.cx:3666).
How to run it
The easiest way (at least on Windows) is to follow the link at the top (for Java web start). However, if you run into problems because you don't have the right version of Java, or if you want to run The Bean in restricted mode (as an applet), read on.
The Bean needs a recent version of the java plugin (or runtime environment). I haven't done any testing on Java under 1.4 (but it does work under version 1.4.0). This can be downloaded (for free) from Sun's website: on that page, select the J2SE button, then click on the J2SE Downloads tab, select whatever highest version is available (1.4.2, at this time), scroll down to Download J2SE and pick the one that correspond to your platform (take the one in the JRE column, NOT the JDK, unless you want to do Java development). This will install the java plugin, if you have windows and pick the first one (Windows Installation) it will ask you if you want it registered with your browser etc (so if you have windows, do that).
Once you have the Java runtime environment installed, you can run the applet (this is rather big, will take a long time to download if you are on a dial up connection). When loading, the applet will ask if you want to grant permissions. This is needed if you want to be able to save your settings to local files, or to connect to another mud than Netherland. If you don't need this, say NO, as it is more secure (saying Yes allows the applet to modify your hard drive, so essentially you'd have to be trusting me not to harm it, intentionally or not).
Once you get the applet running, I recommend using the Detach command (in the File menu) to get it in a separate window. You can also use the program as a standalone application (this looks a bit prettier and may be a bit faster as well), just download thebean.jar and double-click it (on Windows, on other OS you might need to run "java -jar thebean.jar") or maybe select "Open" instead of "Save As" if you are asked that (remember, you need to have a recent Java installation! I recommend just getting the latest one since I am told there are a lot of performance improvements).
If you are interested in improving the client you are welcome to download the source code and do so (respecting the terms of the license regarding the copyrights etc). Download thebean_src.zip for the source.
Using The Bean
Getting started
To start, go to File, select Connect (note - the Java system will initialize a bunch of component at this point, so it may take a few seconds to respond).
You might want to change the colors and font used, in the Options/Style menu. There you can change the background, the font, and the colors used for the text sent by the mud - they all have a name which is the "Standard" color name, but nothing prevent you from making the "white" color appear black. The default settings work pretty nice on a black background.
Settings
To change the settings (aliases, triggers etc) go to the Settings option in the menu. You have:
- the aliases (this should be used for speedwalks to)
- the triggers (the pattern there is a regular expression. See the regex primer if you don't know what that means
- the hotkeys (aka macros)
- the speedwalks - use the speedwalk tab in the settings to write speedwalks from a dir file, or to replay/reverse speedwalks, and the Speedwalk recorder to record speedwalks.
Styles
If you click on "Styles" in the Options menu you will get to the Styles options (well that makes sense). As I wrote above you can change the colors here to whatever you like. I personally prefer a black background and I make the bold colors brighter, but that's a matter of taste.
In the same box you can set the font. It is probably best to use a fixed width font such as Courier and refrain from using the Bold or Italic options.
If you're like Tatiana you might want to size the window of the bean only once, and click on the "Save Window" button in that box to save it. This will save the position and size of the window so that it will be restored when you load the settings. Pretty useful if you like to tile the windows (to play 2 muds at the same time maybe).
Preferences
The last item in the Options menu is "Preferences". The "Limit send rate" option is there to help avoid flooding the mud (which usually results in being disconnected), the default of 12 is probably OK. If you want to be beeped you will need to turn on the Bell option there. On Windows you won't hear the beeps unless you have speakers.
Saving and loading settings
You need to use the Save and Load options of the File menu to save and load your settings. This will pop up a box asking you where to Save (or Load). At the top of this box, there is a drop-down list asking which method you want to use: save to local file, or store on mud server. If you store your settings on the mud server, you will be able to play from another computer without having to transfer them (also, this is the only way you can save your settings if you are running your applet in restricted mode, as recommended). Just enter the server and port that the mud is running on, and the character and password that you want to save the settings under (hint: if you want to have shared settings for all your chars, nothing prevents you from playing as one and saving your settings as the other...) You can only store your settings on a mud that supports it (which probably means, only on Netherland - you can make a char on Netherland and use it to store your settings, but play on another mud, though)
If you want to switch char, or reload your settings, it is recommended that you close the window and open a new one, as it has been reported that reloading settings in an active window sometimes failed.
Converting settings from other mud clients
To do.
Using ruby
Read the ruby primer, first.
The text that you type in the client is interpreted as a Ruby string. Let's take a few example:
| You type | Sent to the mud |
| say hello | say hello |
| say #{1+1} | say 2 |
| say #{a=1;a} | say 1 |
| #{a=1+1;''} | (nothing is sent) |
| #{$session.processUserInput('hello');''} | hello |
| #{if 2 < 3; "say hello"; end} | say hello |
| #{if $1.to_i < $2.to_i * 0.9; "cast heal"; end} | cast heal (if $1 < 90% of $2) |
You get a few pre-defined variables:
- $session is the session object (this gives you access to almost everything)
- when a trigger is matched, the match variables are defined ($1, $2, etc) (read the regex primer) - the last command (contributed by Bruce) in the table above uses that after capturing max and current hp. The .to_i on that line is needed to tell Ruby that you want a numerical comparison.
Regular expressions primer
A regular expression (regex for a short, more geeky sounding term) is a description of a pattern (remember the "*.doc" that you have to type when you are looking for all the doc files on your computer? well, this has the same purpose, only it's much more flexible). Regex look very scary if you don't know them, but they are quite easy to understand (well, the basic ones are) if you just try to "think like the machine" (for a little bit).
You have to take the regex character by character, and see what it describes to the computer. It is really an instruction sheet telling it how to make a match. I'll take a few examples and hopefully that can be enough, otherwise just make a search for "regular expression primer" and I am sure you will find a bunch of them. That don't look like japanese VCR manuals, damn you seasick :)
- If you include only "normal" characters, the regex will match whatever you type. For example, /You are hungry/ will match that text (the slashes are not part of the regex, they are just used as delimiter, just like quotes around a string).
- Let's take the regex /^You disappear into the void/. I am not going to put every regex on a line by itself because I dont want this site to be 3 km long and scare the crap out of you, so there may be line breaks sometimes, just watch for the slashes. The ^ sign at the beginning tells the computer that this can only be matched at the beginning of a line. So if a line that starts with "You disappear into the void" is received, this will be a match
- Let's take the regex /./. The "." character is a wild card, it can match any one character. So any non-empty string would match there.
- Let's take /.* has raised a level/. The * means, "match 0 or more of whatever precedes me". In this case, what precedes the * is a ., that can match any character. So this regex would match "Beanie has raised a level". It would also match, " has raised a level" on a line by itself, because the * means "ZERO or more" (haha). If you want to avoid that, you would have to use /.+ has raised a level/ because the + means, "1 or more of whatever precedes me". But this is still not really good because it would also match, "Beanie chats ' has raised a level'". You would have to use, /\w+ has raised a level/, because "\w" means "any letter". Now to have something really complete, you'd do /^Info> \w+ has raised a level/. Okay but I can never remember if there is one or two spaces after the Info>, so I will do /^Info> ?\w+ has raised a level/. The ? there means, "match 0 or 1 of whatever precedes me" (a space, in this case). If you are still not lost you are turning into a geek. You have probably been mudding too long.
- What about, if I want to know what has been matched? Eg let's say I want to do a cheesy levelling trigger. Let me take the regex of the previous paragraph: /^Info> ?(\w+) has raised a level/. What did I add? Well I'll tell you, since you didn't notice. I put the \w+ between parentheses. This will "capture" the match, and make it available (in Ruby) as the $1 variable (it's 1 because it's the first match). So I can have my trigger text be "chat Gratz to you, #$1" (the # in Ruby is used to make substitutions in a string, #$1 being a shortcut for #{$1}).
- OK what about a chain trigger. I'll make the pattern, /^(\w+) offers you (his|her|its) (left|right) hand/. This vertical line symbol (in a US keyboard it's the symbol above the backslash key) is called a pipe by geeks, and it means "or", so (his|her|its) means "his" or "her" or "its" (and you have to use the parentheses to group that). The text there will be, "chain #{$3 == "left" ? "right" : "left" } #$1" (on one line, the spaces matter too). The ? there is a rather weird operator that means, if the previous expression (in this case, $3 == "left") is true, select the first argument (in this case, "right"), otherwise select the second (in this case, "left". Thus it is really equivalent to if $3 == "left";"right";else "left";end. If you can understand this without mental strain, you should consider a career in computer programming, otherwise just type that in (you must also say "damn all geeks to hell" between your teeth, otherwise it won't work). If you like it you should definitely learn the Ruby programming language, because you will probably enjoy that too.
Ruby primer
If you want to really learn the basics of ruby, you should go visit its home page. If you just want to get started so that you can make mud scripts, read on.
Ruby is a nice little language, it looks a bit like Perl, but is object-oriented, which makes it perfect for this mud client. The most interesting part though for us is the text processing capability. A Ruby "string" is a piece of text (the name comes from "string of character" because the character are strung together and computer scientists have a liking for obscure terms). You can interpolate expressions using the # sign and curly braces. Ruby is really cool for that because basically anything is an expression, for example: if false; "hello"; else "booya"; end is an expression, evaluating to the string "booya" (ok this was a bit geekish, so if you didnt understand dont worry about it).
Most of what you'll want to do in a mud script is react on triggers. First read the regex primer. Then remember that the match variables will be available as $1, $2, $3 etc (in the order they are matched). Then use those in the text.
Tips and FAQs
I have collected remarks from The Bean users here. If you run into a problem, just e-mail ngaller@gmail.com, I'll answer you and add it here.
- To read the MUD news, type "News" with a capital N, otherwise it will be read as a path
- You do have to load your settings every time, and you have to enter the char name and password there and to log on the mud... this is to allow you to use the same settings for different characters, or to play on a different mud that the one you store your settings on.
- For the ability to use keypad keys as directions, you can define hotkeys (those are pre-defined in the default settings - load those from netherland.ath.cx using "thebean" as username and password).
News
- Added ability to turn local echo on/off (in the Preferences menu)
- Logging added (go in Tools>Log)
- Fixed a few bugs with the settings and added some info about styles and preferences
Other planned features (aka TODOs)
Stuff that is being worked on:
- Variables (Ruby globals saved with settings)
Stuff that would be nice to have, in the future:
- Setting importer/exporter to convert settings to and from other mud clients
- Clickable links in main window to launch browser (when something that looks like a URL is received)
- Documentation for plugin interface via Ruby (and test)
- Plugin manager to select active plugins at runtime
- Remove the CommandList class and integrate MenuList/MenuCommand with Java Commands (needed to have checkboxes in menus etc)
