(See the best response by Pirion.)
Problem description:
Hello guys, I have yet again re-designed my Inventory system , which I feel is a lot better then my previous. Anyway, Hmm, I have this problem where I am equipping a item. If there is only one item in my contents, it works properly. But once there's more then 1 item and I click Equip, it creates a pop-up indicating which item I want to equip. This is completely unintentional as I want the system to refer back to the item clicked, and automatically select that one to equip/unequip.

Here is animated picture depicting the occurence:

Please do forget the "lag" Licecap slowed me down a little xD.

Anyway, when I equipped the shirt it was working as intended, but once I get more then 1 item it does unwanted behavior.

How can I go about it always working as it worked the 1st time?

Here is my code:
#define WEAPONS_1     FLOAT_LAYER -1

#define ARMOR_1 FLOAT_LAYER -5 //armor pants
#define ARMOR_2 FLOAT_LAYER -4

#define CLOTHES_2 FLOAT_LAYER -6 //shirts
#define CLOTHES_3 FLOAT_LAYER -3 // vest
#define CLOTHES_4 FLOAT_LAYER -2 // scarf


parent_type = /Inventory

var/list/Clothes = list()
var Armor
var Weapons
var Armor_type
var/list/Arrangement = list()

set hidden = 1
set src in oview(1)



if(src in usr.contents)

var/Inventory_pos = winget(usr,"Inventory","pos")


<b><font color = white>Item:</color><font color = green>
<font color = white>Description:




if(src in usr.contents)


for(var/obj/Maptext in usr.client.screen)
if(Maptext.tag == "[src]")

src.is_equipped = FALSE

usr.clothing_equipped -= src
usr.overlays -= Clothes

usr.armor_equipped -= src
usr.overlays -= Armor

usr.weapon_equipped = null
usr.overlays -= Weapons



src.is_equipped = TRUE




Clothes = image(icon = src.real_icon, layer = CLOTHES_4)
Clothes = image(icon = src.real_icon, layer = CLOTHES_3)
Clothes = image(icon = src.real_icon, layer = CLOTHES_2)

usr.clothing_equipped += src
usr.overlays += Clothes



Armor = image(icon = src.real_icon, layer = ARMOR_1)
Armor = image(icon = src.real_icon, layer = ARMOR_2)

usr.armor_equipped += src
usr.overlays += Armor


usr.weapon_equipped = "[src]"
Weapons = image(icon = src.real_icon, layer = WEAPONS_1)
usr.overlays += Weapons
The problem is coming from having two verbs of the same name in your list, which will require selecting which object with that verb to use.

If you're going for a solely interface-based approach you don't even need a verb here, just a proc, which you call within Click() or as needed.
But if I make it into a proc, then when would I call it? I need to call it when I click the button, which is why I made it a verb. Unless there's a way I can check if somebody clicks the button and then call it?
Best response
You can use a reference in the verb arguments, and this will allow you to specify which to equip.
winset(src,"button1","command=\"equip \\\"\ref[object]\\\"\"")

world << "Going to equip [locate(t)]"
Ah, I thought you were using on-screen inventory displays not interface buttons. Pirion's suggestion is good for this, simply pass a reference to the command variable of the button element then use a generic equip verb.
I just can't figure out how to make this work.....
Is it me or is there no input() in the code you provided? How/where is the input being called?
input() is call by BYOND when src is being picking from a list
Where is that occurring in the above code?
if(src in usr.contents)
That's not an input(); I don't think you get what I'm asking.

Seems the issue is what ever the command in the interface OP is using.
Been trying to solve this for hours. Getting rather frustrated / agitated
You need to remove the Equip() from the items themselves, make a mob verb called 'equip' and pass the items through that as suggested by Pirion earlier. You'd have to set the command of the button properly as items were displayed in it.

DisplayMe(mob/player) // EXAMPLE
winset(player,"mywindow.mybutton","command='Equip \"\ref[src]\"'")
// Do whatever else you do to display the item on the button here.
// Do actual equipping here.

mob/verb/Equip(item_ref as text)
var/obj/item/found_item = locate(item_ref) in world
if(!found_item) return

Keep in mind, this is an example and isn't meant to be used outright, don't expect it to be functional.
In response to Jittai
Jittai wrote:
That's not an input(); I don't think you get what I'm asking.

Seems the issue is what ever the command in the interface OP is using.

He has two objects that have the same verb on them. The engine asks which object to execute that verb on by default behavior.
Ah, I see, the input comes from entering the verb with no argument or "src". I haven't used interface or default verbs in so long lol.
In response to Jittai
Jittai wrote:
Ah, I see, the input comes from entering the verb with no argument or "src". I haven't used interface or default verbs in so long lol.

I don't think we're quite on the same page, but maybe I misunderstand.

The verbs list is created by adding src.verbs and each of src.contents object's verbs. If multiple items have the same verb name, then you need to select the item that you intended it to use the verb of.

The solution to this is to only include one of them as a verb (in this case client would probably be best, as client is the interface user) and passing a reference to the object that it should execute it on, so only one copy of the verb is present, the rest would be procedures.
I didn't realize he was just calling the verb Equip() by itself with no arguments, in which case runs the input by default for possible choices.