Mudlett mapper. How to make it work?

All and any discussion and development of the Mudlet Mapper.
azure_glass
Posts: 97
Joined: Wed Jul 25, 2012 12:35 pm

Mudlett mapper. How to make it work?

Post by azure_glass »

1/ How to make first location on mapper? (No map or valid position)?

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

Re: Mudlett mapper. How to make it work?

Post by Vadi »

Depends on which mapping script are you using with it, which game are you playing?

azure_glass
Posts: 97
Joined: Wed Jul 25, 2012 12:35 pm

Re: Mudlett mapper. How to make it work?

Post by azure_glass »

I don't use any script...

I'm playing Arkadia. Engine for that is LPMud


I have one of cmud map's one from my mud-mates but i don't have skills implement that to mudlett.

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

Re: Mudlett mapper. How to make it work?

Post by Vadi »

You do need a mapper script to make it work on your MUD, as MUDs are quite different... maybe the LP one might help you: http://forums.mudlet.org/viewtopic.php?f=13&t=1979

azure_glass
Posts: 97
Joined: Wed Jul 25, 2012 12:35 pm

Re: Mudlett mapper. How to make it work?

Post by azure_glass »

For me any script dosen't work.

None of them start a first location..

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

Re: Mudlett mapper. How to make it work?

Post by Heiko »

You need to adapt the scripts to fit your game. Check out the mapper documentation on the wiki. To set a location use the function centerview(roomID) e.g. centerview(1) if your current room has ID 1. If your room ID aren't integer values you can use the getHashByID() functions to translate your room IDs to integers.

azure_glass
Posts: 97
Joined: Wed Jul 25, 2012 12:35 pm

Re: Mudlett mapper. How to make it work?

Post by azure_glass »

I use "generic mapper script" so i can draw a normal map

Before I start mapping for good I want to know, how to avoid drawing map in case

e
You are to weak to go in that direction
(Mapper draws, a new location)

There is a single script to avoid that?

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

Re: Mudlett mapper. How to make it work?

Post by Vadi »

It would depend on when is the script drawing. If it's only drawing on a new room, then it wouldn't do that.

Jor'Mox
Posts: 1142
Joined: Wed Apr 03, 2013 2:19 am

Re: Mudlett mapper. How to make it work?

Post by Jor'Mox »

If you have areas with identical room descriptions, I would recommend having a special command to add the room to the map, otherwise it would be impossible to distinguish.

azure_glass
Posts: 97
Joined: Wed Jul 25, 2012 12:35 pm

Re: Mudlett mapper. How to make it work?

Post by azure_glass »

Code: [show] | [select all] lua
function mapperMoveRoom( id )
	mapperRoomID = id
	mapperPositionX, mapperPositionY, mapperPositionZ = getRoomCoordinates( id )
	mapperAreaID = getRoomArea( id )
end

function mapperCheckExits( dir )
	if not mapperRoomID then return false end
	if not roomExists(mapperRoomID ) then return false end
	local exits = getRoomExits(mapperRoomID);
	if not exits then return false; end

	if dir == "n" then 
		if table.contains(exits, "polnoc" ) then
			mapperMoveRoom( exits["polnoc"] )
			return true
		end  
	end
	if dir == "s" then 
		if table.contains(exits, "poludnie" ) then
			mapperMoveRoom( exits["poludnie"] )
			return true
		end  
	end
	if dir == "w" then 
		if table.contains(exits, "zachod" ) then
			mapperMoveRoom( exits["zachod"] )
			return true
		end  
	end
	if dir == "e" then 
		if table.contains(exits, "wschod" ) then
			mapperMoveRoom( exits["wschod"] )
			return true
		end  
	end
	if dir == "nw" then 
		if table.contains(exits, "polnocny-zachod" ) then
			mapperMoveRoom( exits["polnocny-zachod"] )
			return true
		end  
	end
	if dir == "ne" then 
		if table.contains(exits, "polnocny-wschod" ) then
			mapperMoveRoom( exits["polnocny-wschod"] )
			return true
		end  
	end
	if dir == "sw" then 
		if table.contains(exits, "poludniowy-zachod" ) then
			mapperMoveRoom( exits["poludniowy-zachod"] )
			return true
		end  
	end
	if dir == "se" then 
		if table.contains(exits, "poludniowy-wschod" ) then
			mapperMoveRoom( exits["poludniowy-wschod"] )
			return true
		end  
	end
	if dir == "up" then 
		if table.contains(exits, "up" ) then
			mapperMoveRoom( exits["up"] )
			return true
		end  
	end
	if dir == "down" then 
		if table.contains(exits, "north" ) then
			mapperMoveRoom( exits["north"] )
			return true
		end  
	end
	if dir == "in" then 
		if table.contains(exits, "in" ) then
			mapperMoveRoom( exits["in"] )
			return true
		end  
	end
	if dir == "out" then 
		if table.contains(exits, "out" ) then
			mapperMoveRoom( exits["out"] )
			return true
		end  
	end

	return false
