![](templates/Classic/images/spacer.gif) |
spoonfoy Newbie
Joined: 10 Oct 2016 Posts: 5 Location: NC, USA
|
Posted: Fri Oct 21, 2016 12:07 am
Trying to Create a Database |
so, im PRESUMING this is possible, but i dont know for sure, so any help would be appreciated.
im using zMUD 7.20 (but i'd be willing to buy cMUD as well if thats whats necessary for this to actually work).
im trying to build a database of items in the mud i play, so that i can use an alias to pull them up and know the stats without remembering them/writing them down IRL.
so, i need to capture multiple lines of info. it looks like this:
You feel informed:
Object 'armor dragon skin', Item type: ARMOR
Item is: MAGIC
Level: 15 Rest: >=10
Weight: 16, Value: 50000, Rent cost: 2000
AC-apply is 15 but is effectively 15
Can affect you as:
Affects: HIT By 15
the items can have up to like 10 effects on them (hitroll, hp, damroll, mana, mana-regen, move, move-regen, +skill to certain abilities, etc.), so i would need to capture an indeterminate amount of lines (sometimes 5, sometimes 15). the easiest way i can think to do that would be to just capture all lines up to a prompt line from the mud, but i dont know how to do that.
the keywords for the item are listed on the line starting with "Object" and are within the apostrophes.
things im trying to accomplish with this:
1 - capture all information for an identified item and store it in a database, to be looked up at a later time.
2 - be able to look items up using 1 or more of the keywords in any combination or order (for instance, i would want to be able to find this item with "armor dragon" or "skin armor").
3 - output this information directly to my window using the #SAY or #SHOW command most likely.
4 - if possible, and this is ideal circumstances, id like to be able to look up items by effects, level, etc. for instance, performing a search for "affects hit" would return this item, and any others with the same effect, or searching for items "level <=15" would return this, along with others. if this is ridiculous amount of coding or work, id be satisfied with just the first three, but if this is possible, id love to be pointed in the right direction for accomplishing this.
ive looked through some other threads about databases, but they all kinda went over my head unfortunately without explaining a whole lot of how to actually start one, and call info from one. ive also tried to piece together how to capture multiple lines through helpfiles, but cant seem to find anything on multiline capture, so im guessing theres some trick or magic to it.
if anyone could ELI5 the steps, i would be exceptionally grateful.
thank you so much in advance. |
|
|
![](templates/Classic/images/spacer.gif) |
Vijilante SubAdmin
![](images/avatars/7230815434153eca6be3ad.gif)
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Fri Oct 21, 2016 3:49 am |
This might be a little easier in CMud because CMud has direct support to connect with and work with an SQLite database. The functions %sqldb and %sql make the connections and support the queries. zMud's built in database was generally bad and does not have nearly half of the searching power that SQL provides.
The capture part is relatively easy:
Code: |
#CLASS IdentifyCapture
#VAR IDData {} {}
#ONINPUT "IDCap" {id (*)} {IDData=""}
#COND {^You feel informed:$} {}
#COND {} {#IF (%match(%line, "prompt pattern")) {#STATE IDCap 0;ParseIDData} {IDData=%concat(@IDData,"|",%line)}} {looplines|param=100}
#ALIAS ParseIDData {IDData=%replace(@IDData, "Can affect you as:", "")
IDData=%subchar(@IDData, ",:'", "|=")
IDData=%replace(@IDData, " but is effectively ", "--")
IDData=%replace(@IDData, "is", "=")
IDData=%replace(@IDData, "Object ", "Keywords=")
#DELITEM IDData {}}
#CLASS 0 |
Obviously not a complete parsing an reformatting, but it should be enough of a start to point you in the right direction. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
![](templates/Classic/images/spacer.gif) |
|
|
|
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
|
|