My first few questions are probably quick and easy to answer, and have to do with the thread's topic (obviously)
1: How does one look up an instance of an item inside a list?
Example: if I want to list all melee weapons and see if a character is holding one of the items in that list in either hand, how do I go about it? My script returns no errors, but does nothing at the same time.
2: Is LUA like Java, in that I can use a variable and increment the position inside that list for the returned item?
Example: Say my list has "longsword_rusted", "longsword_pitted", "longsword_sharpened" in it (in the 5th - 7th spots). Can I use the above code (Q1) to find the "longsword_rusted" in my hand and through an action return its item placement in the list, +n, resulting in replacing it with the sharpened version?
Last year I could have done it in Java, but it's been so long that I don't really remember everything and I'm not using the same language.
3: This is the important part, because it's one of the last things I figured out before and I'm stuck on it again. . . How do you tie it all together?
Example: Champion 1 is a Swords specialist with 22 in his swords skill. He finds a rusty longsword and a whetstone. By equipping the rusty longsword and right-clicking the whetstone the game takes a floor() of his swords skill * 0.2 and finds that he has a modifier of 2. It then finds the list location of the rusty longsword and removes/destroys it (not sure which is more proper), then equips the champion with the item 2 slots higher in the list. "longsword_rusty", "longsword_pitted", "longsword_sharpened" (or somesuch naming convention). Equip weapon, trigger effect, get better weapon based on relative skill.
The example is inspired by my original concept (and I may expand upon it later since I like it), but it'll still take some considerable editing on my part to turn an explanation of this into my intended result.