Sell_Eggs()
var/obj/egg/dEgg = input("Which Egg?","Eggs") in eggs
del(dEgg)
Problem description:
I'm trying to let my user select which egg to sell.
eggs is a list that contains instances of obj/egg
Nothing happens when I activate this verb
ID:2102700
![]() Jun 19 2016, 2:45 am (Edited on Jun 19 2016, 3:44 am)
(See the best response by GinjaNinja32.)
|
|
Code:
Sell_Eggs() Problem description: I'm trying to let my user select which egg to sell. eggs is a list that contains instances of obj/egg Nothing happens when I activate this verb |
obj Yes, There is a statpanel showing the contents of the list it seems to be populating correctly. The work around I've found now, which seems super sloppy and totally unnecessary is making another list with referenced to the objects. Then based on which of those is chosen the object is deleted and then swap the first null spot in the list to the bottom and copy it to a shorter list, delete the original and copy the short to the original. THIS IS SO GROSS AND UGLY and I don't understand why my original code wouldn't work as posted in the first post. |
Replacing your verb with the following works as expected:
Sell_Eggs() I'd suggest using `eggs -= object` rather than deleting it then trying to find nulls: Sell_Eggs() |
Outside of that, the code you posted should function correctly if the list has valid entries.