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
Monsoon
Newbie


Joined: 11 Jun 2003
Posts: 9
Location: USA

PostPosted: Mon May 22, 2006 8:31 pm   

Advanced Database Script Problem
 
Ok heres the problem I'm an immortal on a mud. I am trying to create a database of every single object in the mud. Since Im an imm i can use the oedit command and see all the attributes of any object by vnum.

When i type Oedit vnum, i recieve the following pattern:

Name: [axe great]
Area: [ 24] Chris The Keep of Mahn-Tor
Vnum: [ 2345]
Type: [weapon]
Wear flags: [take wield]
Extra flags: [hum magic]
Weight: [26]
Cost: [100000]
Ex desc kwd: [axe great]
Short desc: mahn-Tor's Great Axe
Long desc:
An extremely huge axe is resting here.
Number Modifier Affects
------ -------- -------
[ 0] 4 hitroll
[ 1] 4 damroll
[v0] ItemAffects: 42
[v1] Damage minimum: [5]
[v2] Damage maximum: [5]
[v3] Type: slash


I already have the trigger to capture all of that text. It looks as follows:

#CLASS {EquipmentID}

#TR {Name:%s~[(*)~]} {EquipmentID;#ADDK Equipment Name {%1}}
#TR {Area:%s~[*~]%s%w%s(*)} {#ADDK Equipment Area {%1}}
#TR {Vnum:%s~[%s(%d)~]} {#ADDK Equipment Vnum %1}
#TR {Type:%s~[(&Type)~]} {#ADDK Equipment Type @Type}
#TR {Wear flags:%s~[(*)~]} {#ADDK Equipment Wear {%1}}
#TR {Extra flags:%s~[(*)~]} {#ADDK Equipment Extra {%1}}
#TR {Weight:%s~[(%n)~]} {#ADDK Equipment Weight %1}
#TR {Cost:%s~[(%d)~]} {#ADDK Equipment Cost %1}
#TR {Ex desc kwd:%s~[(*)~]} {#ADDK Equipment Keyword(s) {%1}}
#TR {Short desc:%s(*)} {#ADDK Equipment ShortDesc {%1}}
#TR {Long desc:}
#COND {%s(*)} {#ADDK Equipment LongDesc {%1}}
#TR {~[%s%n~] (%n)%s(*)} {#ADDK Equipment %upper({%2}) %1}
#TR {~[v0~]%s(*):%s(%n)} {#ADDK Equipment {%1} %2}
#TR {~[v1~]%s(*):%s~[(%n)~]} {#ADDK Equipment {%1} %2}
#TR {~[v2~]%s(*):%s~[(%n)~]} {#ADDK Equipment {%1} %2}
#TR {~[v3~]%sType:%s(*)} {#ADDK Equipment WeaponType %1}

#CLASS 0

Now the problem im having is adding this information to the database without duplicates. I'm sure you can use the vnum as a way of determining if the object is a duplicate because two objects never have the same vnum.

Now what i need is a way to put that information into the database without duplicates. Then i can have a variable called maybe NextNum and after the data is input into the database it will send the Oedit NextNum command to the mud where NextNum is equal to the old NextNum plus one. Get it? So what is setup is a way to oedit an object capture all the data into the database and then oedit the next vnum. If anyone knows any way to do this id greatly appreciate it.

Thanx in Advance
-Monsoon
Reply with quote
Iceclaw
Apprentice


Joined: 11 Sep 2005
Posts: 124

PostPosted: Mon May 22, 2006 8:36 pm   
 
I hada a nice loop for this, I created an empty database, and simply had it generate based on a sequential list of vnums, with a delay so it didnt flood the connection and log me out. Does your mud have anything similar to

vnum object all <page number>
where it lists all the objects in order that actually exist with vnums?
Reply with quote
Monsoon
Newbie


Joined: 11 Jun 2003
Posts: 9
Location: USA

PostPosted: Mon May 22, 2006 8:52 pm   
 
No theres no such command. :(
Reply with quote
Iceclaw
Apprentice


Joined: 11 Sep 2005
Posts: 124

PostPosted: Mon May 22, 2006 10:54 pm   
 
What happens if you try to oedit an object that doesnt exist?
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Mon May 22, 2006 11:35 pm   
 
Quote:

Now the problem im having is adding this information to the database without duplicates. I'm sure you can use the vnum as a way of determining if the object is a duplicate because two objects never have the same vnum.

Now what i need is a way to put that information into the database without duplicates. Then i can have a variable called maybe NextNum and after the data is input into the database it will send the Oedit NextNum command to the mud where NextNum is equal to the old NextNum plus one. Get it? So what is setup is a way to oedit an object capture all the data into the database and then oedit the next vnum. If anyone knows any way to do this id greatly appreciate it

Well first off adding to the database should be easy with something like
Code:

%iskey

Syntax: %iskey(rec,key)

returns the key number if the key exists in the record, otherwise returns zero (false).
This function is not case-sensitive.

Examples:

#SHOW %iskey("1sa","Level")
#SHOW %iskey(@RecordVar,"abc")


This will allow you do check before adding. do a check on it to see if its in there if its FALSE then add information if its true the NEXT VNUM etc.

now as to looking your vnum issue

start with oedit 1
#ALIAS vnumcheck {#T+ VNUMIMPORT;oedit 1}
#ALIAS vnumstop {#T- VNUMIMPORT}
#CLASS {VNUMIMPORT}
#VAR NEXTVUM 1
#TRIGGER {SOMESTRING AFTER THE QUERY IS DONE THATS UNIQUE} {#ADD NEXTVNUM 1;#ALARM +2 {oedit @NEXTVNUM}}
#TRIGGER {SOMESTRING THAT SHOWS INVALID VNUM MESSAGE} {#ADD NEXTVNUM 1;#ALARM +2 {oedit @NEXTVNUM}}
#CLASS 0
_________________
Confucious say "Bugs in Programs need Hammer"
Reply with quote
Monsoon
Newbie


Joined: 11 Jun 2003
Posts: 9
Location: USA

PostPosted: Tue May 23, 2006 2:26 am   
 
i dont think %iskey is the command im lookin for...that command doesnt search for the actual data component in the db. it searchse for a field name such as Vnum or Hitroll etc...i want it to make sure no object with the same VNUM is inserted into the db twiced.
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