|
foldar Novice
Joined: 21 May 2020 Posts: 33 Location: The Netherlands
|
Posted: 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. |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: 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 |
|
|
|
foldar Novice
Joined: 21 May 2020 Posts: 33 Location: The Netherlands
|
Posted: 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 |
|
|
|
foldar Novice
Joined: 21 May 2020 Posts: 33 Location: The Netherlands
|
Posted: Fri May 27, 2022 10:37 pm |
Thanks
|
|
|
|
|
|