ID:1493970   Feb 10 2014, 11:42 am (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: 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 // scarfEquipment parent_type = /Inventory var/list/Clothes = list() var Armor var Weapons var Armor_type var/list/Arrangement = list() verb/Get() set hidden = 1 set src in oview(1) src.Move(usr) usr.Add_Items(src) Click() ..() sleep(2) if(src in usr.contents) var/Inventory_pos = winget(usr,"Inventory","pos") winshow(usr,"Inventory",0) winshow(usr,"Item_Info",1) winset(usr,"Item_Info","pos=[Inventory_pos]") spawn(2) usr<Item: [src]Description:[src.desc] "} ,"Item_Info.Info") sleep(world.tick_lag) verb/Equip() if(src in usr.contents) switch(src.is_equipped) if(TRUE) for(var/obj/Maptext in usr.client.screen) if(Maptext.tag == "[src]") del(Maptext) src.is_equipped = FALSE switch(gear_type) if("Clothing") usr.clothing_equipped -= src usr.overlays -= Clothes if("Armor") usr.armor_equipped -= src usr.overlays -= Armor if("Weapons") usr.weapon_equipped = null usr.overlays -= Weapons if(FALSE) new/Maptext("E","[src]",src.screen_loc,16,16,1) src.is_equipped = TRUE switch(gear_type) if("Clothing") switch(src.Arrangement) if(2) Clothes = image(icon = src.real_icon, layer = CLOTHES_4) if(3) Clothes = image(icon = src.real_icon, layer = CLOTHES_3) if(4) Clothes = image(icon = src.real_icon, layer = CLOTHES_2) usr.clothing_equipped += src usr.overlays += Clothes if("Armor") switch(src.Arrangement) if(1) Armor = image(icon = src.real_icon, layer = ARMOR_1) if(2) Armor = image(icon = src.real_icon, layer = ARMOR_2) usr.armor_equipped += src usr.overlays += Armor if("Weapons") usr.weapon_equipped = "[src]" Weapons = image(icon = src.real_icon, layer = WEAPONS_1) usr.overlays += Weapons 
 Feb 10 2014, 11:46 am 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.
 Feb 10 2014, 12:21 pm 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?
 Feb 10 2014, 12:47 pm Best response You can use a reference in the verb arguments, and this will allow you to specify which to equip. mob/verb/set_verb() winset(src,"button1","command=\"equip \\\"\ref[object]\\\"\"")mob/proc/equip(var/t) world << "Going to equip [locate(t)]" 
 Feb 10 2014, 1:01 pm 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.
 Feb 10 2014, 2:09 pm I just can't figure out how to make this work.....
 Feb 10 2014, 6:39 pm Is it me or is there no input() in the code you provided? How/where is the input being called?
 Feb 10 2014, 7:05 pm input() is call by BYOND when src is being picking from a list
 Feb 10 2014, 7:17 pm Where is that occurring in the above code?
 Feb 10 2014, 7:47 pm if(src in usr.contents) 
 Feb 10 2014, 7:57 pm 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.
 Feb 10 2014, 8:04 pm Been trying to solve this for hours. Getting rather frustrated / agitated
 Feb 10 2014, 8:10 pm 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. obj/item/proc 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. EquipMe(mob/player) // 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 found_item.EquipMe(usr)  Keep in mind, this is an example and isn't meant to be used outright, don't expect it to be functional.
 Feb 11 2014, 4:19 am 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.
 Feb 11 2014, 5:18 am 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.
 Feb 11 2014, 9:29 am 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.
 Feb 11 2014, 10:36 am 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.