|
drexor Newbie
Joined: 21 Aug 2008 Posts: 4 Location: Topeka, KS
|
Posted: Tue Aug 26, 2008 4:14 pm
DB one to many relationships |
I currently have 2 db's set up, one is HE (herbs) the other is HL (Herb Locations)
Herbs contains the description of the herb (sharp broad leaf), name (mint) and descriptive info (what it's used for etc)
i enter a room search for herbs, i have a trigger set for "you find a (*)!" namely an herb fires a set Herb alias, which is as follows:
Code: |
#DBSAVE // presave DB
#DBLOAD HE // make sure the HE DB is foreward
#EC Loaded HE //echo the db is loaded
#VAR VarHerbName %1 // backup the herb description
#VAR VarHerbRec %find( {@VarHerbName}) // make sure the herb isn't already in the db if so store the identifier
#IF (%null( @VarHerbRec)) {
#EC Herb not found, adding.
#VAR VarHerbNew ""
#ADDKEY VarHerbNew GenName %1
#NEW HE @VarHerbNew
#EC @varherbname Added
#DBSAVE HE
#EC HE Saved
#VAR VarHerbRec %find( {@VarHerbName}) //finds the newly added herb record identifier
} {#EC Herb Previously added.} //else statement sayign herb was already there
#EC HerbRecord:@VarHerbRec
#DBR // failsafe added cause of the problem
#VAR VarHerbNew "" // reset the array variable for #new
#DBLOAD HL
#EC HL Loaded
#wait 200
// next line checks if the herb has been previously been found in the current room. rest is basically same as before
#IF (%null( %query( (&ID=@VarHerbRec) & (&Room=%roomvnum) & (&Zone=%zonename)))=0) {#EC Herb Previously in this room.} {
#EC Adding Herb to room {%roomvnum}
#ADDKEY VarHerbNew Zone {%zonename}
#ADDKEY VarHerbNew Room {%roomvnum}
#ADDKEY VarHerbNew ID @VarHerbRec
#NEW HL @VarHerbNew
#EC NewRecord Added
#WAIT 200 // wait states added to try and debug
#DBSAVE HL
#EC HL Saved
}
#DBR
#VAR VarHerbNew ""
#VAR VarHerbName ""
|
problem is .. this script and any variation i try to do of it.. keeps overwrting the HE record with the HL data, if i split it into 2 alises, one to add the HE record, one to add the HL record, it works SOMETIMES usually it adds the HE, then the HL , then for some dumb reason OVERWRITES the HE record with the HL data... also for some odd reason the zone name is stored always as the first zone.
stumped and confued. |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Tue Aug 26, 2008 6:47 pm |
Have you tried putting the entire code block into a #PRIORITY in case some other command or trigger is changing the DB? Have you tried explicitly closing with #DBCLOSE the HE db before modify the HL db?
|
|
_________________ Asati di tempari! |
|
|
|
drexor Newbie
Joined: 21 Aug 2008 Posts: 4 Location: Topeka, KS
|
Posted: Wed Aug 27, 2008 5:06 am |
yes and yes, the only thing accessing the db is this alias, and the only DB's i have set up (other than of course the maps)
usually if if i close, before writing the other record, i get a invalid reference error from zmud since of course the field in the HL is a record type, i tried it as text, but that renders this db setup pretty useless since i cant assign records to rooms. |
|
|
|
drexor Newbie
Joined: 21 Aug 2008 Posts: 4 Location: Topeka, KS
|
Posted: Wed Aug 27, 2008 5:14 am |
i am also frequently getting this error :
Control " has no parent window. |
|
|
|
|
|
|
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
|
|