Games-Axmud

 view release on metacpan or  search on metacpan

share/docs/guide/ch05.mkd  view on Meta::CPAN

[Previous](ch04.html) [Index](index.html) [Next](ch06.html)

---

#5 Interfaces and Profiles

####Table of Contents

* [5.1 Profiles](#5.1)
    * [5.1.1 Adding profiles](#5.1.1)
    * [5.1.2 Setting current profiles](#5.1.2)
    * [5.1.3 Deleting profiles](#5.1.3)
* [5.2 Guild and race profiles](#5.2)
* [5.3 Custom profiles](#5.3)
* [5.4 The profile priority list](#5.4)
* [5.5 Interfaces in practice](#5.5)
* [5.6 Changing priorities](#5.6)

---

Axmud offers powerful *triggers*, *aliases*, *macros*, *timers* and *hooks* to enhance your playing experience. Collectively, they are called *interfaces*.

**Triggers** respond to text received from the world.

* For example, you can create a trigger to look out for lines beginning **You kill**
* When lines matching this pattern are received, we say the trigger *fires*
* When the trigger fires, it can send a world command in response
* A good world command to send would be **get coins from corpse**

**Rewriter triggers** are a special kind of trigger that modify the received text before it is displayed. (They don't send a world command, as normal triggers do.)

* For example, you can create a trigger to look out for lines containing the word **damn**
* The trigger can modify the line to replace the word with __****__

**Splitter triggers** are a special kind of trigger that split a line into two or more separate lines. Like rewriter triggers, splitter triggers don't send a world command.

* For example, *Imperian: Sundered Heavens* usually puts a room's verbose description and its exit list on two separate lines, but occasionally they appear on the same line
* The pre-configured world profile for *Imperian* moves the exit list onto a separate line, so that the Automapper doesn't get confused

**Aliases** respond to world commands, before they are sent to the world.

* You can create an alias to look out for the world command **gcc**
* This alias replaces the command with **get coins from corpse**, just before it is sent to the world

**Macros** respond when you press a certain key (or a combination of keys).

* For example, you can create a macro that responds when you press the F1 key
* When you press the key, we say the macro *fires*
* When the macro fires, it can send a world command in response
* You might create a macro to send **get coins from corpse** every time you press F1

**Timers** do something repeatedly, or wait for a period of time before doing something.

* For example, you can create a timer that fires every 60 seconds
* When the timer fires, it might send the world command **inventory**
* You could also create a timer which waits ten minutes, fires once, and then disables itself

**Hooks** respond to certain hook events.

* An example of a hook event is the one called **login**
* Every time an automated login is completed, we say the hook *fires*
* When the hook fires, it might send a world command in response, e.g. **inventory**

In the next Section we'll talk about how to create new interfaces. Because Axmud interfaces are so powerful, we first need to discuss the way they are stored, and then we need to discuss how Axmud uses special patterns called *regular expressions* (t...

##<a name="5.1">5.1 Profiles</a>

Axmud interfaces (triggers, aliases, macros, timers and hooks) often 'belong' to a particular profile.

Most of the time, interfaces belong to a world profile, which means that the interfaces are available every time you connect to that world (and are *not* available when you connect to *any* other world.)

It's also possible for interfaces to belong to a character profile, which means that the interfaces are only available when you connect using that character.

The key points to understand are these:

1. If the current world and the current character both have a trigger called **mytrigger**, only one of these triggers can be *active*
2. The other one is classed as *inactive*, which means it is ignored
3. All of this happens auto-magically. Your only concern is to make sure you have set the correct current character

###<a name="5.1.1">5.1.1 Adding profiles</a>

An easy way to add a new character profile is by using the **;addchar** command. (We've already discussed several other ways.)

        ;addchar bilbo
        ;ach bilbo

If you don't want to type the password every time you use this character, you should specify it now:

        ;addchar bilbo mypassword

You can use the following command to list all character profiles for the current world. (For obvious reasons, it doesn't display passwords.)

        ;listchar
        ;lch

###<a name="5.1.2">5.1.2 Setting current profiles</a>

Now, to make this character profile the current one, use the **;setchar** command:

        ;setchar bilbo
        ;sch bilbo

If a profile for the Bilbo character doesn't already exist, it is created. You can also use this command to set (or change) the character's password:

        ;setchar bilbo newpass



( run in 0.734 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )