|
Einder Novice
Joined: 03 Jan 2008 Posts: 48
|
Posted: Fri Dec 30, 2011 8:44 am
Maps To Variable Database Script |
I'm currently working on a script to convert maps to variable databases, so that I can add to it later with minimal effort. The script seems right, however it doesn't work. Can anyone help me with this?
Code: |
#LOOP %numrooms {
MVnum = %mapvnum( %i)
#if (!%null( %roomname( @mvnum)) & %roomcost( @mvnum)<1000) {
QResult = %query( &RoomName = %roomname( @mvnum), All)
#if (!%null( @QResult)) {
MapDB = @QResult
#DBGet @mapdb ""
#DBPut @mapdb RoomName %roomname( @mvnum) {RoomVnum %additem( @mvnum, &RoomVnum)}
} {#NEW "" RoomName=%roomname( @mvnum) {RoomVnum=@mvnum}}
}
} |
It seems as if there is an error in parsing the null check, I'm not understanding what the issue could be or how to fix it. |
|
|
|
Einder Novice
Joined: 03 Jan 2008 Posts: 48
|
Posted: Wed Jan 04, 2012 3:32 pm |
So I took out the first null check, and the script now looks like this:
Code: |
#LOOP %numrooms {
MVnum = %mapvnum( %i)
#if (%roomname( @mvnum) & %roomcost( @mvnum)<1000) {
QResult = %query( &RoomName=%roomname( @mvnum), All)
#if (!%null( @QResult)) {
MapDB = @QResult
#DBGet @mapdb ""
#DBPut @mapdb RoomName=%additem( %roomname( @mvnum)) {RoomVnum=%additem( @mvnum)}
} {#NEW "" RoomName=%roomname( @mvnum) {RoomVnum=@mvnum}}
}
} |
Taking out the first null check got it to run till it gets to the %query, at which point it doesn't do anything. Any ideas as to why or how to fix it perhaps? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed Jan 04, 2012 8:21 pm |
Why are you converting to the DB module format instead of sticking with SQL? SQL is far faster, and the mapfile is already in SQL format.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Progonoi Magician
Joined: 28 Jan 2007 Posts: 430
|
Posted: Wed Jan 04, 2012 8:51 pm |
Unless he mis-posted, I think he means it for ZMud, not CMud.
|
|
_________________ The Proud new owner of CMud.
--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
-------------------------------- |
|
|
|
Einder Novice
Joined: 03 Jan 2008 Posts: 48
|
Posted: Wed Jan 04, 2012 11:28 pm |
When running multiple searches it's easier to search the database then it is my maps.
and yes Progonoi, this is zMud not cMud. |
|
|
|
|
|