IRE mapping script

From Mudlet
Revision as of 14:52, 22 June 2011 by Vadi (talk | contribs) (→‎Download)
Jump to navigation Jump to search

This is the Lua component to make the Mudlet Mapper work for IRE games. You'll need to import the xml below in order for autowalking to work on Achaea, Aetolia, Lusternia, Imperian, or Midkemia Online.

Download

latest version (updated June 20th, 2011) - news feed for updates

If updating and you're on a Mudlet that has the package manager, then just remove the mudlet-mapper package and install the new xml. Otherwise, delete all Mudlet Mapper folders in Mudlet (aliases, triggers, scripts) and import the new xml.

Installing

  • make sure you're using a version of Mudlet that has a mapper (either a Map button or a Toolbox -> Show Map option)
  • import this script
  • done!

Updating

To update the xml, firstly delete all the Mudlet Mapper trigger, alias and script folders. Then, download the new xml and import it.

To make Mudlet re-download the map, close Mudlet, find the ~/.config/mudlet/profiles/<your profile>/map folder and delete it. ~ is your home folder. Start Mudlet again, click the Map button and it'll download the latest map.

Note: On Windows its %USERPROFILE%/.config/mudlet/profiles/<your profile>/map

Mapper changelog is available here.

Aliases

common

goto

goto <id> - goes to a room of that id

mpp

mpp [on|off] - toggles or sets mapper to be paused

mstop

mstop - stops the mapper completely

rf

rf <name>, room find <name> - searches for a room of a given name

area list

area list - shows the known area list

room list

room list <area> - shows the list of rooms in an area

arealock

arealock, arealock <area> - displays a list of areas you can lock/unlock, can also give it an area name to filter by

rl

rl, rl <room name or room id>, room look, room look <room name or room id> - displays information about a room

mapping

It's best that you always have the latest version of Mudlet 2.0 release candidate installed while mapping (especially not rc4, which was buggy), along with the latest version of this script - because both are still very much in progress and are updated and improved often. Feel free to submit feedback on the mapping script on the forums, or even improve it yourself as all the code is available. General Mudlet Mapper feedback is welcomed as well.

Some tips on mapping:

  • it's best to map in the 2D mode, because then you can select them en-masse and move them around, as well as doing other things
  • when moving around rooms via selection, do not include the room you're currently in, it'll go wild. If this is a problem, then move the current room out to wild coordinates and then move it back

Here's a short mapping video to get a sense of a possible way to map things.

Mapping new areas

The mapper relies on the in-game room IDs for it's own, and so it's best that you keep them in sync when creating new rooms as well - if you're in an unmapped room, 'rl' will tell you the rooms in-game ID. So when starting to map a new room in a new area, it'd best to create the new room with it's in-game ID at 0 0 0 coordinates, create the area, and move the room into the area - ie:

mc on

rl <see the room ID>

rlc v<room id> 0 0 0

survey <see area name>

area add <area name> (this will create the area)

room area <area name> (this will move the room to the new area)

Proceed to walking about and automapping!

mc - toggle mapping mode

