|
Scarn Apprentice
Joined: 24 Jul 2005 Posts: 137
|
Posted: Wed Jul 23, 2014 5:13 pm
Database Variable. |
Hi everyone,
I'm trying to make a system for me to log how much damage certain pieces of equipment are taking, so I can know when to replace them.
I've tried making a database variable that will hold all my armour slots as keys, with the equipment within those slots as the data.
This is where the problem comes, I need to able to save a variable of the "damage taken" and assign it to each key, ideally with another column. This column will be constantly updated when I am in combat on the MUD. Once I have that value I will be able to SUB all my armour pieces with their respective condition.
EG:
Code: |
Key Name Data Condition
1 Chest A breastplate 1000
2 Head A helmet 1234
3 Legs A pair of pants 984
4 Shield A shield 2942
|
Thanks in advance. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed Jul 23, 2014 11:14 pm |
Format the two pieces of data as a stringlist (ie, "A breastplate|1000") and assign that to the datarecord key. When you want to pull it out and work on those items, assign the entire key value to a local variable and work with the local variable instead (if you try to work directly with the datarecord key itself, the stringlist gets handled as a literal string instead).
If you can give up the readability of datarecords, you could try nested stringlists. Stringlists can refer to individual elements directly based on position number, so if you needed the condition of your head slot eq you could do @stringlist.2.2. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Scarn Apprentice
Joined: 24 Jul 2005 Posts: 137
|
Posted: Thu Jul 24, 2014 1:35 pm |
I've done just that, thanks! I have a large database variable with lists of items and their max condition.
I then use a trigger to locate what equipment I am currently using, that then loads the relevant piece of armour from the above variable into the variable for the slot that armour piece takes up.
Thank you again. Strings ftw! |
|
|
|
|
|