developing mapping script for Morgengrauen

All and any discussion and development of the Mudlet Mapper.
Post Reply
User avatar
Zaphob
Posts: 180
Joined: Wed May 09, 2012 8:07 am
Location: mg.mud.de

developing mapping script for Morgengrauen

Post by Zaphob »

So I will give it another shot. Totally forgot how to use the mapper again. Currently looking through other mapping scripts, but none come to help in a way I can directly use. So I need to develop again. Here is what I receive:

room description:
Die Hafenstrasse fuehrt in Ost-West Richtung zum Hafen hinab, der oestlich
liegt. Der Weg fuehrt an Franks Abenteurer-Kneipe im Sueden vorbei.
Nach Norden hin zweigt die Brunnenstrasse ab.
Es gibt vier sichtbare Ausgaenge: osten, norden, westen und sueden.
Ein Bettler.
gmcp.room.info:
Code: [show] | [select all] lua
  info = {
    short = "Hafenstrasse.",
    id = "84785a5a891638d302972fa590e9edcb",
    domain = "Ebene",
    exits = {
      "osten",
      "norden",
      "westen",
      "sueden"
    }
  }
I see no colors, prompt triggers, or anything. I also see no room numbers, just the unique room hash id.

What I would like to do first, is just draw a map for each room I pass, store the room's short description, and draw exit stubs where I see exits. I do not see where those exits lead to. So I would have to check when going there, where do they lead. Only then I can connect the exit to the other room.

Currently struggling with the mapper API.
Last edited by Zaphob on Sat Nov 08, 2014 4:11 pm, edited 1 time in total.

User avatar
Zaphob
Posts: 180
Joined: Wed May 09, 2012 8:07 am
Location: mg.mud.de

Re: Mapping Script for Morgengrauen

Post by Zaphob »

What I did already:

* Created a room manually, created another room manually, linked them via exits manually (unfortunately, that is where the mapper tutorial ended)

* Create a GMCP script, which will be executed, whenever any new room is entered. It then goes on to save the room's id to a list, or if it is already known, say so. See code below.

Now I would like to combine the two. Looking at other mapping scripts, they do fancy things like calculate new x,y,z coordinates, based on last movement command, etc. At least, that is what I understood. Do I need to reinvent the wheel here? Not sure what to next consider including / copying / building myself.

There may also be cases where I try moving in a direction, but there is no exit, so no new room is reached. Other cases may be, I use an unexpected command to change rooms. Not sure how to deal with those, yet.
Code: [show] | [select all] lua
function ermittleRaum()
  -- where am I?
  id = gmcp.MG.room.info.id
  echo("Found room: " .. id)

  -- new here ?
  if raeume[id] then
    echo (" - seen this room before")
  else
    echo (" - new room, saving data")
    raeume[id] = 
    { short = gmcp.MG.room.info.short,
      domain = gmcp.MG.room.info.domain,
      exits = gmcp.MG.room.info.exits
    }
  end
end
edit: also here, for you to review, how I created the rooms manually:
Code: [show] | [select all] lua
lua addRoom(1)
lua setRoomArea(1, 1)
lua setRoomName(1, gmcp.MG.room.info.short)
lua getRoomName(1)
lua setRoomIDbyHash(1, gmcp.MG.room.info.id)
lua getRoomIDbyHash(gmcp.MG.room.info.id)
o
lua addRoom(2)
lua setRoomArea(2, 1)
lua setRoomName(2, gmcp.MG.room.info.short)
lua setExit(2, 1, "w")
lua setRoomCoordinates(1,0,0,0)
lua setExit(1, 2, "e")
lua setRoomCoordinates(2, 5, 0, 0)
lua getAreaRooms(1)
lua getRoomExits(1)
lua getRoomExits(2)
centerview(1)
Notice how I moved rooms by sending "o", which is German for "e", which the mapper's setExit-command expects.

User avatar
Angie
Posts: 51
Joined: Fri May 02, 2014 11:43 pm

Re: developing mapping script for Morgengrauen

Post by Angie »

Well, it would make sense to use your gmcp.MG.room.info.exits instead of commands - that takes care of the problem with trying to move in a direction that has no exit.
Angie @ Midnight Sun 2
Alayla @ God Wars 2

User avatar
Zaphob
Posts: 180
Joined: Wed May 09, 2012 8:07 am
Location: mg.mud.de

Re: developing mapping script for Morgengrauen

Post by Zaphob »

Ok sure, I can use gmcp and build a script, which would draw the current room on map, and include all known exits, draw them as stubs. Not sure, how exactly the code will look, but seems possible.

Then I move to another room.

Now I get the visible exits, directions from this room. But gmcp does not show where those exits lead. Which room did I come from?

Thats why I think I need to somehow capture the command which was responsible for changing rooms.

Not sure how to build this logic and explain it to the mapper :-)

After that will work, I can start to think about multiple stacked commands, lag, etc.

User avatar
Angie
Posts: 51
Joined: Fri May 02, 2014 11:43 pm

Re: developing mapping script for Morgengrauen

Post by Angie »

Ah, right. I didn't notice your gmcp didn't tell you where the exits lead. But you can at least check that the command is one of the room's exits before using it to connect the rooms. Unless I'm mistaken, Xyllomer uses a command based mapper, so you can take a look at their scripts to see how they do it.
Angie @ Midnight Sun 2
Alayla @ God Wars 2

User avatar
Zaphob
Posts: 180
Joined: Wed May 09, 2012 8:07 am
Location: mg.mud.de

Re: developing mapping script for Morgengrauen

Post by Zaphob »

Just for info, we have a simple version ready, if you would like to take a look at our mapper.xml

https://github.com/Kebap/krrrcks-mudlet

Now for eliminating all the usability issues and writing a concise description for newbies.

Post Reply