Mudlett mapper. How to make it work?

All and any discussion and development of the Mudlet Mapper.
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 »

What do you mean by dot? Current position indicator? If so -> centerview(roomID)

For goto scripts checkout the getPath() function that sets 2 lists (tables) with the room IDs and command list that you need to use to get to your desired location. You basically setup a timer and use the command list from start to end until you arrive at your destination. You can use the roomID list to verify if you're still on the correct path when entering a new room while auto walking.

The mapper draws rooms at their x,y,z position. If the position isn't correct, then you're script doesn't calculate the position correctly. Usually, people mess up their variables -> use plenty of debug echos when parsing the roomID and calculating the new room position. It's usually a good idea to only calculate room positions for new rooms once and leave existing room positions alone. Otherwise you can't use the visual map editor effectively.

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 used you advice to create allias and i will use it with
Code: [show] | [select all] lua
^/mapperMove (.*)$

mapperPositionX, mapperPositionY, mapperPositionZ = getRoomCoordinates(matches[2])
mapperAreaID = matches[2]
echo("roomID:"..mapperRoomID.." POS("..mapperPositionX.."/"..mapperPositionY.."/"..mapperPositionZ..")\n")
Code: [show] | [select all] lua
testMMap = mapperCheckExits(matches[2])
echo("\n "..testMap)
or
Code: [show] | [select all] lua
gotoRoom(matches[2]) 

i get errors like:

(a boolean value)
(a nil value)


can you give me an example of working script?
specially something to walk by existing exits not by create new location

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 know why but:

getRoomExits(roomID)

is not working at all :/ I think that causes most problems


Edit:

That is because i don't have proper room exits table?

Where/How I can get one? :)

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

Re: Mudlett mapper. How to make it work?

Post by Vadi »

Is roomID a valid room you've created in the mapper?

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 look closely at the Lua runtime errors -> red ! button in trigger editor. This will show you the errors in your script at runtime -> aka bad variable initialization/useage

e.g. you need to be careful what type of variable you are using: matches[2] is always a string value, not a number -> tonumber(matches[2])

There's plenty of examples of working scripts -> sticky mapper topics. If you need more help you need to post more specific information i.e. screenshot of the error view and the corresponding script.

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

Re: Mudlett mapper. How to make it work?

Post by azure_glass »

e.g. you need to be careful what type of variable you are using: matches[2] is always a string value, not a number -> tonumber(matches[2])
Not in that case because
Code: [show] | [select all] lua
centerview(matches[2])
mapperMoveRoom(matches[2])
is working propertly

-------------------------------------------------------------------

Image


The compass (grey square and green ones near him) is working unrelated to mapper. Maybe i can use that code to create exits table? I really don't know what to do :/

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 »

azure_glass wrote:
e.g. you need to be careful what type of variable you are using: matches[2] is always a string value, not a number -> tonumber(matches[2])
Not in that case because
Code: [show] | [select all] lua
centerview(matches[2])
mapperMoveRoom(matches[2])
is working propertly
Impossible. centerview(id) expects a number, not a string value - and matches[2] is invariably a string value. Note that the string "2" does not equal the number 2.

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 swear it really works :) anyway..

What information do you need to help me?

Maybe i can upload some .xml with scripts... be right back


script:

http://wklej.to/PfvFr

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 »

It "works" if Lua is able to cast the string matches[2] into an integer value - same thing as the echo() functions, but it will break in all cases where Lua can't e.g. if matches[2] < 5 then ... end
This is why you should generally use explicit casting to the proper data type when using the matches table. This helps make things more straightforward and avoids errors.

Your problem was that somewhere in your scripts you are messing up some variables of yours and thus calculate "wrong" room coordinates. To solve these issues you need to use variable tracing to find out where in your scripts you mess up your variables, room coordinates etc..

roomExits() doesn't contain any special exits -> getSpecialExits(roomID)

These functions return a table. You can use the function display(t) to see what the table contains.

If you want more specific answers, you need to post more specific questions as I don't have the time to look at your script.

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

Re: Mudlett mapper. How to make it work?

Post by azure_glass »

Okay :)

One specyfic question

Why when I rigt-click on location there are few existing exits and i can't recive table of them by roomExits()?

Post Reply