cMud Map Importer

Share your scripts and packages with other Mudlet users.
User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: cMud Map Importer

Post 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).

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

Re: cMud Map Importer

Post by Heiko »

That's a good idea and will be added.

Zenith
Posts: 11
Joined: Sat Jul 09, 2011 7:29 am

Re: cMud Map Importer

Post 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()

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

Re: cMud Map Importer

Post by chris »

display the result of loc, and what [\/] to [\\/]. I'm guesing you use windows?

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

Re: cMud Map Importer

Post by Vadi »

I believe using [[[\/]profiles[/\]]] will make it work for windows

Zenith
Posts: 11
Joined: Sat Jul 09, 2011 7:29 am

Re: cMud Map Importer

Post 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?

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

Re: cMud Map Importer

Post by Vadi »

No, don't use "" with [[]], only [[]]

Zenith
Posts: 11
Joined: Sat Jul 09, 2011 7:29 am

Re: cMud Map Importer

Post by Zenith »

New error.
String 38: ')' expected near ']'

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

Re: cMud Map Importer

Post by chris »

local loc = string.find(dir, "[\\/]profiles[\\/]")

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

ctopha2
Posts: 2
Joined: Tue Jul 12, 2011 3:08 pm

Re: cMud Map Importer

Post 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.

Post Reply