Assuming your MUD always displays the room exits with the room description, doesn't use MXP to display room exits and doesn't have a "backwards" exit, you'll first want to make a trigger that captures the available exits, parses them and stores them in a variable.
If your mud gives you:
Exits: South, southeast, and southwest.
You need to match "Exits", take the exits, and throw away the "and" and the "." You probably want to get rid of the spaces or the commas as well, to give you a variable that's either a bunch of exits separated by spaces, or by commas.
<triggers>
<trigger
enabled="y"
match="^Exits: (.*)."
regexp="y"
send_to="12"
sequence="100"
other_text_colour="black"
other_back_colour="black"
>
<send>temp=replace("%1", "and ", "")
temp=replace(temp, ",", "")
world.setvariable "exits", temp</send>
</trigger>
</triggers>
If your MUD sends exits differently, you'll have to modify either the match line, or the code a leetle bit. It depends. :)
Secondly, you'll either want to make a trigger to detect when you're low on hitpoints and make it send a direction from the list. Or you'll need to add a bit to your existing score script if you've got one.
<triggers>
<trigger
enabled="y"
match="<Hp: (.*?)/"
regexp="y"
send_to="12"
sequence="100"
other_text_colour="black"
other_back_colour="black"
>
<send>if cint("%1")<=100 then
world.send split(world.getvariable("exits"), " ")(0)
end if</send>
</trigger>
</triggers>
This will match a mud that sends a score line like If yours is different, you'll have to alter the "Match" line to take account of that.
One thing to note is that this will always send you in the first direction listed. If you're a purist and want to make it random, you'll have to alter the world.send line.
Hope this helps. :)
-I- |