|
Josiah.Bruns Apprentice
Joined: 04 Mar 2007 Posts: 103
|
Posted: Mon Mar 05, 2007 10:38 pm
Trying to capture exits to make a robot mapper |
The following is the text from my Mud.
Quote: |
l <- L is the command for look
The Royal Walk ends here at the Iron Portal, which rises above the city wall
with brooding stoutness. Guards patrol the battlements of the portal
underneath fluttering banners proclaiming the might and grandeur of Farcaern.
The Walk becomes Kortal Road as it passes through the Portal; Coppergate leads
east and west along the inside of the wall. Sturdy doors to the northeast and
northwest lead into the twin towers of the Portal.
-- There are six obvious exits: north, south, west, east, northwest and
northeast.
>
s <-- S is the command for south
The Royal Walk continues here, through the heart of the city. The great
Cathedral raises its lofty spire some distance to the south. The massive
stoutness of the Iron Portal is visible to the North.
-- There are two obvious exits: north and south. |
Code: |
#TRIGGER {^-- There [is|are] (%w) obvious [exit|exits]: }
{
#CAPTURE 2 Exits
#Show %ansi( yellow, bold)%1 %2 %3 %4 %5 %6 %7 %8
} |
the problem i am having is that i can't seem to write a trigger that will catch the second line of exits and not fire off and catch the first line of exits as well.
I tried having two triggers like the ones below.
Code: |
#TRIGGER {^-- There [is|are] (%w) obvious [exit|exits]: (%*).}
{
#CAPTURE 2 Exits
#Show %ansi( yellow, bold)%1 %2 %3 %4 %5 %6 %7 %8
}
#TRIGGER {^-- There [is|are] (%w) obvious [exit|exits]: (%*)$(%*).}
{
#CAPTURE 2 Exits
#Show %ansi( yellow, bold)%1 %2 %3 %4 %5 %6 %7 %8
}
|
I also tried to make one like this:
Code: |
#TRIGGER {^-- There [is|are] (%w) obvious [exit|exits]: [(%*).|(%*)$(%*).]}
{
#CAPTURE 2 Exits
#Show %ansi( yellow, bold)%1 %2 %3 %4 %5 %6 %7 %8
}
|
This one didn't work either.
Then i tried making one trigger with different states and i think i totally screwed that one up it was like firing every other time.
My utilmate goal is to do this:
1. glance <--this gets rooms short name (somehow tag that for the mapper)
2. look <--this gets the room description and exits as shown above (somehow tag room description and links for the mapper)
3. decide which way to go.
4. move that way
5. check to see if i succeeded in moving that way
6. repeat steps 1-6 |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Mar 05, 2007 11:28 pm |
Firstly, you need to use {} rather than [] when listing alternate patterns - {is|are} is what you're after. Secondly, it's not %*, it's just *. Also, I'm not sure what you're doing echoing up to %8 when there aren't eight captured wildcards in the trigger and never will be.
Try something like this:
#trig "ExitTrig" {^-- There {is|are} (%w) obvious {exit|exits}:} {#if (%rightback(%line,1)=".") {#state ExitTrig 0} {#t+ ExitCap};#cap 2 Exits}
#cond {>} {#t- ExitCap}
#trig "ExitCap" {^*$} {#cap Exits} |
|
|
|
Josiah.Bruns Apprentice
Joined: 04 Mar 2007 Posts: 103
|
Posted: Tue Mar 06, 2007 9:10 pm I Still haven't solved this problem with an elegant solution. |
Code: |
#CLASS {test}
#TRIGGER {^-- There {is|are} (%w) obvious {exit|exits}: (*).} {#show %ansi( yellow, bold) %2}
#CLASS 0
|
This works unless the exit line is 2 lines long.
i.e. it works for this:
-- There are three obvious exits: north, south and east.
>
but not for this:
-- There are six obvious exits: north, east, west, northeast, northwest
and south.
There has got to be a sexy solution out there.
What i want is one nice elegant trigger that will cature all the exits in a room regaurdless of whether there are one or two lines of room exits. I am basically trying to capture from the <colon : > to the <period . > |
|
|
|
|
|
|
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
|
|