I don't know if this, or anything akin to this, is already possible... so excuse this post if it is. I propose a new type of object, database objects. These would be much like a spreadsheet, where you create a database, and can add/remove rows and columns.
NPC Code:
items = new TstaticDB(); // sorry, I dunno how you initialize new variables
items.createrow("Image"); // Creates a row named 'Image'
items.createrow("Weaponname"); // Creates a row 'Weaponname'
items.createrow("Weight"); // Creates a row 'Weight'
items.addcolumn("Bow"["Image"="wbowi1.png","Weaponname"="-Bow","Weight"=6]]); // Adds a named Bow, specifying the rows for the Image,Weaponname, and Weight
items.deleterow("Weaponname") // Removes the row 'Weaponname'
and to access the database object:
NPC Code:
temp.test=items.column("Bow"); // would return {wbowi1.png,-Bow,6}
temp.test=items.row("Image"["Bow"]); // would return wbowi1.png
temp.test=items.row("Image"); // would return an array of all items in the Image row
I was posting this as I went, so things might be disorganized, and it might not be the best design of commands and such, but I think you get the idea. If anyone has suggestions on what to add to this, go ahead.