Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
foldar
Novice


Joined: 21 May 2020
Posts: 33
Location: The Netherlands

PostPosted: Fri May 27, 2022 8:26 pm   

Setting dbVar Value
 
So how does this work?
I managed to read from a database variable, but how do I set it?

//Look up ACmax of the item with name %2 in the database of protected items

ACmax=%db(@ACMAXDB,%2)

#IF (@ACMax>0)
{
//%2 found in db with protected items}
//Set the current AC to the max AC for the item (repaired)
//It is for setting the item to fully repaired.
@ACCurrentDB(%2)=@ACmax
}

The @ACCurrentDB(%2)=@ACmax is wrong

what is the right code to set the AC-value in the second column in the databasevariable @ACcurrentDB for the item with name %2 in the first column ?
I couldn't find an example in the documentation.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4692
Location: Pensacola, FL, USA

PostPosted: Fri May 27, 2022 8:47 pm   
 
First off, you don't use the @ when setting the value of a variable, that's for referencing only.
Second, %db is a getter, you need a setter, like #ADDKEY

#ADDKEY ACCurrentDB %2 @ACMax

Finally, please make a new thread if your issue isn't the same as the OP. We have an unlimited supply of threads. No need to reuse old dinosaurs. I went ahead and moved this one for you.
_________________
Discord: Shalimarwildcat
Reply with quote
foldar
Novice


Joined: 21 May 2020
Posts: 33
Location: The Netherlands

PostPosted: Fri May 27, 2022 10:18 pm   
 
that worked.


Last edited by foldar on Fri May 27, 2022 11:13 pm; edited 6 times in total
Reply with quote
foldar
Novice


Joined: 21 May 2020
Posts: 33
Location: The Netherlands

PostPosted: Fri May 27, 2022 10:37 pm   
 
Thanks
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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