if("Sell Items")
var/obj/I=input("What would you like to sell?","Sell to Shopkeeper") in usr.contents + "Cancel"
if(I=="Cancel")
usr<<"You sell nothing."
return ..()
else
if(!I.worn)
switch(input("Are you sure you'd like to sell this [I] for [num2text(I.value,20)] gold?","Shopkeeper") in list ("Yes","No"))
if("Yes")
usr.contents-=I
usr.spaces--
usr.gold+=I.value
usr<<"\green You sell your [I] for [num2text(I.value,20)] gold."
if("No")
return ..()
else
return ..()
else
usr<<"\red You must first unequip your [I] before trying to sell it."
Problem description:
This code works perfectly fine for its purposes, but the issue comes in when a user has more than one of an item to sell and the first of those is equipped. Is there a way to make this code so that it will continue checking for others of the same object type in usr.contents instead of stopping at the first?
To illustrate:
1:
-user has two swords, first is equipped
-user tries to sell a sword, cannot
2:
-usr has two swords, second is equipped
-user tries to sell a sword, can
Any ideas? :/