| Message |
In some MUDs you may find that as you go north, south or whatever, you find a closed door, that you need to open. You can make MUSHclient automatically open these doors for you, with a little work with aliases, triggers, and a small script...
Step 1
First we need to know which direction we are walking. Let us assume that we are using the numeric keypad to navigate (ie. press "8" to go north, "2" to go south, and so on).
We need to have an alias fire as we walk, so we know which way we were heading, so using Configuration -> Keypad (Shift+Ctrl+1), change each of the directions to have "keypad-" in front of them, like this:
8: keypad-north
2: keypad-south
4: keypad-west
6: keypad-east
... and so on, doing the same for ne, nw, se, sw, up and down.
Step 2
Make an alias that will match on these new commands.
Press Shift+Ctrl+9 to see the alias list, and press "Add".
Type the following details into the new alias:
Match on: keypad-*
Send: %1
Label: keypad_navigation
Script: OnKeypadDirection
Sending %1 will send the actual direction to the MUD, so if it matches on "keypad-north" it will send "north" to the MUD.
Step 3
Add a script subroutine to your script file, to set a variable which remembers which way you last walked ...
VBscript
Sub OnKeypadDirection (strAliasName, strOutput, arrWildCards)
world.setvariable "direction", arrWildcards (1)
End Sub
JScript
function OnKeypadDirection (strAliasName, strOutput, wildcardsVB)
{
wildcards = VBArray(wildcardsVB).toArray();
world.setvariable("direction", wildcards [0] );
}
Step 4
Make a trigger that detects if the door is closed.
Press Shift+Ctrl+8 to see the trigger list, and press "Add".
Type the following details into the new trigger:
Match on: The door is closed.
Send: open @direction
Expand variables: checked
Step 5
If desired, make another trigger for locked doors.
Add another trigger, and type the following details into the new trigger:
Match on: The door is locked.
Send: unlock @direction
Expand variables: checked
Step 6
If desired, make another trigger for doors that you don't have a key for.
Add another trigger, and type the following details into the new trigger:
Match on: You don't have the correct key.
Send: pick @direction
Expand variables: checked
All done!
You are now ready to wander around without worrying about locked or closed doors! :) |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|