Page 3 of 10

Re: cMud Map Importer

Posted: Wed Jul 06, 2011 8:04 pm
by chris
The [\/] I bet was bugging out because the \ is an escape character, it is actually extremely important in parsing the file path. try replacing them with [\\/] instead.

The null roomdesc: xxx means the room descs are empty for the room, but all other room info is loaded.

For cmud maps, centerview(1) is not a good idea, 1 is probably non-existent. You can try centerview(820) because you know that room exists, or doing searchRooms("blah blah") to get an idea of where you can place yourself to start building your mapper script.

In general, there is quite a bit of inertia to overcome to get yourself off the ground. Ideally you could click on an area, have it come up with the rooms in that area and via mouse set your position. I've hacked a script together to do that, but a mudlet implemented version of that would be nice (a set location here via right clicking on a room).

Re: cMud Map Importer

Posted: Wed Jul 06, 2011 8:29 pm
by Heiko
That's a good idea and will be added.

Re: cMud Map Importer

Posted: Sat Jul 09, 2011 7:33 am
by Zenith
Im a total noob so please explain simple to me.

I cant run this because of the SqlMap initiator script wont work.
Error on string 39; Atempt to perform arithmetic on local 'loc' (a nil value)

require "luasql"

function closeSql()
if con then
con:close()
con = nil
end
if env then
env:close()
env = nil
end
end

function makeSqlDB()
closeSql()
initSql()
local s,m = con:execute([[
CREATE TABLE Rooms(
UId INTEGER PRIMARY KEY AUTOINCREMENT,
RoomId INTERGER,
RoomDesc varchar,
RoomScript varchar
)
]])
return s,m
end

function initSql()
-- create environment object
env = assert (luasql.sqlite3())
-- connect to data source
local dir = getMudletHomeDir()
local loc = string.find(dir, "[\/]profiles[/\]")
local profilename = string.sub(dir,loc+10)
local file = getMudletHomeDir().."/"..profilename.."_map.sqlite3"
con = assert (env:connect(file))
end
initSql()

Re: cMud Map Importer

Posted: Sat Jul 09, 2011 3:01 pm
by chris
display the result of loc, and what [\/] to [\\/]. I'm guesing you use windows?

Re: cMud Map Importer

Posted: Sat Jul 09, 2011 3:11 pm
by Vadi
I believe using [[[\/]profiles[/\]]] will make it work for windows

Re: cMud Map Importer

Posted: Sat Jul 09, 2011 6:52 pm
by Zenith
chris wrote:display the result of loc, and what [\/] to [\\/]. I'm guesing you use windows?
No clue what you mean :D

local loc = string.find(dir, "[[[\/]profiles[/\]]]")
Changed it to this, same error.
[ERROR:] object:<Create the DB for the map> function:<Alias9>
<[string "-------------------------------------------..."]:39: attempt to perform arithmetic on local 'loc' (a nil value)>

Windows Vista (64bit), its in Norwegian and not in english though, does that have anything to say?

Re: cMud Map Importer

Posted: Sat Jul 09, 2011 7:00 pm
by Vadi
No, don't use "" with [[]], only [[]]

Re: cMud Map Importer

Posted: Sat Jul 09, 2011 7:10 pm
by Zenith
New error.
String 38: ')' expected near ']'

Re: cMud Map Importer

Posted: Sat Jul 09, 2011 7:43 pm
by chris
local loc = string.find(dir, "[\\/]profiles[\\/]")

The reason [[]] isn't working is because [] is pattern matching

Re: cMud Map Importer

Posted: Tue Jul 12, 2011 3:10 pm
by ctopha2
Ok first off, I think your script is amazing (as soon as I can get it to work).

I created the database and imported just fine. I opened up the map, and nothing. I click in the map area and I get a popup stating: ERROR: Target room cannot be found in map db.

What did I do wrong? I am a bit of a newb with scripting, so any help is appreciated.