[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Miniwindows
. . -> [Subject]  Adapting Graphical Automapper (uh oh)

Adapting Graphical Automapper (uh oh)

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Death   (55 posts)  [Biography] bio
Date Sat 03 Mar 2018 08:56 PM (UTC)

Amended on Sun 04 Mar 2018 05:57 AM (UTC) by Nick Gammon

Message
Hey guys,


I know you guys don't have time to help write an adaptation of every single mud, so I'm just asking for guidance on matching one part of it.

https://raw.githubusercontent.com/nickgammon/plugins/master/Materia_Magica_Mapper.xml

The code is from above^^^


I don't have a compass on my mud, so I changed HYPHEN_LINE from

<trigger
   back_colour="8"
   bold="y"
   enabled="n"
   match="(-------------------------------------------------)*"
   match_back_colour="y"
   match_bold="y"
   match_inverse="y"
   match_italic="y"
   match_text_colour="y"
   name="Hyphen_Line"
   script="Hyphen_Line"
   sequence="100"
   text_colour="12"
   
  >
  </trigger>


to match my exits, [Exits: *], just so I don't have to deal with it, at least until I figure out how to make this work. (I know you're going to hate me for that)
Anyways, I'm having issues actually matching the exits.

The original trigger looks to match " Visible Exits: *",
and I've changed it to match my mud, where it might look like this.


The Temple of Krynn
[Exits: north east south west up]
This is the most beautiful Temple you've ever seen, gold and silver
everywhere.  A red carpet leads you north towards the Temple altar or south
towards the room of donations.  There is an archway to the west.  A golden
sign above it simply says, "Incarnations".  To your east is a small room with
a staircase leading down.  A marble stairway leads up to the streets of
Krynn.  There is a small shimmering plaque on the wall.  
( 4) A ball of light shines bright
( 2) A long shiny sword has been left here.
( 2) A shiny breastplate has been left here.
     A large golden fountain stands in the middle of the room.
(AFK) (Glowing) (Blue Aura) (Translucent) Blackfell is here.
(Glowing) (Slowed) (Blue Aura) (Translucent) The tranquil water dragon Emile Khadaji is here.
(AFK) (Glowing) (Invisible) (Hasted) (Blue Aura) Madcoil says 'AFK!'
(Glowing) (Hasted) (Blue Aura) Djaron guards the Temple with his life.

<4842/5530 hp 2447/2447 m 1927/1927 mv 67528070 xp>


I keep getting the error message "WARNING: I did not see a "Visible Exits:" line.
The mapper will not connect rooms to other rooms without it.
Please turn on the exits by typing:
"
So I know I'm not matching on the exits line, but I'm not sure why.

This is why I need your help.

The original string for matching is:


  exits_str = string.gsub (wildcards [1]:lower (), "[()]", "")


I changed it to a few variations, but decided to try:


 exits_str = string.match (line, "^Exits: (.*)")


Still no luck. Any chance to help me match my exits so I can get it to link the rooms and work properly?

Thanks for your help, always.

[EDIT] Improved formatting.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sun 04 Mar 2018 05:58 AM (UTC)
Message
If you are having trouble matching the exits you need to post the exact trigger you are using to do that.

Template:copying For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Death   (55 posts)  [Biography] bio
Date Reply #2 on Sun 04 Mar 2018 07:06 PM (UTC)

Amended on Sun 04 Mar 2018 08:39 PM (UTC) by Nick Gammon

Message
Hey Nick,

I'm currently matching off of this trigger.



 <trigger
   enabled="y"
   match="[Exits: *]"
   name="Exits_Line"
   script="Exits_Line"
   sequence="100"
  >
  
  </trigger>


Like I said, the function string is above.

I don't see how I'm not matching.

Again, my room is as follows.

Hannibal Way
[Exits: east south]
The city is in remarkably good shape. The streets and buildings here
have all been restored to their origional condition, and the names of the
streets have even been preserved.


Room name, EXITS, Long description.


So the plugin can still draw every room, but it's not linking them because it's not finding the exits.
What's happening is the map is just redrawing in every room and never linking the rooms.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Sun 04 Mar 2018 08:45 PM (UTC)
Message
It sounds a bit like you haven't entered that function.


-- -----------------------------------------------------------------
-- 4. Here on exits line
-- -----------------------------------------------------------------

