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
➜ Plugins
➜ Two Towers Mapper modified for SWmud
|
Two Towers Mapper modified for SWmud
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2 3
4
| Posted by
| Clafoutis
(29 posts) Bio
|
| Date
| Reply #15 on Tue 12 Nov 2019 10:05 PM (UTC) Amended on Tue 12 Nov 2019 10:10 PM (UTC) by Clafoutis
|
| Message
| Worked on some other things for a day or two and tried to apply what I learned to the mapper.
I've disconnected the triggers from the mapper script and am just having it output notes.
The good news is, I seem to be getting consistent room description captures which should go
a long ways towards fixing some of my original problems porting the mapper over to SWmud.
The bad news is, something weird is going on with my exits capture.
<trigger
enabled="n"
group="Mapper_Triggers"
keep_evaluating="y"
match="^\D.*"
regexp="y"
send_to="12"
sequence="100"
>
<send>
table.insert (room_table, "%0")
</send>
</trigger>
<trigger
enabled="n"
group="Mapper_Triggers"
keep_evaluating="y"
match="(?:The only|There are .*) obvious exit(?:s:| is) (?P<exits>.*)\."
regexp="y"
send_to="12"
sequence="200"
>
<send>
room_table = room_table or {}
for _, item in ipairs (room_table) do
print (item)
end
print ("---")
print (%1)
print (exits)
EnableTriggerGroup ("Mapper_Triggers", false)
Note ("Mapper_Triggers disabled")
</send>
</trigger>
Result 1:
Mapper_Triggers enabled
n
Welcome to the new Down on the Upside Cafe. Looking around in the dim room you find comfy
couches together in pairs to promote discussion and togetherness. Small glass tables rest
nearby for those hot drinks you can order from the waitress who undoubtedly must also be a
struggling artist. A rolling fire near the south end is surrounded by a few large pillows
and a few good books on the mantle. The western wall has a small stage with a microphone
and chair for poets, musicians and storytellers to entertain and enlighten the crowd. A
large board has a 'list' of items on it for you to order. There is a door to the south,
which seems to lead back to the street. There is also a stairwell going down, which
Jennette only allows certain people access to.
You may also use the bulletin board here to post stories, jokes, and anything of artistic
value for others to read.
Soft music of some foreign origin plays over the speakers.
There are two obvious exits: south and down.
((not actually in the code, but added this line more easily show where the code starts to
return what it captured, since it's normally distinguished by color on my client))
Welcome to the new Down on the Upside Cafe. Looking around in the dim room you find comfy
couches together in pairs to promote discussion and togetherness. Small glass tables rest
nearby for those hot drinks you can order from the waitress who undoubtedly must also be a
struggling artist. A rolling fire near the south end is surrounded by a few large pillows
and a few good books on the mantle. The western wall has a small stage with a microphone
and chair for poets, musicians and storytellers to entertain and enlighten the crowd. A
large board has a 'list' of items on it for you to order. There is a door to the south,
which seems to lead back to the street. There is also a stairwell going down, which
Jennette only allows certain people access to.
You may also use the bulletin board here to post stories, jokes, and anything of artistic
value for others to read.
Soft music of some foreign origin plays over the speakers.
There are two obvious exits: south and down.
---
nil
nil
((end of capture))
Mapper_Triggers disabled
Jennette
* Expression Board * is here.
587/587 -4 464391 4704 off undrugged >
In this case, instead of capturing the exits, I'm getting nil results. However in the 2nd result, when I move into a room that has three or more exits, it seems that because the exit line has commas in it like so:
There are four obvious exits: south, north, east, and west.
Then I get this error message:
Error number: 0
Event: Compile error
Description: [string "Trigger: "]:12: unexpected symbol near 'and'
Called by: Immediate execution
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #16 on Wed 13 Nov 2019 05:57 AM (UTC) |
| Message
| This needs to be quoted:
Because if the exits are "south and down" then it will turn that into:
Hence the error message about "unexpected symbol near 'and'".
It should read:
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Clafoutis
(29 posts) Bio
|
| Date
| Reply #17 on Wed 13 Nov 2019 05:35 PM (UTC) Amended on Wed 13 Nov 2019 05:38 PM (UTC) by Clafoutis
|
| Message
| Thank you for your patience;
now correctly displays the exit line in all tested cases, (e.g. "south, north, east, and west")
however
returns "nil"
My possibly misplaced concern is that ultimately I want the function process_room_description to manipulate room_desc and exits.
I can display the contents of room_desc but not exits, and am assuming I won't be able to get the function to work if I'm not
properly capturing both variables.
I have some further concerns that I understand some of what the function is doing, but there are a few parts that are beyond me;
however I'm assuming that won't matter until I can get the capture variables right. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #18 on Wed 13 Nov 2019 08:36 PM (UTC) |
| Message
|
You haven't assigned anything to the variable "exits" so it is nil.
Since you are using named wildcards you could pull in the named wildcard like this:
exits = "%<exits>"
print (exits)
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Drago
(1 post) Bio
|
| Date
| Reply #19 on Tue 07 Jan 2020 07:48 AM (UTC) |
| Message
| So I've been tinkering with this basic plugin to get it to work for SWMud.
After trying several approaches with the multiline trigger I think this regex may work pretty consistently
match="^.+\s>\s$\s^(?P<roomdesc>(?:(?!\s>\s)[\s\S])*)(The only|There are .*) obvious exit(s:| is) (?P<exits>.*)\.\Z"
What it does look for the end of the prompt string (" > " end of line) followed by anything that is not the end of the prompt string followed by the exit string.
I know that the greater than sign is used other places in room descriptions but as far as I know you shouldn't have any instances of " > " found anywhere other than the prompt (let me know if you find this is not the case).
Play around with this let me know what you think. | | Top |
|
| Posted by
| Clafoutis
(29 posts) Bio
|
| Date
| Reply #20 on Fri 10 Jan 2020 12:14 AM (UTC) |
| Message
|
Drago said:
Play around with this let me know what you think.
Wow, this is magnitude's of order way better than any of my attempts. There's a few odd rooms that it doesn't pick up but this is miles way more functional.
I've tried to go back to basics and read a book on Lua while working on a few simpler projects. I'll see if I can work out a few of the odd stubborn rooms to work with this but even if I can't, this is more than workable.
Thanks Drago, to both you and Nick, for your assistance; I really appreciate it. | | Top |
|
| Posted by
| Clafoutis
(29 posts) Bio
|
| Date
| Reply #21 on Fri 10 Jan 2020 01:20 AM (UTC) Amended on Fri 10 Jan 2020 01:24 AM (UTC) by Clafoutis
|
| Message
| On an initial quick pass, a couple of the rooms are over 10 lines; it was relatively simple to up the lines_to_match to 15 and that fixed a couple of rooms the mapper wasn't picking up.
One thing that I'm not sure how to correct is, occasionally some interaction will happen between the last prompt '>' and the next room description:
612/612 1 292459 12941 off undrugged [0] > Ryoh enters.
Ryoh leaves northeast.
sw
This is the lobby of the commercial tower of Imperial City. In this tower you will find many vendors to purchase from and sell to. The main shop is
located here in the lobby, and a shopkeeper patiently waits behind the counter to either buy from you or sell something to you.
Type 'panic shop' for more information.
There are four obvious exits: south, northeast, west, and up.
Shop Keeper
Trashcan is here.
612/612 1 292459 12941 off undrugged [0] >
And that will throw the mapper off. If I leave the room and reenter, the mapper reorients and sorts itself out. However, sometimes this behavior will cause it to create a new room based on the extra interaction; I'm not sure if this will lead to the state file gradually growing to be larger than it needs to be. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #22 on Sun 12 Jan 2020 07:18 AM (UTC) |
| Message
| Conceivably you could try to omit bogus lines like "* leaves *" from the table that you are building up of the room description.
Or, maybe omit really short lines, if they are followed by a long line. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Clafoutis
(29 posts) Bio
|
| Date
| Reply #23 on Mon 13 Jan 2020 08:12 PM (UTC) |
| Message
| I could omit things, but the range of possible things seems pretty wide, from entities moving around, emotes, chat. Still, it's the most functional model I've got so far so I'm definately holding onto this branch.
That said, I was looking at a seperate project I've been working on. I used your inventory sorter from the faq to successfully capture flight coordinate data, send it to a seperate session window and thus leave the main output window much less cluttered.
http://mushclient.com/forum/?id=7794#37
With this code, we're able to tell the client exactly when to start collecting lines, use those lines to populate a table, and when to stop. Then, instead of sending the table to a seperate session window, rather it would get sent to the mapper scripts for processing.
The minor hitch, is that this creates a table whereas the mapper scripts I think take a wildcard/variable as input, so I'll need to study converting formats but it ought to be possible. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #24 on Mon 13 Jan 2020 09:14 PM (UTC) |
| Message
| | You can use table.concat to convert a table into lines, if that is what you mean. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Clafoutis
(29 posts) Bio
|
| Date
| Reply #25 on Tue 14 Jan 2020 12:07 AM (UTC) |
| Message
| So I realize that having put this down two months ago, I find that in the last couple days I've mulled over several options only to wind up in my last post *unwittingly* where I left off.
To my mild embarrassment.
That said, *this* time around, the data capture actually works really well. It's doing really well at picking up the room description and not grabbing the extraneous chats, movement, emotes, etc.
Before I move onto sending the data to the mapper, there is one persistent little exception. There are a handful of rooms where if you enter them from a specific direction, the mud will send an extra line that it won't send if you come at the room from other directions. This one plagues both my branch and Draco's solution, so it's good if I can tackle it either way.
Now, I can individually write omission triggers for every different instance of this, but that's tedious and if I don't catch one ahead of time, I've gotta go back and prune the collected data. I think the advise to 'omit really short lines, if they are followed by a long line' ought to winnow the exceptions down.
I'm just not quite sure of the regex:
^\S((\D|\d){1,49})$^\S((\D|\d){49,})$
or maybe
^\S((\D|\d){1,49})$^\S.*$
but I'm afraid my grasp of regex is rather crude and I'm probably not expressing:
"line of between 2 and 50 characters followed by line of at least 50 characters"
or
"line of between 2 and 50 characters followed by line with at least one non-white space character"
all that well or accurately. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #26 on Tue 14 Jan 2020 05:13 AM (UTC) |
| Message
| | Before I try them out, I would point out that $ is supposed to be end of the subject. I you want to test for a linebreak put \n there. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Clafoutis
(29 posts) Bio
|
| Date
| Reply #27 on Fri 17 Jan 2020 01:29 AM (UTC) |
| Message
|
Nick Gammon said:
You can use table.concat to convert a table into lines, if that is what you mean.
I suspect I meant to say string and just communicated poorly.
In any case, this is *exactly* the needed command. Thank you so much; more to follow. | | Top |
|
| Posted by
| Clafoutis
(29 posts) Bio
|
| Date
| Reply #28 on Fri 17 Jan 2020 01:49 AM (UTC) Amended on Fri 17 Jan 2020 01:51 AM (UTC) by Clafoutis
|
| Message
| Ok so, I need to clean up my crude tinkerings and post the results for scrutiny but... I think we have it (or at least a working rough draft).
So, I tried the whole matching the short line followed by the long, but I realized even if I could match that, I struggled to articulate to the client to only omit part of that match.
Instead, and this is where things get a little crude, I opted to fire off of an alias where I simply look at the room I'm standing in. It's crude in the sense that, in a traditional mapper, you simply move and mapper takes care of you. Here, it winds up being a two step process of, move + look. However it's a special alias so that normal look commands won't trigger anything. That said, *so far* it seems to have cut out all the interference as well as omitting the special messages that only appear when you enter a room from a specific direction.
While getting there is a little clunky, the end result map is much cleaner than even Draco's solution (which, I must reiterate was far superior to my initial attempts). It's way too early to say with much confidence until more rigorous testing, but so far I haven't had any cases where I've gotten duplicate/conflicting entries in the map table for a given room.
It does make speedwalking a little hinky as you'll stop in each room and have to hit the 'map'look alias to move to the next step.
But the map is *clean and consistent* which was my primary aim.
I'll need to give some thought into chaining the move and maplook together; in most muds you'd just throw them into one trigger that'd fire them off in order. However, SWmud rules don't like it when you trigger commands *to the mud*. Client side triggers are fine (color and highlighting triggers, pulling in the data for the mapper, etc). | | Top |
|
| Posted by
| Clafoutis
(29 posts) Bio
|
| Date
| Reply #29 on Fri 17 Jan 2020 02:55 AM (UTC) |
| Message
| Of course, on reflection, now I'm effectively sending an extra look command everytime I want to update my map location; i.e. not simply when I'm *creating* the map.
Hrm. | | 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.
159,070 views.
This is page 2, subject is 4 pages long:
1
2 3
4
It is now over 60 days since the last post. This thread is closed.
Refresh page
top