(mapping script) Generic GMCP Mapper Script

All and any discussion and development of the Mudlet Mapper.
Post Reply
Blizzard
Posts: 1
Joined: Fri Jul 09, 2021 3:29 am
Discord: Blizzard#7841
Contact:

(mapping script) Generic GMCP Mapper Script

Post by Blizzard »

I was looking for a simple GMCP mapper script without a lot of extra game-specific features and I couldn't find one so I wrote one:
mapping.lua
(9.27 KiB) Downloaded 1497 times
It is designed to work with a MMP XML map but seems to find new rooms fine on its own. Speedwalk works too. This is a very 1.0 version and I'm rather new to Mudlet Lua scripting, so I'm sure it isn't perfect.

User avatar
Vadi
Posts: 5048
Joined: Sat Mar 14, 2009 3:13 pm

Re: (mapping script) Generic GMCP Mapper Script

Post by Vadi »

This was very much needed, thanks!

Pixie
Posts: 4
Joined: Sat Aug 17, 2019 7:13 am

Re: (mapping script) Generic GMCP Mapper Script

Post by Pixie »

I am looking for exactly this, but I'm not sure how to use it. Do I need the generic mapper installed to use the map commands?
Last edited by Pixie on Wed Sep 08, 2021 10:09 pm, edited 2 times in total.

Pixie
Posts: 4
Joined: Sat Aug 17, 2019 7:13 am

Re: (mapping script) Generic GMCP Mapper Script

Post by Pixie »

Alright so! With minor adjustments this can be made to read and make rooms, even seeing which one you're in. The adjustments are:

- There's a small typo where 'vnum' is 'num.' Quick and easy to fix.
- Adjusted for 'exit' from 'exits' in one spot to suit my specific game's gmcp value

While it reads, makes, and sees which room you're in, the coordinates of all rooms seem to be 0,0,0, which seems to be what prevents the mapper from drawing.

Pixie
Posts: 4
Joined: Sat Aug 17, 2019 7:13 am

Re: (mapping script) Generic GMCP Mapper Script

Post by Pixie »

Solution: If this is run into by somebody else, what you'll want to do is check how your game sends exits versus how the script's move_vector grabs exits. On my end, move_vector used the long form of north, south, east, etc., while the game was sending n, s, e, etc. Crochety Coder via the Mudlet Discord spotted this, and by updating move_vector the mapper started setting coordinates and drawing rooms perfectly.

User avatar
Stack
Posts: 10
Joined: Tue Feb 15, 2022 12:12 am
Location: Las Vegas, NV
Discord: Stack#4899
Contact:

Re: (mapping script) Generic GMCP Mapper Script

Post by Stack »

Pixie wrote:
Mon Sep 13, 2021 10:09 pm
Solution: If this is run into by somebody else, what you'll want to do is check how your game sends exits versus how the script's move_vector grabs exits. On my end, move_vector used the long form of north, south, east, etc., while the game was sending n, s, e, etc. Crochety Coder via the Mudlet Discord spotted this, and by updating move_vector the mapper started setting coordinates and drawing rooms perfectly.
In my game's case, I had to rename anything "gmcp"-related to matching case (i.e., gmcp . Room . Info . name--> gmcp . room . info . name). gmcp . room . info . exits was correct for my case. I did need to change gmcp . room . info . environment to gmcp . room . info . terrain, as well as to keep gmcp . room . info . num as is for my case.

Anyway, I am now experiencing the 0,0,0 coordinate same issue around the mapping working perfectly but not actually drawing anything as I move about the world. I have tried both short and long form for the move_vetcor directions, but neither had any appreciable effect.

Could there be something else that I need to change for this to work?

User avatar
Stack
Posts: 10
Joined: Tue Feb 15, 2022 12:12 am
Location: Las Vegas, NV
Discord: Stack#4899
Contact:

Re: (mapping script) Generic GMCP Mapper Script

Post by Stack »

Indeed, what resolved this issue for me was changing gmcp . room . info . area to match my game's output of gmcp . room . info . zone. At that point, this began functioning perfectly.

User avatar
Stack
Posts: 10
Joined: Tue Feb 15, 2022 12:12 am
Location: Las Vegas, NV
Discord: Stack#4899
Contact:

Re: (mapping script) Generic GMCP Mapper Script

Post by Stack »

if speedwalk is not functioning, below the local exitmap table add:

Code: Select all

local stubmap = {
    north = 1,      northeast = 2,      northwest = 3,      east = 4,
    west = 5,       south = 6,          southeast = 7,      southwest = 8,
    up = 9,         down = 10,          ["in"] = 11,        out = 12,
    northup = 13,   southdown = 14,     southup = 15,       northdown = 16,
    eastup = 17,    westdown = 18,      westup = 19,        eastdown = 20,
    [1] = "north",  [2] = "northeast",  [3] = "northwest",  [4] = "east",
    [5] = "west",   [6] = "south",      [7] = "southeast",  [8] = "southwest",
    [9] = "up",     [10] = "down",      [11] = "in",        [12] = "out",
    [13] = "northup", [14] = "southdown", [15] = "southup", [16] = "northdown",
    [17] = "eastup", [18] = "westdown", [19] = "westup",    [20] = "eastdown",
}
and in the handle_move function, change

Code: Select all

local dir = exitmap[n]
to

Code: Select all

local dir = stubmap[n]

User avatar
Vadi
Posts: 5048
Joined: Sat Mar 14, 2009 3:13 pm

Re: (mapping script) Generic GMCP Mapper Script

Post by Vadi »

Code: Select all

exits = gmcp.Room.Info.exits
should be

Code: Select all

exits = table.deepcopy(gmcp.Room.Info.exits)
since it tries to manipulate the 'exits' key afterwards. See https://github.com/Mudlet/Mudlet/issues/6019

User avatar
Owl
Posts: 1
Joined: Tue Aug 30, 2022 5:37 pm
Location: Scotland
Discord: hootfiend#7981
Contact:

Re: (mapping script) Generic GMCP Mapper Script

Post by Owl »

I've been using this script on my (Envy 1.0-based) MUD and it is working relatively well. The issue I am having is that it won't create rooms properly if they don't have an exit back to the room I came from. For example, if I move south from a room into a room with no exit back north to the room I left, the new room will not be created. Has anyone had a similar issue, and if so, how did they solve the problem?

I have added all the 'fixes' suggested already in this thread, for what it's worth.

Thank you!
Imm over at Dragons Domain MUD

Post Reply