ID:2333694
 
(See the best response by Albro1.)
This is what I have at the moment. (Working as intended)
//Clothing/Hand
obj/item/equipment/clothing/hand/gloves
icon = 'Clothing.dmi'
icon_state = "Gloves"
layer = 100
DblClick()
if(usr.handslot == 0)
usr.overlays += list(new/obj/item/equipment/clothing/hand/gloves)
usr.handslot = 1
usr.def += 0
else
usr << "NO"
//Clothing/Hand

But I would like to make a proc to replace the
usr.overlays += list(new/obj/item/equipment/clothing/hand/gloves)

More specifically I wish to use something that can call the obj path as to simplify that part of it to make adding more /hand/ items easier but my problem is I'm not sure where to start if I wanted to make said proc.

I'm not asking for someone to make the proc for me I just want someone to tell me where to begin...
Best response
If you’re wanting to add all of a certain type of object to a list, use typesof(). Use the F1 help reference to read up on it. It returns a list of all of a certain type that you supply.

If that isn’t quite what you’re looking for then I may have misunderstood your question.

EDIT: I see you’re adding a copy of the same object to the overlays when clicked. Why don’t you just add the object itself that is being clicked?

Simply doing usr.overlays += src should achieve the same result, and allow you to actually remove the overlay later because you have a direct reference to it.
In response to Albro1
Albro1 wrote:
If you’re wanting to add all of a certain type of object to a list, use typesof(). Use the F1 help reference to read up on it. It returns a list of all of a certain type that you supply.

If that isn’t quite what you’re looking for then I may have misunderstood your question.

EDIT: I see you’re adding a copy of the same object to the overlays when clicked. Why don’t you just add the object itself that is being clicked?

Simply doing usr.overlays += src should achieve the same result, and allow you to actually remove the overlay later because you have a direct reference to it.

You answered my question perfectly thank you and as for why I did not just add the object itself...because I did not know I could in the first place lol

EDIT: You solved my issue entirely...it was so simple yet so hard for me to figure out lol