Can't I make a map by hand?

Post Reply
Posts: 1
Joined: Sun Jun 21, 2015 12:42 am

Can't I make a map by hand?

Post by cknoll »

I'm just getting started looking at the mudlet mapper function, and I'm really confused. I'd just like to start a new map, drop some rooms on the surface, and connect them. I don't really want to write scripts and parse input because many of the rooms have duplicate names and titles, and I dont' think the script could pick up the proper room layouts, so I'm fine just doing it by hand.

In the manual they talk about adding user defined edges, selecting nodes, etc. But, all I get when clicking the Map button is a grey screen with 'nomap or no valid postion', no way to add a new map, create a room to set aa position, NOTHING!

Can someone pleas help me out here? I tried using the simple starter mapping scripts which came with a set of XML files in a zip file, but it didn't come with any instructions on how to set it up.


User avatar
Posts: 414
Joined: Thu Apr 19, 2012 1:36 am

Re: Can't I make a map by hand?

Post by Akaya »

All the functions you'll need can be found here:

A very simple start can be found here: ... ing_script

User avatar
Posts: 996
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Can't I make a map by hand?

Post by SlySven »

Ah, Akaya put something up whilst I was working on this epic but in case a more direct response is needed you can add a room by typing in the following sort of commands at the command line and here I put in some notes in italics:
  • Code: Select all

    lua newAreaId, errMsg = addAreaName("My First Area")
    To actually have rooms showing on a map they need to be assigned to an area which has a number, and following recent code changes from yours truly the latest (Mudlet 3.0.0 preview version) insists on a unique name as well, even if it is of the form "Unnamed Area_001" which gets put in automagically. This is because when a room is added to the Map a.k.a. a collection of Areas, it is added to a special Area (with the number of -1) that cannot be displayed in the "Mapper" window. So to get anything that you can see on screen you first need a real area to put them in! The "addAreaName" command is, like an increasing number (as I or other coders get our hands on individual lua functions) one that returns more than one result when used, either it returns a positive integer that is the number used to refer to the area that has just been added with the name given, or it returns a nil {a special lua value} and an informational message saying what went wrong if a bad value (but right "type" of value) was used, (if everything went OK then "errMsg" will be a nil or if the wrong thing was given, say a string when a number was expected then the command will abort with an error message but that is just case anyone wondered and is not important right now!
  • Code: Select all

    lua newRoomId = createRoomID() addRoom(newRoomId)
    "addRoom" does just that, but it needs a unique positive reference number, sometimes you can get the number that the MUD itself uses (sometimes called a vnum in MUD Server circles) - but here we'll use the output from the createRoomID() function which returns the first free number (starting from 1 and going upward) and store that in the variable newRoomId as we want it for a couple of other steps.) Also note that we actually combined two steps in one line there, just separated by a space before "addRoom" ).
  • Code: Select all

    lua setRoomName( newRoomId, "My First Room")
    You don't have to name a room but this is how it is done.
  • Code: Select all

    lua setRoomCoordinates( newRoomId, 3, 6, 0 )
    If you don't set them a new room gets the coordinates of (0,0,0) and if you are adding more than one at a time it will be easier if they are not all on top of each other - the third, the Z coordinate is required IIRC. You can place rooms adjacent to each other by using only an increment of one between the coordinates but, unless you are working with "grid" type maps the exits show better if you use a multiple of 2 or 3 at least, I have chosen to use 3 here.
  • Code: Select all

    lua result, errMsg = setRoomArea( newRoomId, newAreaId )
    Now the room will magically appear in the map - or it would if you could select the area to be shown in the map - unfortunately a bug that I just spotted means that it seems that a newly added area does not show up in the "area selection" widget in the mapper. I'll just go and check that on a current released code version and raise that as a bug if it is there as well...
  • It seems you have to save and then reload the map file to refresh the list of areas but you can force the display of your newly created room without that with:

    Code: Select all

    lua centerview( newRoomId )
    Note the absence of the camelCasing of this command - it was one of the first mapping commands and we hadn't got the command naming fully sorted out - and by the time we had we don't change it to avoid breaking anyone's existing stuff - which is a firmly imposed criterion for commands in the lua scripting system - or so Vadim occasionally has to remind me. ;)
  • Rinse and repeat for more rooms then you can start to wire them up using the GUI tools (select a room on the map with your mouse and right click and choose "exits") or you can use the "setExit(fromRoomID, toRoomID, direction)" command directly where the first two arguments are numbers of the start and end rooms for an exit (which only goes ONE way unless you also add the reverse one!) and direction is a number between 1 and 12 or one of the indicated case insensitive ASCII strings (until I can finish some work on internationalization so that directions in a "selected" language are used instead):
    1. "n" "north"
    2. "ne" "northeast"
    3. "nw" "northwest"
    4. "e" "east"
    5. "w" "west"
    6. "s" "south"
    7. "se" "southeast"
    8. "sw" "southwest"
    9. "u" "up"
    10. "d" "down"
    11. "in"
    12. "out"
Of course there is plenty more information in the Mapper section of the Mudlet wiki.

I hope this gives you some pointers... :D

EDIT: In regard to the above I now realise that I referred to some stuff that was only in the development branch of the Github repository - which was supposed to go into the latest "preview" release - well I've put it in there now but until the Pull Request is approved by another developer and we roll another preview or an actual 3.0.0 release some of the error message stuff I mentioned might not be quite as I wrote above...

Post Reply