Simple, Basic Mapping Script Thread

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: Mapping

Post by Heiko »

difficultGeography.PNG
difficultGeography.PNG (24.79 KiB) Viewed 9235 times
You can use custom exit lines to show loops etc. I've also added one way exits now, but it's not yet publicly available. Your MUD is a great example for hard to map classic MUDs that transcend geographic correctness :)

On this map you can see down at 6 o'clock 2 rooms that have 2 one way exits to each other. This is a classic example where you need custom lines e.g. rooms A and B have both exits to each other, but you get from A to B through the northern exit while you get from B to A via the western exit.

Silvine
Posts: 142
Joined: Sat Oct 23, 2010 2:36 pm

Re: Mapping

Post by Silvine »

Exactly what I'm after. If I read correctly and both are not publicly available then I will have to wait. I Don't want to map to much in case I've to start again, so I'm trying to find everything I need right from the start. I'm having great fun though.

I added a couple of things today.
In the mapSetup script added a couple of flags
__twoExits__ to stop the return mapping walking from one room to another
__updateMap__ to stop the entire function initNewRoom() which adds rooms and exits to the map but will still plot where I am on the map if it exists.
Code: [show] | [select all] lua
--map script exists
mudlet = mudlet or {}; mudlet.mapper_script = true
__debug__ = true;
__twoExits__ = false ;
__updateMap__ = false ;
they show in an existing window just so I know what going on with the mapper.
alias.PNG
alias.PNG (15.15 KiB) Viewed 9226 times
Green for on red for off. As its displayed the map will add rooms, but only exits in the direction of travel.
toggles.PNG
toggles.PNG (4.91 KiB) Viewed 9226 times
Code: [show] | [select all] lua
function initNewRoom()
if __updateMap__ then 
	local isNewRoom = addRoom( _mapper_roomID )
	local id = _mapper_roomID
	local roomAreaName = gmcp.room.info.zone 
	local roomAreaID = addAreaName( roomAreaName );
	if roomAreaID == -1 then
		roomAreaID = getRoomAreaName( roomAreaName );
	end --if
	local stepLength = 1;
	
--	lastMoveDirection = command
--	I walk using the keypad so in the hotkeys I made lastMoveDirection = "north" etc
--	if you walk from the command line then use the above line but it does a compare a few
--	lines down so you might want to change north to n etc
 
	if __debug__	then echo("last move command:"..lastMoveDirection.."\n") end--if

	
	if isNewRoom then

		if __debug__ then cecho("<red>ADDED new roomID: "..id.."\n") end--if

		--set room name
		local roomName = gmcp.room.info.name
		setRoomName( id, roomName )
		if __debug__ then cecho("<orange>ADDED room name: "..roomName.."\n") end--if

		-- set room coordinates
		if lastMoveDirection == "west" then --these might need set to 'w' etc
			__mapper_room_x = __mapper_room_x - stepLength; 
			if __twoExits__ then setExit(id, roomID, 4) end;--if --id room in now
			setExit(roomID, id, 5); --roomID room came from
		end--if
		if lastMoveDirection == "east" then 
			__mapper_room_x = __mapper_room_x + stepLength;
			if __twoExits__ then setExit(id, roomID, 5) end;--if 
			setExit(roomID, id, 4); 
		end--if
		if lastMoveDirection == "south" then 
			__mapper_room_y = __mapper_room_y - stepLength; 
			if __twoExits__ then setExit(id, roomID, 1) end;--if 
			setExit(roomID, id, 6); 
		end--if
		if lastMoveDirection == "north" then 
			__mapper_room_y = __mapper_room_y + stepLength; 
			if __twoExits__ then setExit(id, roomID, 6) end;--if 
			setExit(roomID, id, 1); 
		end--if
		if lastMoveDirection == "up" then 
			__mapper_room_z = __mapper_room_z + stepLength; 
			if __twoExits__ then setExit(id, roomID, 10) end;--if 
			setExit(roomID, id, 9); 
		end--if
		if lastMoveDirection == "down" then 
			__mapper_room_z = __mapper_room_z - stepLength; 
			if __twoExits__ then setExit(id, roomID, 9)end;--if
			setExit(roomID, id, 10); 
		end--if

		cecho("<green>guessing new room coordinates\n")
		setRoomCoordinates( id, __mapper_room_x, __mapper_room_y, __mapper_room_z )
		setRoomArea( id, roomAreaID )-- set Area only for new rooms incase you change it


	else
	cecho("<green>KNOWN room, coordinates stay, just adding exits\n")

		if lastMoveDirection == "west" then 
			if __twoExits__ then setExit(id, roomID, 4) end;--if
			setExit(roomID, id, 5); 
		end--if
		if lastMoveDirection == "east" then 
			if __twoExits__ then setExit(id, roomID, 5)end;--if
			setExit(roomID, id, 4); 
		end--if
		if lastMoveDirection == "south" then 
			if __twoExits__ then setExit(id, roomID, 1) end;--if
			setExit(roomID, id, 6); 
		end--if
		if lastMoveDirection == "north" then 
			if __twoExits__ then setExit(id, roomID, 6) end;--if
			setExit(roomID, id, 1); 
		end--if
		if lastMoveDirection == "up" then 
			if __twoExits__ then setExit(id, roomID, 10) end;--if
			setExit(roomID, id, 9); 
		end--if
		if lastMoveDirection == "down" then 
			if __twoExits__ then setExit(id, roomID, 9)end;--if
			setExit(roomID, id, 10); 
		end--if
	
	__mapper_room_x,__mapper_room_y,__mapper_room_z = getRoomCoordinates(id)

	end--if isNewRoom

	roomID = id;
	__SetTerrainColor()--set the sector color
	__roomCollision()--check for rooms in same coordinates

	if __debug__ then
		cecho("<yellow>DIR:"..lastMoveDirection.." new POS("..__mapper_room_x.."/"..__mapper_room_y.."/"..__mapper_room_z..")\n") 
	end--if