function Exits_Line (name, line, wildcards)

  exits_str = string.gsub (wildcards [1]:lower (), "[()]", "")

  EnableTrigger ("Exits_Line", false)
  got_exits = true
end -- Exits_Line


Can you add a debugging print there please? Eg.


mapper.print "Got exits line"


What you might need to do is enable the exits line in the function Name_Line, because things are being done in a different sequence to Materia Magica.


  EnableTrigger ("Exits_Line", true)

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Death   (55 posts)  [Biography] bio
Date Reply #4 on Sun 04 Mar 2018 09:47 PM (UTC)

Amended on Mon 05 Mar 2018 02:39 AM (UTC) by Death

Message
Hey Nick,

I've done the following, as you've said.

-- -----------------------------------------------------------------
-- 1. Here on yellow line - room name
-- -----------------------------------------------------------------

function Name_Line (name, line, wildcards, styles)

  if string.match (line, "^%[") then
    return
  end -- if chat line
    
  got_hyphens = false
  roomname = Trim (styles [1].text:sub (1, 50))
  roomdesc = ""
  exits = {}
  exits_str = ""
  map_str = ""
  got_exits = false
  EnableTrigger ("Exits_Line", true)
  EnableTrigger ("Hyphen_Line", true)
  EnableTrigger ("Other_Line", true)
  EnableTrigger ("Name_Line", false)
end -- Name_Line


and here

-- -----------------------------------------------------------------
-- 4. Here on exits line
-- -----------------------------------------------------------------

function Exits_Line (name, line, wildcards)

  exits_str = string.gsub (wildcards [1]:lower (), "[()]", "")
mapper.print "Got exits line"

  EnableTrigger ("Exits_Line", false)
  got_exits = true
end -- Exits_Line



Now I've got
The Temple of Krynn
[Exits: north east south west up]
Got exits line
This is the most beautiful Temple you've ever seen, gold and silver
everywhere.  A red carpet leads you north towards the Temple altar or south
towards the room of donations.  There is an archway to the west.  A golden
sign above it simply says, "Incarnations".  To your east is a small room with
a staircase leading down.  A marble stairway leads up to the streets of
Krynn.  There is a small shimmering plaque on the wall. 

in every room, but it's not linking any rooms.

In most cases it's adding rooms to the database, but the exits are either horribly wrong, or when I move rooms again it's not updating at all, and the exits are from the previous room. (I understand you need to walk back and forth to link a room, it doesn't work though)

So, it's still just drawing the room you're in, and that's it. I've tested the plugin on Materia Magica, and it worked perfectly.

There are quite a few rooms with the same NAME and long desc, maybe this is the problem, but I'm in the recall area and it won't draw rooms at all, not even the rooms I'm in. (The recall area should be easy, as it's just like a + sign in design.)

I get the "got exits line" in like every room, but maybe it's not actually getting exits. (Maybe I filled your information in incorrectly)


Could it be my database is already filled with some of these rooms, so it won't draw them again? (This wouldn't be the linking problem, just the refusal to draw maybe?)

I've reinstalled it, and now I'm not matching exits at all anymore... Heh.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Mon 05 Mar 2018 04:39 AM (UTC)
Message
Hmmm. In the function save_exits_to_database un-comment this line:


      mapper.mapprint ("Added unknown exit", dir, "from room", uid, "to database.")


So you should see "added unknown exit" for each exit.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Mon 05 Mar 2018 05:39 AM (UTC)
Message
Quote:

There are quite a few rooms with the same NAME and long desc, maybe this is the problem ...


That certainly won't help. Uniquely identifying each room is pretty critical to not having rooms randomly appear to link to somewhere incorrect. If you incorporate the exits themselves into the generated room UID then that may help a bit (the code you linked does that).

Because of the sequence in which things arrive you want to check that the UIDs are as unique as you can make them. That is, don't generate a room UID until you have the short name, long name, exits etc.


If you have lots of rooms with the same name, same description, same exits, well then pfffft! That's a weird MUD.

It would be like going to a city which has all its streets named the same. That is, a stupid city. :)

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Mon 05 Mar 2018 06:20 AM (UTC)
Message
See: http://www.gammon.com.au/forum/?id=12635

You don't necessarily have to process the Exits line at all. You should be able to deduce where the exits are because you go east from room A and end up in room B.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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.


17,735 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]