Previous Index


Tutorial 8: Pre-Configured Worlds 4: Miscellaneous configuration

Table of Contents


8.1 Introduction

This is the final part of a four-part tutorial, showing you how Axmud's pre-configured worlds were created. In this part we'll cover a number of things, some of which will be useful at your favourite worlds, and some of which won't. As always, you can configure the things you want, and ignore everything else.

8.2 Automatic logins

If you don't want to remember all your passwords, and don't want to type them every time you connect to a world, then automatic logins are for you!

Most people set their characters and passwords before connecting, when the Connections window is open. If not, you can add them directly:

If the character isn't visible there, you can create it in the normal way (for example, with the ;addcharacter command).

There a number of different types of automatic login covering all possible situations.

8.2.1 LP/Diku/AberMUD/TinyMUD/telnet logins

The most common login is the one favoured by LP, Diku and AberMUD worlds. The server will send you some text, followed by two prompts. At the first prompt, Axmud sends the character's name. At the second prompt, it sends the password.

Note that Axmud doesn't examine the text of the prompts themselves; any prompt wll do.

On the other hand, if you choose the telnet option, Axmud will examine the text of the prompts, expecting the first one to be login: and the second to be password:.

TinyMUD-style logins send a single prompt, and expect you to send a single command in the form connect <NAME> <PASSWORD>. In the Page 5 tab you can specify a pattern that matches a line sent when the world is ready to receive this command.

For all of these options, on Page 5 you should specify a pattern that matches a line like You have connected!, signifying success. When a matching line is received, Axmud marks the character as logged in.

8.2.2 Logins with a sequence of world commands

The world_cmd option might be useful for a public server that doesn't require passwords. When Axmud receives the first prompt, it sends back one or more commands. For example, it might be possible to 'log in' with the character name guest and password guest, in which case you would add these commands to the box in Page 5

    guest
    guest

Alternatively, you might want to automatically navigate through several menus to reach your favourite one, in which you could just send the numbers of the successive menu items:

    1
    2
    5

You could send a real name and password this way, if you really wanted to, but that is only feasible if you have a single character at the world.

    gandalf
    mysecretpassword

8.2.3 Logins with Axbasic scripts

The script (and script_task) options execute an Axbasic script which handles the login. (The task option executes an Axbasic task; writing your own tasks is outside the scope of this Section.)

On Page 5 you can specify the name of the Axbasic script to run.

If you haven't already, you should read the Axbasic tutorial, which will teach you everything you need to know about programming in Axbasic. A good login script should contain the LOGIN statement just before the END.

    REM My login script

    PEEK name$ = "char.current.name"
    PEEKSHOW pass$ = "world.current.passwordHash", name$

    WAITTRIG "What is your name"
    SEND name$
    WAITTRIG "What is your password"
    SEND pass$
    WAITTRIG "You have connected"
    LOGIN
    END

8.2.4 Logins with missions

Missions are extremely simple scripts that require no programming knowledge. They are described in Section 9

Missions are useful at worlds where logging in is more complicated than typing a password. Some worlds, for example, might want you to navigate a series of menus.

Here is a simpler example from Aardwolf, that asks you to type a name and password, and then press RETURN separately (for the third time).

    t What be thy name, adventurer
    n       
    t Password
    w
    t Press Return to continue
    > x
    ;login

To create such a mission, first think of a suitable name. Missions are available in all worlds, so the name should probably include the name of the world.

Taking each line in sequence:

When you have finished, set up automatic logins to use this mission.

8.2.5 Advanced login missions

Axmud can easily handle the situation imagined above, in which the player must login by navigating a sequence of menus. Consider this example, in which the player must choose a character by typing a number:

    Choose a character
    1. Gandalf
    2. Bilbo
    3. Sauron

These three lines would all match the following pattern. The pattern has a single group which matches the number (1, 2 or 3). The sequence \w+, if you didn't know, means 'one or more letters', so it would match Gandalf, Bilbo and Sauron.

    ^(\d+)\. \w+

Now, while the mission is running, Axmud looks for lines containing the current character's name and which also match the pattern. Let's add that check now.

