This is a bit more involved. Once set up, you can use an alias to walk/run in any direction until you hit a "wall" or closed door. It does *not* involve spamming commands, so if you get in a fight you should (mostly) be fine. However, you still need to use it with care and put in some safeguards and cancellation options.
First, you'll need to create several triggers. There's probably a better way than multiple triggers, but it was faster for me to do it this way versus parsing an exits line. Here's the first one.
Trigger name:
\[Exits:.*(.)(d)own.*\]
Trigger text (Send to Script):
if speedwalk==1 and speeddir=="%2" then
if "%1" == "[" then -- don't walk into closed doors
speedwalk=0
else
Send("%2")
end
end
Options: Keep Evaluating, Regular Expression
Now you'll want to copy and paste this trigger five times and then go back and change the names of the other five. They should be:
\[Exits:.*(.)(e)ast.*\]
\[Exits:.*(.)(n)orth.*\]
\[Exits:.*(.)(s)outh.*\]
\[Exits:.*(.)(u)p.*\]
\[Exits:.*(.)(w)est.*\]
For good measure, add a trigger with the name:
Alas, you cannot go that way.
And the text (Send to Script):
speedwalk=0
Keep in mind this script is smart enough that you will stop speedwalking when the exit isn't visible in [Exits] or it is closed, but we want the "Alas" trigger there as a safeguard.
Now that the triggers are in place, we need an alias or two. The first one will be the walk alias itself. I'm using w as the alias letter, so I get commands like ww for speedwalk west, wn, ws, etc. The alias name should be:
^w(n|s|e|w|u|d)$
And the text (Send to Script):
if speedwalk==0 or speeddir~="%1" then
speeddir="%1" -- set direction
if speedwalk==0 then
speedwalk=1
Send("%1")
end
else
speedwalk=0 -- toggle off
end
Check the Regular Expression option. So what this will do is start you walking in the direction you specify and rely on the triggers to keep you walking. What happens if you suddenly need to stop? GOOD question. If you are like me and you leave the previous command in the MUSHclient input, all you need to do is push ENTER when you need to stop. If you have a good reaction time, you will typically only overshoot by one room. IF YOU START FIGHTING, you will want to stop the speedwalk so you don't start walking once you move out of the room. Push ENTER to cancel the speedwalk before inputting your first command.
There are two other safeguards we should implement. First, let's add a generic line to disable speedwalk with the use of some common commands. Add the alias:
^(i|l|n|s|e|w|u|d)$
With the text:
speedwalk=0
Send("%1")
Check the Regular Expression option. What this will do is cancel speedwalk with a few of the simply 1-letter commands, as well as enable you to do things like ww;n;ww. Notice that if you type ww;ww the second ww will simply cancel out the first. Logically, you shouldn't be able to run west any more if you hit a wall. BUT, if you just moved north, the speedwalk is cancelled and you can go ww again.
The second safeguard you can implement is one that reads your prompt's position and immediately cancels speedwalk if it is "fighting". I've done this, but my prompt reading scripts are a subject for another day.
One other thought I had was adding a timer that automatically cancels speedwalk when it hasn't seen an exits line for 2-3 seconds. But so far what I have is working fine as it is.
If you want to have fun testing this, role a new character and type wd.
Edited 2 time(s). Last edit at 12/08/2011 08:44PM by joecloud.