Usage: *mc or map create <option>*, where option can be "on" or "off". Turning the mapping mode on enables the mapping aliases, along with several automapping things (that rely on GMCP being enabled):

  • room creation - if you enter a room that's not mapped yet, it'll map it
  • exit creation - if there is an unmapped exit in the room, the mapper will auto-link it to another room (and create that other room if it doesn't exist yet)
  • exit deletion - if the mapper knows about an exit that doesn't really exist, it'll remove it

rlc - create a room

Usage: *rlc or room create <option>*, where option will specify the location of the new room. The new room will be auto-linked to the current one, be placed in the same area and take on the same environment type. If the mapper doesn't currently know where you are, you'll have to specify the exact coordinates that you'd like to place the room at (0x,0y,0z is a good place to start at). You can specify the location via several ways:

  • relative direction - ie 'rlc n' will create the room north of you, 'rlc se s' will create the room south-east and south of you.
  • exact coordinates - ie 'rlc 1 -5 10' will create the room at those exact coordinates. If the mapper doesn't know where you currently are, it'll also assume that you're located in that room now.
  • exact coordinates + specific ID - ie 'rlc v34 0 0 0' will create a new room with that exact ID (best to use one from the game, which you can find by doing 'rl') at the center.
  • partial coordinates - ie 'rlc 14x 5y' will create the room at 14x and 5y, but the same z-level you're on. You can can include all three of x,y,z coordinates or only one as you wish.

rc - move a room

Usage: *rc or room coords [v<id>] <option>*, where option will specify the new location of the room. The room ID is optional, it'll move the current room if you don't provide one. Sample use:

  • relative direction - ie 'rc nw' will move the room to be nw of the current location, 'rlc e s' will create the room east and south of the current location, and 'rc v34 w' will move the room ID 34 west
  • exact coordinates - ie 'rc 1 -5 10' will move the current room to those exact coordinates. 'rc v12 8 3 -8' will move the room with ID 12 to 8x, 3y and -8z.
  • partial coordinates - ie 'rc 14x 5y' will move the room to be at 14x and 5y, but the same z-level you're on. You can can include all three of x,y,z coordinates or only one as you wish

rld - delete a room

Usage rld or room delete <option>, where option is the location or ID of the room you'd like to delete. Sample use:

  • relative direction - ie 'rld n' will delete the room that's north of you
  • exact room ID - ie 'rld 513' will delete the room with ID 513
  • current room - ie 'rld' will delete the room you're currently in

rlk - link rooms

Usage: *rlk or room link <option>*, where option will specify the room and exit to link with. You can do this in several ways:

  • exact room ID and direction - ie 'rlk 351 n' will link the current room to room #351 via a north exit
  • relative direction - ie 'rlk n' will link, if there is, a room to the north of this one to the one you're in

urlk - unlink rooms

Usage: *urlk or room unlink <direction>*, where direction will specify the direction of the exit to unlink. This function will unlink exits both ways, or one way if there is no incoming exit. Sample use:

  • relative direction - ie 'urlk nw' will unlink the exit to the northwest, and from the northwest room to the southeast

spe - link rooms via special commands

Usage: *spe or exit special <other room> <command>*, where other room will specify the room to link with, and command the command to us to get to that room. Sample use:

  • relative direction - ie 'spe n push rock' will go to the room by doing 'push rock'
  • exact room ID - ie 'spe 125 pull lever' will go to room 125 from the current one by pulling a lever

spe clear - unlink all special command links

Usage: *spe clear or exit special clear <option>*, where option is the location or the ID of the room you'd like to clear all special exits in. Sample use:

  • relative direction - ie 'spe clear n' will delete all special exits in the room that's north of you
  • exact room ID - ie 'spe clear 513' will delete all special exits in room with ID 513
  • current room - ie 'spe clear' will delete all special exits in the room you're currently in

room area - move room to another area

Usage: *room area <different area>* will move the current room to another area you're in. Sample use:

  • area name - ie 'room area glomdoring' will move the room you're currently standing in to Glomdoring. You can also specify another room to move with 'room area v# <area>', ie 'room area 1 my new area'
  • area id - ie 'room area 44' will move the room to the area ID 44

area add - create a new area

Usage: *area add <area name>* will create a new area and automatically give it an ID. Sample use:

  • area name - ie 'area add Mrr city' will create a new area called such

area rename - rename an area

Usage: *area rename <new area name>* will rename the current area you're in to the new name. Sample use:

  • area name - ie 'area rename Bobcat place* will call the area you're in like so from now on

area delete - delete an area

Usage: *area delete <area name>* will delete the given area. Sample use:

  • area name - ie 'area delete Bobcat place* will delete such an area

map save - save the map

Usage: *map save <optional name>* will save all of the map. Sample use:

  • default map - ie 'map save' will save the map with the default name as the latest one
  • map name - ie 'map save map before experiment' will save the map with that name

map load - load the map

Usage: *map load <optional name>* will reload the map. Sample use:

  • default map - ie 'map load' will load the latest saved map (it may be a named one)
  • map name - ie 'map load before experiment' will load the map with that name

API

functions

mmp.anytolong

mmp.anytolong(exit)
converts an exit name to its long version.
Parameters
  • exit:
The exit abbreviation that needs to be converted. This must be a lower case string.
Return value
  • longExit:
The long version of the exit name as a string.
Example

<lua> --This would return "north" from the function mmp.anytolong("n") --This would return "south" from the function (to be sure that you use the long version) mmp.anytolong("south") </lua>

mmp.anytoshort

mmp.anytoshort(exit)
converts an exit name to its short version.
Parameters
  • exit:
The exit abbreviation that needs to be converted. This must be a lower case string.
Return value
  • shortExit:
The short version of the exit name as a string.
Example

<lua> --This would return "n" from the function mmp.anytoshort("north") --This would return "s" from the function (to be sure that you use the long version) mmp.anytoshort("s") </lua>

mmp.deleteArea

mmp.deleteArea(name,exact)
Deletes an area from the map, if the given name is distinct. If not it shows a clickable list of deletable matches.
Parameters
  • name:
The name of the area that should be deleted. This is a string parameter.
  • exact:
Boolean value, that describes if the name is the exact (true) or partial (false) name.
Raised events
  • mmp areas changed
Example

<lua> --This would attempt to delete "Hashan" from the map (Achaea) mmp.deleteArea("Hashan", false) --[[ Output: (mapper): Which one of these specifically would you like to delete?

 Hashan, the City of (Sewers)
 Hashan, the City of (Seneschal Complex)
 Hashan, the City of

]]

--This would delete "Hashan, the City of" from the map (Achaea) mmp.deleteArea("Hashan, the City of", true) --if you made the second argument false, it'd give the same output as above </lua>

mmp.deleteLineP

mmp.deleteLineP()
Deletes the current line and the following prompt.
Example

<lua> --[[ Sample input: 3620h, 3447m, 15755e, 21980w cexb- Your enhanced senses inform you that Sidai has entered At the southern gates of Hashan nearby. 3620h, 3447m, 15755e, 21980w cexb-

Trigger: ^Your enhanced senses inform you that (\w+) has entered (.+) nearby\.$ ]]

mmp.deleteLineP() cecho("WARNING! "..matches[2].."nearby! ("..matches[3]..")")

--[[ Output: 3620h, 3447m, 15755e, 21980w cexb- WARNING! Sidai nearby! (At the southern gates of Hashan) ]] </lua>

mmp.echo

mmp.echo(what)
Prints the argument with a prefixed "(mapper): ".
Parameters
  • what:
The message that should be printed.
Example

<lua> mmp.echo("We arrived at our destination.") --[[ Output: (mapper): We arrived at our destination. ]] </lua>

mmp.echoAreaList

mmp.echoAreaList()
Prints a list of all known areas. Each name is clickable to display its room list.
Example

<lua> mmp.echoAreaList() --[[ Output of Midkemia-Online: List of all areas we know of (click to view room list):

    2 Caldara
    3 Human Introduction
    4 Krondor
    5 Ardanian Ice Caverns
    6 Plains of Isbandia
    7 Ruins of Armengar
    8 Countryside East of Krondor
    9 Green Heart
   10 Lion's Den
   11 Edder Forest
   12 Smuggler's Cove
   13 Elvandar
   14 Stardock
   15 LaMut
   16 Grey Towers
   17 Carse
   18 Yabon Forest
   19 Yabon
   20 Jonril
   21 Sar-Sargoth
   22 Vale of Isbandia
   23 Caern
   24 Royal Krondorian Highway
   25 Teeth of the World
   26 Elvandar Forest
   27 Zun Highway
   28 Crydee Highway
   29 Free Cities Highway
   30 Yabon Highway
   31 Carse Beaches
   32 Zun to LaMut Road
   33 Bandit Camp
   34 Zun
   35 Ylith
   36 Tulan
   37 Lan
   38 Natal
   39 Bordon
   40 Southern Crydee Highway
   41 Port Natal
   42 Sewers of Krondor
   43 Harlech
   44 Barony of Yarsog
   45 Tyr-Sog
   46 Farmlands surrounding Natal
   47 Lake of the Sky
   48 Hawk's Hollow
   49 Loriel
   50 Walinor
   51 Hush
   52 Calastius Mountains
   53 Central Hills
   54 Southwestern Plains
   55 Far Coast Beaches
   56 Sarth Abbey
   57 Beaver Dam
   58 Skreech
   59 Sailors Grief
   60 Duchy of Crydee
   61 Mountain Troll Camp
   62 Hadati Highlands
   63 Margrave's Port
   64 Western Free-Cities Highway
   65 Moredhel Introduction
   66 Outpost of Eggerson
   67 Thunderhell Steppes
   68 Dwarf Introduction
   69 Eledhel Introduction
   70 Sedia Tunnels
   71 Lake Moraelin
   72 Stardock Town
   73 Silban Abbey
   74 Crydee
   75 Imp Cave
   76 Frontier Valley
   79 Questor's View
   80 MacMordain Cadal
   81 Troll Introduction
   82 Goblin Introduction
   83 Dirge Swamp
   84 The Yabon River
   85 Free Cities Lake
   86 The Free-Cities Wilderness
   87 Straits of Darkness
   88 Beneath the Star Lake
   89 highcastle
   90 Cutter's Gap
   91 track through the High Wold
   94 Uru Gathering
   95 Hadati Crypts
   97 Ravensburg
  100 Fifth Circle of Hell
  102 Eagles Reaches
  108 Ruins of Veilgarden

]] </lua>

mmp.echonums

mmp.echonums(roomname)
Prints the first three possible room IDs for the given room name. If no room is found, "?" is echoed. A click of the room ID starts the aurowalker to there.
Parameters
  • roomname:
Name of the room of which the IDs should be displayed. This must be a lower case string.
Example

<lua> mmp.echonums("The Crossroads") --[[ Output: 4472, 4895, 6162, ... ]]

mmp.echonums("foobar") --[[ Output: ? ]] </lua>

mmp.echoRoomList

mmp.findAreaID

mmp.getAreaBorders

mmp.getnums

mmp.getPath

mmp.pause

mmp.ranytolong

mmp.relativeroom

mmp.renameArea

mmp.roomArea

mmp.roomEcho

mmp.roomexists

mmp.roomFind

mmp.roomLook

mmp.searchRoom

mudlet events

  • mmapper failed path - tried to go from A to B, but failed because there is no known path (or we were walking, got moved offcourse, and can't get to the destination anymore)
  • mmapper arrived - arrived at our destination successfully
  • mmapper stopped - mapper's stop function was called (this will be raised anytime it was, even if we weren't moving)
  • mmapper updated pdb - mmp.pdb table was updated with new data

Developers

Code is hosted on a bzr branch in launchpad.net, mapper-lua. If you'd like to help develop, please feel free to create a branch, add your changes, and then request a merge of your code!

Credit to: Sidd (for sharing his own mapping aliases that came before any documentation existed)

What else needs to be done

General things that need work are triggers for where room detection is necessary - player-locating abilities, shrine defilement warnings, mindsense area reports, etc. The general format is that the room ID should be prefixed to the line the room name is given + be made clickable - so the player can click on it and go. An example is provided for the Lusternian scent ability that implements this. Also needs to recognize the need to swim, right now if you don't have waterwalking - it'll loop trying to walk. Another small problem is that if it gets off the path once, it'll keep saying that it ended up off the path, and not realize when it arrived at the location properly (but it does arrive).

I've also started a bit on a person db - it stores the last known locations of players. This is something that is useful to everybody, so it's best that we don't have to keep reimplementing ourselves but use a common version. This requires more triggers to feed it's hunger for data as well!