|
batman2227 Beginner
Joined: 19 Nov 2002 Posts: 25 Location: USA
|
Posted: Wed Jul 09, 2003 9:15 pm
Help with direction capture |
Hi, I am trying to capture directions from my MUD, Achaea, not for any particular purpose, more just for learning from ZMUD. I scoured the forums for scripts similar found many of them, btw thank you Zuggsoft for the new forum search engine! I looked and learned a lot from them, but have come to the following problem, and would love some ideas on how to get around it. Here is my MUDs output for exits:
You see exits leading southeast, south, and northwest.
You see a single exit leading north.
You see exits leading north, east, south, and west.
You see exits leading north, east (open door), south, and west (open door).
You see a single exit leading east (open door).
Here is the script I am using:
#CLASS {ExitCapture} {disable}
#TRIGGER {You see exits leading (*).} {#var exitstring %replace( "%1", ",", "|");i = 1;#forall @exitstring {#if (%pos( "(closed door)", %i)) {#delnitem exitstring @i};#add i 1};exitstring = %replace( @exitstring, "(open door)", "");exitstring = %replace( @exitstring, " and ", "|");exitstring = %replace( @exitstring, " ", "")}
#TRIGGER {You see a single exit leading (*).} {#var exitstring %replace( "%1", ",", "|");i = 1;#forall @exitstring {#if (%pos( "(closed door)", %i)) {#delnitem exitstring @i};#add i 1};exitstring = %replace( @exitstring, "(open door)", "");exitstring = %replace( @exitstring, "and", "");exitstring = %replace( @exitstring, " ", "")}
#CLASS 0
Sorry that looks a lot more complicated than it really is. Basically, the big problem I am having is to be able to accurately capture rooms that have only two exits, I had to "trigger" off the and. This leads to #echo output such as this:
east|south||west
aka an empty position, with any other rooms, due to it replacing both "and" and the "," with |. Is there a way around this? I tried triggering ", and" to return a null value in replace, but it didn't work. Any help, and more importantly an explanation, would be greatly appreciated. Thanks for your time. |
|
|
|
batman2227 Beginner
Joined: 19 Nov 2002 Posts: 25 Location: USA
|
Posted: Wed Jul 09, 2003 9:25 pm |
Here is the script I based mine on, I can't remember who it belongs to, but whomever it is, thank you. I just added a replace for "and" to set it to "|". Should look a little cleaner, and easier to read
#tr {You see exits leading (*).} {
#var exitstring %replace( "%1", ",", "|")
i = 1
#forall @exitstring {
#if (%pos( "(closed door)", %i)) {#delnitem exitstring @i}
#add i 1
}
exitstring = %replace( @exitstring, "(open door)", "")
exitstring = %replace( @exitstring, "and", "")
exitstring = %replace( @exitstring, " ", "")
}
Hope it helps. |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|