Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
AlT
Beginner


Joined: 11 Jun 2003
Posts: 22
Location: Moldova

PostPosted: Wed Jul 30, 2003 3:58 pm   

Query database
 
Okay, i have an items database in zmud. It have many field types, but the question is about "option list" type. So to keep it short i will represent following db format.

Name (is a String) - WearOn (is an Option List with following orptions: take, hold, wield, body, neck)

Well, now i have several items in db.
Sword - take, wield
Dagger - take, wield, hold
Armor - take, body
Light - take, hold, neck
Sack - take, hold
Key - take

Now the question itself. I can't figure a way to query this database by the WearOn field. For example i want to see all items that can be hold. Or all items that can be wielded. However %query command looks up only entire contents of a WearOn field and don't allows to match with part of the string.
%query((&WornOn =~ "take")) works perfect and in my example shows the item "Key".
%query((&WornOn =~ "take, hold")) works perfect also and will show the item "Sack".
%query((&WornOn =~ "hold")) don't works and output is empty.
Tryed to match with a pattern using wildcards, but it doesn't works either.

Any help would be appreciated.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Jul 31, 2003 12:33 am   
 
It would appear that %query can use anything that inteprets to an expression. While I haven't tested this personally you should be able to use %query((%pos("hold",&WornOn),All) to find all records that have the "hold" option set. In order to do multiple option testing it would be %query(((%pos("hold",&WearOn))&(%pos("take",&WearOn))),All)

As you can see this would get quite messy. I would suggest establishing a number of Views for the combinations you use more often, and I would suggest you eliminate the "take" option. Not to many items really have much use if you can't take em.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net