else
__mapper_room_x,__mapper_room_y,__mapper_room_z = getRoomCoordinates(_mapper_roomID) -- different roomid here
end--if __updateMap__
end--function
They sit in the script as shown above.
And operate with an alias.
The mud provides all exits from a room so it should be possible to test if the room already exists and has coordinates and if so then it will plot the exit, stop me missing some. But that might spoil my fun if it did that. :D Still the code shouldn't be to tricky so it might fall within the realm of my abilities.
If these posts are pointless and of no interest someone say so ;) I'm just describing my problems as I stumble across them.

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

Re: Mapping

Post by Vadi »

The custom exit lines area already available, one-way exits are available as well - they just aren't visually drawn as such.

Silvine
Posts: 142
Joined: Sat Oct 23, 2010 2:36 pm

Re: Mapping

Post by Silvine »

I can't get anything to draw on the map :(
select room, right click (rc), left click (lc) custom lines, lc color, cl, arrow, cl line type, cl exit button, lc map point, lc another map point, rc the menu comes back up again, tried just about every option. no lines shown anywhere :(

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: Mapping

Post by Heiko »

I'll upload Mudlet-2.0-test7 now. Then you'll be fine.

Silvine
Posts: 142
Joined: Sat Oct 23, 2010 2:36 pm

Re: Mapping

Post by Silvine »

I'm pretty happy with this :D
I had to restart a few times because the lines didn't display, but that could just be me. I also got a strange square box from time to time, I may have been selecting a line by mistake idk really.
Have to fight the urge to custom line everything and try and move the rooms to suit the problem because when I moved a couple of rooms suddenly I didn't need most of the custom lines.
customlines.PNG
customlines.PNG (6.66 KiB) Viewed 9213 times

Silvine
Posts: 142
Joined: Sat Oct 23, 2010 2:36 pm

Re: Mapping

Post by Silvine »

I was wondering is there a way to access the list of room id's that show on the mapper when you select rooms? I find myself doing the same procedure to several rooms and it would be handy if I could select them and then call a function based on the selection. The one that springs to mind is changing the z level.
I really didn't think this zone looked like this :)
MiNar.PNG
MiNar.PNG (33.03 KiB) Viewed 9182 times

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: Mapping

Post by Heiko »

You can select the rooms *on all z-levels* if you use control+lmb+drag instead of lmb+drag to select rooms. You can thus select entire areas and merge them into other areas using the map editor withing seconds.

I'll add a function getMapEditorSelection() to retrieve a list of the selected room ids.

There'll be a new release tonight with a ton of mapper related fixes and improvements.

Silvine
Posts: 142
Joined: Sat Oct 23, 2010 2:36 pm

Re: Mapping

Post by Silvine »

Thanks :)
Eagerly awaiting it.

User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: Mapping

Post by chris »

You can already do this with the user definable mapper hooks.

Post Reply