|
Huu Beginner
Joined: 10 Dec 2002 Posts: 15
|
Posted: Thu Jan 27, 2005 12:49 pm
Trigger pattern to match multiple blank lines |
I have a problem with creating trigger pattern to match more than one blank lines. I created these triggers for testing (ZMud 7.05):
#TR {^$} {#SHOW ONE BLANK} works well
#TR {^$^$} {#SHOW TWO BLANKS} isn't working anymore.
Any ideas? Thanks. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Thu Jan 27, 2005 2:13 pm |
#TR {^$} {#SHOW ONE BLANK}
#COND {$} {#SHOW TWO BLANKS} {Within|Param=1} |
|
_________________ LightBulb
Senior member
Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious. |
|
|
|
Huu Beginner
Joined: 10 Dec 2002 Posts: 15
|
Posted: Thu Jan 27, 2005 4:05 pm |
Seems that I must describe my case a bit. I want to find the room in the area and set the position on the map with #TELEPORT command.
The output I get from mud:
Teleporting...
Sunrise
[Exits: north south]
It means:
<teleportmessage>
<room name>
<blank line>
<exits>
The room name (for mapquery) and exit information (to compare exits if there are rooms with the same name) is all I need and the following trigger is working in general:
#TR {Teleporting...} {#CO WHITE}
#NOOP get room name right after teleport message
#COND {^&RoomName$} {#NOOP} {within|Param=1}
#NOOP get exit information 3 lines after teleport message
#COND {~[Exits: &{ExitsRaw}~]} {findroom} {within|Param=3}
The problem is that there are some rooms without room name. It means that the following output is also possible:
Teleporting...
[Exits: north south]
My trigger isn't working in this case - exit information isn't captured. So what I want is trigger(s) that is working in both cases. My first idea was just to create 3 special triggers for every 3 rooms without room name in the area (they have different exit information) - something like:
#TR {Teleporting...^$^$^~[Exits: east~]} {<teleport to nameless room1>}
#TR {Teleporting...^$^$^~[Exits: south~]} {<teleport to nameless room2>}
#TR {Teleporting...^$^$^~[Exits: north east~]} {<teleport to nameless room3>}
But this is not working. Also it seems that I cannot create 4 conditional triggers with same pattern but different conditions to handle all 4 cases.
Is there a way to set up conditions so that room and exit information are matched for both outputs I described above? |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Jan 28, 2005 1:01 am |
Yes, it's always better to give the real problem. I believe this will do the trick.
#TR {Teleporting...} {#CO WHITE;#VAR RoomName ""}
#COND {(*)} {#VAR RoomName {%1}} {LoopLines|Param=1}
#COND {~[Exits: &{ExitsRaw}~]} {findroom} {Within|Param=3} |
|
_________________ LightBulb
Senior member
Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious. |
|
|
|
Huu Beginner
Joined: 10 Dec 2002 Posts: 15
|
Posted: Fri Jan 28, 2005 9:11 am |
Your solution is working fine, problem solved :) Thanks!
|
|
|
|
|
|