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


Joined: 04 Jan 2004
Posts: 1
Location: Finland

PostPosted: Mon Jan 05, 2004 2:33 am   

Using databases in scripts
 
A simple question, but I was unable to find the answer by search the forum posts...

Is there a way to access databases from within a script (e.g. a trigger) without opening the database window first? I've tried, but none of the database commands do anything unless the DB window is open.
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Mon Jan 05, 2004 7:35 am   
 
Indeed you can:
#dbload <first-two-letters-of-the-database-you-want-to-open>
#dbclose <first-two-letters-of-the-database-you-want-to-open>
#dbsave <name of the database>

To access records inside current database:
%db(rec,key)

Where rec is the database record you want to access, and key is the field you want the value from.

#DBPUT saves new data to an existing database record. Usage:
#DBPUT RecordNum {Name1=Value1|Name2=Value2|...}

For more detailed explanations and more commands, check help on Programming the Database
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Jan 05, 2004 11:24 am   
 
No, you can't access the databases from within a script without opening the database window. The database module is only loaded when the database window is open. This module contains most of the database related commands, including #DBLOAD.

However, you can open the database window by script using the #MENU command.
#MENU {Windows|Database}
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