 |
calesta Apprentice
Joined: 07 Dec 2008 Posts: 102 Location: New Hampshire, USA
|
Posted: Wed Dec 10, 2008 10:37 pm
Database help please |
I have created a simple database named coordinates.db with 4 columns (Location, Type, X, Y) representing coordinates for sailing and balloon locations on my MUD. Currently this database just has two records while I am trying to learn how to use it through scripts. I have created 2 views in this database, one that shows the Sailing locations and one that shows the Balloon locations. Both views are sorted by Location. If I click the DB button after opening my session, the database shows up fine through the GUI. I can then use the following code to switch views and see the data:
Code: |
#view Sailing
#view |
The first problem I am seeing is when I am trying to load the database without having to click the DB button. I am using the following commands:
Code: |
#dbload co
#view Sailing
#view |
I expected this to show the same data as when I manually loaded the database, but instead I am getting nothing. Am I missing a step here somewhere?
The second problem I am having is with the #loopview command. Even after I load the database manually and can see the data using the #view command, I can't get the #loopview command to show me any data. Here is the code I am using:
Code: |
#view Sailing
#loopview {
#show Location &Location
} |
or
Code: |
#loopview Sailing {
#show Location &Location
} |
In the first case I get no output at all. In the second case, I get the string 'Sailing' displayed in the output window in yellow text twice. This seems to imply it's seeing both records like it should... but I'm not getting the output I was going for. I can successfully work around this one by using the %find and %query which both seem to work, but I was curious if I was missing something for this command.
The last problem is related to the interaction with the script and the database GUI. If I close the DB window and then use the #view command without issuing the #dboffline command first, the database GUI is automatically opened. The problem is that I can't seem to close this GUI when it has been opened in this manner. The only way I can get rid of it is to completely exit cMUD. |
|
|
 |
Tech GURU

Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Fri Dec 12, 2008 10:18 pm |
If I recall correctly the DB windows has to be opened the first time you use it. At least that was the case in zMUD and until the database module rewrite in the future I think that requirement will be in CMUD. As for the #LOOPVIEW command it seems it is partially broken.
To get what you want done you're best bet is to do something like the following.
Code: |
#view Sailing
#loopview "#show Location &Location"
|
I've submitted a bug report to Zugg on the issue with #LOOPVIEW |
|
_________________ Asati di tempari! |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Dec 12, 2008 10:28 pm |
Unfortunately, this probably won't get fixed until the database module is rewritten to work better with CMUD.
Tech is correct that the DB window must be opened for anything to work with the database. And yes, the #LOOPVIEW command requires a string argument, so Tech is correct about putting quotes around it. The database module will then execute the string statement. |
|
|
 |
calesta Apprentice
Joined: 07 Dec 2008 Posts: 102 Location: New Hampshire, USA
|
Posted: Fri Dec 12, 2008 10:39 pm |
I'll look forward to the database rewrite in that case. Would be very nice to not have to manually open the database manually for what I am trying to do.
I'll post a comment on the docs page for the #loopview issue. Does the fact that it takes a string argument mean that it can only loop over the current view instead of taking a view parameter like the current doc implies or is there some syntax that allows it to work on any view?
Thanks for the responses! |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Dec 12, 2008 10:50 pm |
No, it can still take a view parameter. It's just the command argument itself that needs to be a string value.
|
|
|
 |
Tech GURU

Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Sat Dec 13, 2008 6:25 pm |
Hey Zugg, I've got to go with calesta with this one. I've tried every way I can think of and i couldn't get to specify the view with the command. Can you post if/how you got it done.
|
|
_________________ Asati di tempari! |
|
|
 |
|
|