end



function mapperMove( dir )
	local _dir = 0; -- exit direction value see defines above
	if not mapperCheckExits( dir ) then
		if dir == "n" then mapperPositionY = mapperPositionY + mapperStep; _dir = 1 end
		if dir == "s" then mapperPositionY = mapperPositionY - mapperStep; _dir = 6 end
		if dir == "w" then mapperPositionX = mapperPositionX - mapperStep; _dir = 5 end
		if dir == "e" then mapperPositionX = mapperPositionX + mapperStep; _dir = 4 end
		if dir == "nw" then mapperPositionY = mapperPositionY + mapperStep; mapperPositionX = mapperPositionX - mapperStep; _dir = 3 end
		if dir == "ne" then mapperPositionY = mapperPositionY + mapperStep; mapperPositionX = mapperPositionX + mapperStep; _dir = 2 end
		if dir == "sw" then mapperPositionY = mapperPositionY - mapperStep; mapperPositionX = mapperPositionX - mapperStep; _dir = 8 end
		if dir == "se" then mapperPositionY = mapperPositionY - mapperStep; mapperPositionX = mapperPositionX + mapperStep; _dir = 7 end
		if dir == "up" then mapperPositionZ = mapperPositionZ + 1; end
		if dir == "down" then mapperPositionZ = mapperPositionZ - 1; end
		
		local roomCollisions = {}
	
		if getAreaRooms( 1 ) ~= nil then
			numRooms = getAreaRooms(1)
			if # numRooms > 0 then 
				roomCollisions = getRoomsByPosition( mapperAreaID, mapperPositionX, mapperPositionY, mapperPositionZ )
--display(roomCollisions)
--echo("size="..table.size(roomCollisions).."\n")					
if table.size(roomCollisions) > 0 then
					--echo("(mapper:) Kolizje lokacji: size="..table.size(roomCollisions).."\n")
					--display(roomCollisions )
					--echo("(mapper:) scalam lokacje\n");
					mapperRoomID_old = mapperRoomID
					mapperRoomID = roomCollisions[0]
					setExit( mapperRoomID_old, mapperRoomID, _dir )
					setExit( mapperRoomID, mapperRoomID_old, mapperDirectionInvers[_dir] )
				end
			else
				echo("Lokacja nie ma raeume???\n")
			end
		end
		if table.size(roomCollisions) == 0 then
			--echo("Tworze nowa lokacje\n")
			mapperRoomID_old = mapperRoomID
			mapperRoomID = createRoomID();
			addRoom(mapperRoomID)
			setRoomCoordinates( mapperRoomID, mapperPositionX, mapperPositionY, mapperPositionZ )
			setRoomArea( mapperRoomID, mapperAreaID )
			setRoomEnv( mapperRoomID, 2 )
			setExit( mapperRoomID_old, mapperRoomID, _dir )
			setExit( mapperRoomID, mapperRoomID_old, mapperDirectionInvers[_dir] )
			--display(getAreaRooms(1))
		else
			--display(roomCollisions)
		end
	end
	centerview( mapperRoomID )
--echo("roomID:"..mapperRoomID.." POS("..mapperPositionX.."/"..mapperPositionY.."/"..mapperPositionZ..") Ruch udany\n")
end
Example walking script:
Code: [show] | [select all] lua
Pattern: ^nw$

send("nw")
if direction_northwest == 1 then
mapperMove("nw")
end
That's working but I have few problems.

How to set dot on location i mathed ?
Because mapper sometimes when I have huge ping script don't matches right exits and he's drawing map when he shouldn’t.

Can you give me an example of gotoRoom() command?

Allias:
code: gotoRoom(1)
Code: [show] | [select all] lua
Alias name=^/goto (.*)$(^/goto (.*)$) matched.
Alias: capture group #1 = </goto 1>
Alias: capture group #2 = <1>
LUA: ERROR running script  (doSpeedWalk) ERROR:attempt to call a nil valueLUA OK script ^/goto (.
*)$ (Alias218) ran without errors

There is a manual to special exits?


And when I select few locations and relocate them mapper draws location instead to move dot to right location.

after going to east:
1 - Mapper drawing false location
2 - Dot should be here

Image

Post Reply