Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Capturing room name, desc, and exits.
|
Capturing room name, desc, and exits.
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| LupusFatalis
(154 posts) Bio
|
| Date
| Thu 14 May 2009 08:28 PM (UTC) Amended on Thu 14 May 2009 08:32 PM (UTC) by LupusFatalis
|
| Message
| Ok, so here is the deal. I'm trying to capture the room
name, description, and exits in a series of triggers. So
that I can send them through a script later.
I've got the exits down. I'm working on the room name now
and running into trouble.
The problem I have now is emotes come in the exact same
style as room titles. Bold white on a black background. It
doesn't seem to be a problem when people decide to be
grammatically correct. But otherwise they can start
spamming my trigger. Which will eventually end up
generating spurious rooms, something I can't have. Can I
somehow have triggers fire sequentially? i.e. I enter a
room and I see this...Balcony
This stone balcony is surrounded by a low railing and a table and a pair of chairs have been placed here for the use of the tenant. Next to the door is a small window covered with a carved stone lattice. The rose-gold light of dawn shines on the garden and pool below. From where you are, you could climb up. You could try to leap off the balcony to the pool just to the west and to the flat stone balcony just to the south. It is shadowy here.
There is one obvious exit: a closed door leading east.
Can I link triggers so that if all three don't fire, none
fire?
As an aside, the exit pattern varies so I'd have several
triggers for it. And I'm not sure how to extract the room
desc aside from some means of capturing text between those
two lines. | | Top |
|
| Posted by
| LupusFatalis
(154 posts) Bio
|
| Date
| Reply #1 on Fri 15 May 2009 03:11 AM (UTC) |
| Message
| Ok, I have three triggers in place that seem to do the job so far. But, I've really got to get this part right, so I'd appreciate any insights into where they may go wrong.<triggers>
<trigger
enabled="y"
lines_to_match="3"
keep_evaluating="y"
match="^([A-Za-z\' ]+)\n([^\n]*)\nThere (is|are) (\w+) (obvious exit|exits)\: (.[^\.]+)\.$"
multi_line="y"
regexp="y"
send_to="2"
sequence="100"
>
<send>RoomName: %1
RoomDesc: %2
RoomExits: %6</send>
</trigger>
<trigger
enabled="y"
lines_to_match="4"
keep_evaluating="y"
match="^([A-Za-z\' ]+)\n([^\n]*)\nThere (is|are) (\w+) (obvious exit|exits)\: (.[^\.]+)\n(.[^\.]+)\.$"
multi_line="y"
regexp="y"
send_to="2"
sequence="100"
>
<send>RoomName: %1
RoomDesc: %2
Exits: %6%7</send>
</trigger>
<trigger
enabled="y"
lines_to_match="5"
keep_evaluating="y"
match="^([A-Za-z\' ]+)\n([^\n]*)\nThere (is|are) (\w+) (obvious exit|exits)\: (.[^\.]+)\n(.[^\.]+)\n(.[^\.]+)\.$"
multi_line="y"
regexp="y"
send_to="2"
sequence="100"
>
<send>RoomName: %1
RoomDesc: %2
Exits: %6%7%8</send>
</trigger>
</triggers>
As a quick note, the exit line isn't always on one line, basically different rooms were coded at different times, hence that nonsense. The room name seems to always be bold, but as I noticed some unique rooms are colored things other than white, much to my chagrin. This seems to capture the room desc given it is on one line. Which is a great start. its been a while since I went into Underdark (the area I'm mapping), thousands of computer generated rooms arranged in some crazy pattern. I seem to recall the code being a little iffy on the word wrap in some places, and actually sending new line characters. I *could* be wrong. I will know when I start the mapper.
But if I assume that is the case (I'm 99% sure) any idea on how to capture the room desc? I think something that has to do with the built in sequencing is probably the key here. i.e.
TITLE
DESC
EXITS
There are a limited number of possibilities for the exits. And they cannot be messed with by players insofar as emotes or anything. Room Titles, we know what they look like, however they are not unique like exits. And the desc--most of the mud is processed as 1 line assuming I set it to do that. However, that might not be the case. And the format is not distinct in any way from all other mud text. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #2 on Fri 15 May 2009 07:40 AM (UTC) |
| Message
| I think you are on the right general track here.
You can use GetLineCount to find out whether one line follows another. Thus, a trigger that matches (say) the room title could also record which line it is on (in a variable). Then, if something that looks like a room description starts at that line, +1, then you can be fairly sure it is not spoofed.
http://www.gammon.com.au/scripts/doc.php?function=GetLineCount
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
15,873 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top