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
Chael
Beginner


Joined: 23 Jun 2003
Posts: 17

PostPosted: Wed Oct 12, 2005 5:09 am   

prob sending info to db
 
I am working on a script to aid in my building, this part of it is supposed to take some infor from the area file and put it in a database. trouble is that #new "" @Area desnt seem to send the @Area contents just creates a new line.

===Script===
#CLASS {Everything|Areas}
#TRIGGER {^Name &Area.Name~~} {}
#TRIGGER {^Continent &Area.Continent~~} {}
#TRIGGER {^LvlRng (%d) (%d)~~} {
#Addkey Area Lowlv %1
#addkey Area Highlv %2
}
#TRIGGER {^Security &Area.Security} {}
#TRIGGER {^Owner &Area.Owner~~ } {}
#TRIGGER {^Cost &Area.Cost} {}
#TRIGGER {^Value &Area.Value} {}
#TRIGGER {^TRate &Area.TRate} {}
#TRIGGER {^Tax &Area.Tax} {}
#TRIGGER {^MaxAge &Area.MaxAge} {}
#TRIGGER {^MaxAgeP &Area.MaxAgeP} {}
#TRIGGER {^Builders &Area.Builders~~} {}
#TRIGGER {^Linked &Area.Linked} {}
#TRIGGER {^End} {
#NEW "" @Area
#DBSAVe
#T- Areas
}
#TRIGGER {^VNUMs (%d) (%d)} {
#addkey Area VnumLow %1
#addkey Area VnumHigh %1
}
#TRIGGER {^Credits &Area.Credits~~} {}
#CLASS 0

===Sample mud text===
#AREADATA
Name *** Melic~
Continent Uncharted~
Builders Plex~
Linked 1
VNUMs 100 199
LvlRng All~
Credits Plex~
Security 9
Owner Nobody~
Cost 0
Value 0
TRate 0
Tax 0
MaxAge 15
MaxAgeP 30
End
===Area var content via #show @Area===
Name*** MelicContinentUnchartedBuildersPlexLinked0VnumLow100VnumHigh100CreditsPlexSecurity9Cost0Value0TRate0Tax0MaxAge15MaxAgeP30

I realise that a few little things need to be tweeked like the VnumHigh but I can fix those easily, what I am worried about is that nothing is being sent to the DB. all the feilds have the proper names and data types but nothing gets filled in


Last edited by Chael on Wed Oct 12, 2005 1:44 pm; edited 1 time in total
Reply with quote
Darker
GURU


Joined: 24 Sep 2000
Posts: 1237
Location: USA

PostPosted: Wed Oct 12, 2005 12:10 pm   
 
Sorry, no help to offer. Just wanted to say "Damn, that's an annoying title."
Have a nice day.
_________________
Darker
New and Improved, for your Safety.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Wed Oct 12, 2005 1:01 pm   
 
You don't have it specified anywhere, so I'm guessing that you haven't actually loaded a database to add the record to. Also depending on how you have the database set up you may want to explicitly specify the view you're using to do the insert.
_________________
Asati di tempari!
Reply with quote
Chael
Beginner


Joined: 23 Jun 2003
Posts: 17

PostPosted: Wed Oct 12, 2005 1:10 pm   
 
sorry about the annoying title Darker, I just finished looking through 2000 someaught ascii art files and it just sort of happened, I have fixed it for you. as for tech's reply, the database is loaded by a trigger earlier on, I am using several databases but each one is closed after info is added and only one is opened at a time. I did try #new AreaStats|ar @Area but it had exactly the same affect a few other variations such as All and simply AreaStats. the thing I dont get is that it will add the new line but no information is put in it.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Wed Oct 12, 2005 4:59 pm   
 
I mocked up your DB based on field values and the trigger and was able to get it to work. So it's not the trigger or the code.

You may want to make sure that db you have the correct DB open (consider opening it explicitly in that trigger) and the fieldnames of your DB match the fields of your record otherwise you won't get an entry created.
_________________
Asati di tempari!
Reply with quote
Chael
Beginner


Joined: 23 Jun 2003
Posts: 17

PostPosted: Thu Oct 13, 2005 1:05 am   
 
Thank you Tech, there seems to be something wrong with the way the Db is being accessed now, I am having trouble getting it to load through the trigger. sometimes success sometimes failure. I can see no pattern ryme or reason as yet. But none the less it looks like you are right on.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Oct 13, 2005 8:28 am   
 
A short little snippet that should do the trick.

#DBLOAD DatabaseName
DBLoadTimeout=0
#WHILE ((%rec="")&(DBLoadTimeout<5000)) {#ADD DBLoadTimeout 1}
#IF (%rec="") {
#ECHO DBLoad unsuccessful
} {
The rest of your script here
}

I can't recall ever having it timeout but I think I use a higher limit too. Basically your giving some time for the database to get loaded, I am pretty sure that the database is handled in a seperate thread.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Chael
Beginner


Joined: 23 Jun 2003
Posts: 17

PostPosted: Fri Oct 14, 2005 2:21 am   
 
More to this problem than I though. I can not open dbs at all. only the db that would come up when you hit the gui db button. I deleted that one with the intention of starting form scratch, and discovered that no matter how I try to open an existing database nothing happens. any ideas?
Reply with quote
Chael
Beginner


Joined: 23 Jun 2003
Posts: 17

PostPosted: Fri Oct 14, 2005 5:25 am   
 
Ok. Did a reinstall of Zmud. then opened up 1DB via the button. worked just fine. closed it loaded it via #dbload worked just fine. closed it tried to open DB2 via button, nothing happened. Same for #dbload. alos since trying to load the 2DB I can no longer close the DB1 with the menus I must use the #dbclose command. any
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