In most cases, the world command to send is just the number, in which case you should add $1. You probably already know that the sequence $1 means 'the part of the line that matches the first group', which in this case is the number 1, 2 or 3.

If you were required to send a command like select 1, then the world command would be select $1. For the second or third menu item, you could use $2 or select $3.

Now we can write the login mission itself. Let's assume that the player must enter their account name and their account password, then choose one of their registered characters from a list. Here is the mission that does that.

    t Your account
    a
    t Password
    w
    t Welcome back to DeathMUD
    ;login

Taking each line in sequence:

Now, while we are waiting for the Welcome back trigger to fire, Axmud is navigating the menu as described above, finding the correct character and sending the corresponding command. As soon as the world receives the choice, it sends us the Welcome back line, the trigger fires, and the mission can complete itself.

8.3 Configuring the Attack task

The Attack task, when running, keeps track of your character's fights and interactions, updating the values stored in the current character profile. These values are often visible in the Status task window.

In Axmud terminology, a fight is a fight to the death. An interaction is some other kind of confrontation. Imagine, for example, a world where peace-loving bards gain experience not by fighting their victims, but by singing to them. These interactions can have a successful conclusion or can end in failure (just like a fight to the death).

These tabs specify patterns a large number of patterns. Most of the patterns don't do anything until you write a script. For example, the Fight > Page 1 tab specifies patterns that match a line such as You attack the troll! occuring at the start of a fight. It would be possible to write a script that uses all the patterns in this tab, creating a trigger for each one.

A few of the tabs specify patterns that are used directly by the Attack task. When you're setting up your world, you only need to add some of these patterns (and then again, only if you want to use the Attack task.)

8.4 Recognising prompts

A prompt is a line that doesn't end with an instruction to start writing a new line. Typically, a prompt requires the player to type something, for example What is your name?

It might be surprising to learn that, at many worlds, there is no way to reliably detect a prompt; Axmud doesn't know whether it has received an actual prompt, or the first half of a line whose second half hasn't arrived yet. In that case, Axmud tries to use its best judgement to guess when a prompt has been received.

The presence (or absence) of a prompt might be important in a few situations. For example, you can create hooks that fire when a prompt is received.

You can reduce the amount of guessing Axmud is obliged to do by specifying patterns that match the prompts the world sends. Many worlds use prompts that include the character's current health, for example.

    hp: 90/100  mp: 40/50  sp: 5/99 >

The pattern matching this line is

    hp:\s+(.*)/(.*)\s+mp:\s+(.*)/(.*)\s+sp:\s+(.*)/(.*)\s+>\s

If you have already created a pattern to match this line (for use with the Status task), then you can simply re-use it.

If you don't want to use complicated patterns, then a simple one like this is much better than nothing:

    \>\s$

This pattern represents a line ending with the > character followed by a single space.

8.5 Getting and dropping, buying and selling

Some of the patterns specified by the world definition aren't actually used by any built-in task or script. If you think that you might want to write a script to be used in several different worlds, then you could add some of these patterns.

For example, imagine a script that detects when someone drops something, so your character can automatically pick it up. You would need a pattern that match lines like Gandalf drops the ring. You would also need patterns that match lines like You take the ring and The ring is too heavy, so that your script would know whether the opportunistic theft was successful, or not.

The tabs inside the main Commands tab are self-explanatory, and none of them are required; add patterns there only if you need them.

8.6 The Divert and Channels tasks

The Divert and Channels tasks 'divert' messages from the main window into a separate task window. Typically, this is where all the player chat goes:

    Gandalf tells you, "Hello!"
    You tell Gandalf, "Hello to you, too!"

However, you can divert any text you like, especially if it's something important that you don't want to miss.

    There is an enormous pile of coins here.

Adding new patterns is simple enough; this is how to add a pattern matching the line just above.

There are standard three types of Channel name: tell for direct communications between two players, social for communications that many players can see, and custom for everything else. It doesn't really matter which type you choose, but note that the Divert task uses that choice to choose a background colour, and the Channels task has a different tab for each type.


Previous Index