|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Mon Feb 02, 2004 6:40 am
Database Script |
zMud 6.67
Ok since I am at a total loss on using the Database I guess Im gonna ask here if someone has the time to help me getting started. After one or two examples I should be able to go from there.
I want to capture Whois Lines and put them in a database without duplicates and easily set them up (hopefully).
right now I have all the lines capturing to a string list and using alot of silly manipulations to store and retrive them and would rather have them in a database so Here goes
I use this to succesfully capture the Whois Line
Code: |
#tr {^ ...(*)$} {#IF (@whois_up=1) {#ADDITEM whois_self "%1"} {#ADDITEM whois_list "%1"}} |
Example line
Code: |
...is the strongest person alive!
|
I want to store whois_list part in the WHOIS database List field and anytime whois_up=1 instead of storing I want toloop through the list field and set/change the status field to Got for the ones that show it captures.
list <-the whois captured from trigger
status <-with an option list of [Got, Not, Cant]
zone <-opt list of [gen, anc, med, ind]
area <-opt list of [tara, romania, london]
Since currently the only info that can be inputted into the database from a trigger is the list.
after the Whois are in I need a Alias (loopdb or somesuch) that will check to see if list, status, zone, or area are empty and #prompt me to pick the correct option (if possible)
and an alias to display the ones marked not.
after that is set up I SHOULD be able to figure out the rest. If not I'll just have to ask for more help!. Thanks for all your time. If this is not enough info lemme know what else ya need and I will see what I can do to help.
And would it be possible to set up these views in the DB
All, Got, Not, Cant, Zone Gen, Zone Anc, Zone Med, Zone Ind, Area, |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue Feb 03, 2004 8:16 pm |
Sorry, I've read this several times and I still have no idea what you want to do or what you are having problems with. I notice that nobody else has responded so it's likely that everyone is as confused as I am.
It might help to do the following:
stuff in blue is just examples I made up
Give us the command(s) you send to get this information.
who
identify sword
Give us an actual sample of all the text the MUD outputs in response to that command. If it's repetitive, such as a Who list would be, 5 lines/repeats is usually enough. If it's nonrepetitive, such as an identify would be, include everything from the first line to the last line.
Explain exactly what information from the output you need to capture.
I need the first word as the name. It can contain capital letters, small letters, and numbers.
I need all the stuff between ' and ' for the item
If there is additional information which will come from other sources, tell us what that information is and how you will get it.
a variable named @zone from another trigger
I'll choose a status with the #PICK command
It's unusual for a post to go unanswered for over a day. When it happens, it usually means you need to rephrase your question because nobody was able to figure out what you meant. |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Wed Feb 04, 2004 3:39 am |
Hehe I knew that was coming OK lets do this one step at a time then maybe it will help everyone Theres not really any commands to show as its just lines I want to add to the DB if there not there, Also figured out how to setup the Views in the DB and the DB is set up with the fields I need. I just need to learn to move stuff around
STEP 1
I need to capture every line that begins with three spaces then three periods like this
...is the strongest person alive!
so I use this working trigger
Code: |
#tr {^ ...(*)$} {#say %1} |
Now what I want to do with the %1 is Add it to the WHOIS database under the LIST field if its not already in the database list field and then set the Status field to need
So I think I want this (seems to work or is there a better way to do it)
Code: |
#tr {^ ...(*)$} {whois_list="%1";#IF (%numitems( %query( &List = @whois_list))=0) {#NEW all {List=%1|Status=need}} {#noop}} |
STEP 2
Ok now For me it gets harder..... I need to expand that trigger so that Anytime that whois_self=1 Instead of Adding to the database List field it loops through List and Sets/changes the STATUS field to have for any line thats captured with the trigger while whois_self=1
STEP 3
Are ya with me so far? ok now I need an Alias for the sake of argument lets call it SetArea
what I need this to do if its possible is to Loop through the DB ALL view and for every null Zone field prompt me through some way or another to set the Zone field to either one of Gen, Anc, Med, or IND
STEP 4
And for right now the last thing I can think of I need an alias lets call it ShowNeed that will loop through the DB and for every Status field that is Need will output the List it to my screen in a #echo or some such on field per line
And I should be able to figure out the rest from there |
|
|
|
Danlo Magician
Joined: 28 Nov 2003 Posts: 313 Location: Australia
|
Posted: Wed Feb 04, 2004 8:46 am |
Step 1:
If it works, keep it. But, you can edit out a few needless commands:
#TR {^ ...(*)} {#IF (%numitems( %query( &List = %1))) {} {#NEW WHOIS {List=%1|Status=need}}}
Step 2:
#TRIGGER {(@whois_self=1)} {} "" "LoopExp"
#CONDITION {^ ...(*)} {#NEW WHOIS {List=%1|Status=need}} "reparse"
Step 3:
#alias SetArea {#LOOPVIEW DB_ALL {#IF (%null(&zone)) {#PICK {p:Zone is Null. Pick a value:} {O:1} {Gen:&zone=Gen} {Anc:&zone=Anc} {Med:&zone=Med} {IND:&zone=IND}}}}
Step 4:
#alias ShowNeed {#LOOPVIEW WHOIS {#IF (&status =~ "need") {#ECHO &list is in Need.}}}
PS. I'm not sure if Step 2 will work, as I can't test it on my current version.
Edit: Inserted some missing {} |
|
|
|
|
|
|
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
|
|