ID:172697
 
I think this is at least a decent way to do it...if you can think of a way to simplify it please elaborate:)

The problem with this code I suspect is that the object is indexed by its name rather than the object itself..

I'm not sure how to index the object properly..

I wish to be able to equip multiples of the same object in different places..

Here's the relavent code..compiled and runs without errors.. just the bug first mentioned..

mob
var
list
equipped[0]
equippedItems = list()
obj
equipment
var
list
equipable = list()
verb
Equip_Item()
set category = "Actions"
set src in usr.contents

if(usr.equippedItems.Find(src) == 0)
var/whereto = input("Where would you like to equip the [src.name]?","Equip [src.name]","cancel") in src.equipable + "cancel"
if (whereto == "cancel")
usr << "Equip [src.name] cancelled."
else
usr.equippedItems += src
usr.equipped[src] = whereto
usr << "The [src.name] is now equipped!"
else
usr << "The [src.name] is already equipped!"
Nope... it looks like it's indexing it by the objects themselves. What exactly is the bug, anyway? You didn't say - or if you did, I missed it. =)
In response to Crispy (#1)
well... I have two swords of the same name and type..but they are two separate objects in the users inventory..

I can equip one...but when I click the equip verb again it says my sword is already equipped..
In response to Jerico2day (#2)
Jerico2day wrote:
well... I have two swords of the same name and type..but they are two separate objects in the users inventory..

I can equip one...but when I click the equip verb again it says my sword is already equipped..

That'd be because on the input(). If two objects in a list share the same name, only the first instance of it will be listed.