Er, have you seen this?
That basically does what you describe, unless I misunderstand what you are saying.
Ashass said:
Needless to say, I'm also using VBScript
Well you will have to rewrite it totally then. The version presented there is in Lua. However if you insist on using VBscript you could use it as a guide for the general techniques.
Ashass said:
Database example below
ID - room id, bigint
area - area you are in, nvarchar(50)
roomname - room in area you are in, nvarchar(50)
exits - NESWUD-NW-NE-SE-SW directions, nvarchar(50)
exitnorth - Name of room to north, nvarchar(50)
exitsouth - Name of room to south, nvarchar(50)
...east
...west
...up
...down
...nw
...ne
...se
...sw
Really, this is not good database design. For one thing, in SQL you shouldn't have repeated things (in this case multiple exits) in a table - they should be in a separate table. The example GMCP mapper I did uses a database, and has exits in a separate table.
For another thing, in a single entry you will have duplicated information. Namely the name of the current room, and then for each exit, the names of the rooms they lead to.
So if you need to change a room name, then not only does the current room need to be changed, but every other room that happens to lead to it needs changing as well.
A better SQL layout is:
- Room table:
- Room ID (room number)
- Room area
- Room name
- Room description
- Notes
- Exit table:
- Exit ID (assigned as some autoincrement number)
- Which room it belongs to (parent) - ID in room table
- Which way it leads (eg. n, s, e, w)
- Which room it leads to
- Area table:
- Area ID
- Area description
- Area notes (eg. terrain)
- Area low-level range
- Area high-level range
So to find a room's exits you simply do a simple query that returns all exits whose room ID matches the current room ID.
Then, for each exit you find the room name. In fact a "join" query would return all exits, and their associated "to" room names, in one query.
I did another version of the mapper for a non GMCP MUD (Materia Magica) here:
That (from memory) does what you describe, in that it matches exit lines and tries to work out which exits a room has, at least.
|