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
Belmyrddyn
Magician


Joined: 17 Oct 2001
Posts: 371
Location: USA

PostPosted: Sat Aug 17, 2002 4:51 am   

Database Variables
 
How do I change the value of a database variable?

For example:
#LOOPBD @A {#IF (%key = "Value1") {#VAR %val "Value2"}}

Of course that doesn't work, but how do I would I change that value, besides going into the variable and manually editing it?

Belmyrddyn
Reply with quote
Drevarr
Beginner


Joined: 19 Dec 2001
Posts: 17
Location: USA

PostPosted: Sat Aug 17, 2002 5:42 am   
 
Try %query and #DBPUT

I use this to update records that match by name and weight, if it doesn't match I create a new record.

#ALIAS SetID_DB {#VAR dbCompare %query(((&Name=@objectname)&(&WT=@ObjectWT)),All);#IF (!%null( @dbCompare)) {#DBPUT @dbCompare {Name=@objectname|WT=@Object_WT};#SAY Item Stats Updated} {#NEW All @newrecord;#SAY New Item Added to Database};#dbreset;#DBSAVE;ClearID;IDdb_OFF}
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Aug 17, 2002 8:57 am   
 
You can't change the value of system variables, such as %val, directly. The reason they are called "system" variables is that the system controls their value.

To change the value of an existing key in a database variable use #ADDKEY.

#LOOPDB @A {#IF (%key = "Value1") {#ADDKEY A {Value1} {Value2}}

LightBulb
Senior Member
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