Games-Axmud
view release on metacpan or search on metacpan
share/docs/guide/ch07.mkd view on Meta::CPAN
* Don't select **send_cmd** by mistake!
* In the **Hook response** box, copy-and-paste the mini-programme from above (including the initial forward slash character and the final semicolon)
* In the **Name** box, enter the name **myhook2**
* Click the **Add** button to create the hook
This particular mini-programme adds the word **sail** to every command, but you can change **sail** to any word you like.
If you'd prefer to add a word after the original command, instead of before it, you could use this mini-programme instead:
/my $string = ' axe'; return $hookData . $string;
This mini-programme could convert the command **get** into **get axe**, the command **drop** into **drop axe** or the command **sell** into **sell axe**.
###<a name="7.5.7">7.5.7 Redirect mode</a>
Astute readers might now be asking themselves why there isn't an easier way to convert **north** into **sail north** automatically.
In fact, there are several possible methods, including the clever use of aliases. But a much easier way is to use Axmud's *redirect mode*.
;help redirectmode
###<a name="7.5.8">7.5.8 Custom hook events</a>
Some users might want to create their own hook events. This is possible, though of limited use, since the only way to 'fire' the hook is with the **;simulatehook** command. A custom hook event has no hook data.
Custom hook events must begin with an underline character, followed by an alphanumeric character, for example **_myevent**.
To create a custom hook event, you can just create a hook responding to that event, for example
;addhook -s _myevent -p ;about
##<a name="7.6">7.6 Active and inactive interfaces</a>
As explained in detail in [Section 5](ch05.html), Axmud interfaces (trigger, aliases, macros, timers and hooks) are either *active* or *inactive*.
You can create several triggers called **mytrigger**, each belonging to a different profile, but only one of them is *active* (actually in use). The others are *inactive*.
Actually, when an interface becomes active, Axmud makes a copy of it. The copy, not the original, is the *active* interface.
You can see a current list of active interfaces from the main window menu (click on **Interfaces > Active interfaces**). If the Status task is running, the list will look like this:

There is one more important thing to explain.
If you modify the original (inactive interface), the corresponding copy (active interface) is automatically updated.
* From the main window menu, click on **Interfaces > Triggers > World triggers**
* Enable (or disable) one of the triggers you created earlier
* Now, from the main window menu, click on **Interfaces > Active interfaces**
* Find the corresponding trigger in the list. It will also be enabled (or disabled)
However, if you modify the copy (the active interface), *no changes are made to the original* (the inactive interface). Any changes are therefore *temporary* and will disappear at the end of the session.
##<a name="7.7">7.7 Exporting/importing interfaces</a>
Everyone reading his guide will be familiar with copying and pasting.
In a text editor, you can highlight some text and press CTRL + C, before pressing CTRL + V to copy it to somewhere else. In between, the text is stored in some secret place in the computer's memory.
Axmud interfaces can also be copied from one profile to another, or even from one world to another. Axmud has a not-so secret *clipboard* which stores the interfaces waiting to be copied. This single clipboard is available to any session that's open ...
Instead of copying and pasting, we talk about *exporting* to the clipboard and *importing* from it.
* Connect to two worlds (in online or offline mode)
* Click on the first world's tab, to make it visible
* From the main window menu, click on **Interfaces > Triggers > World triggers**
* Create a trigger with a memorable name
* Click on the trigger to select it, then click the **Export** button
* Now click the second world's tab to make it visible
* From the main window menu, click on **Interfaces > Triggers > World triggers**
* Click the **Import button**
* The second world receives a copy of the first world's trigger
---
[Previous](ch06.html) [Index](index.html) [Next](ch08.html)
( run in 1.067 second using v1.01-cache-2.11-cpan-84e82930d8c )