Page 1 of 2

Mudlett mapper. How to make it work?

Posted: Sun Apr 07, 2013 3:03 pm
by azure_glass
1/ How to make first location on mapper? (No map or valid position)?

Re: Mudlett mapper. How to make it work?

Posted: Sun Apr 07, 2013 9:15 pm
by Vadi
Depends on which mapping script are you using with it, which game are you playing?

Re: Mudlett mapper. How to make it work?

Posted: Mon Apr 08, 2013 5:25 pm
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.

Re: Mudlett mapper. How to make it work?

Posted: Mon Apr 08, 2013 8:20 pm
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

Re: Mudlett mapper. How to make it work?

Posted: Tue Apr 09, 2013 11:59 am
by azure_glass
For me any script dosen't work.

None of them start a first location..

Re: Mudlett mapper. How to make it work?

Posted: Tue Apr 09, 2013 1:53 pm
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.

Re: Mudlett mapper. How to make it work?

Posted: Tue Jul 16, 2013 12:11 pm
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?

Re: Mudlett mapper. How to make it work?

Posted: Wed Jul 17, 2013 8:15 am
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.

Re: Mudlett mapper. How to make it work?

Posted: Wed Jul 17, 2013 3:38 pm
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.

Re: Mudlett mapper. How to make it work?

Posted: Fri Jul 19, 2013 11:00 am
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