obj Top_Pop icon = 'pop machine top.dmi' density = 1 proc Purchase() var/obj/Bottom_Pop/P for(P in oview(1)) if (P.icon_state == "can") usr << "There is already a can of pop waiting for you!!" return switch(input("Choose a flavor of pop. Cost is 50 cents + 10 cent deposit.","Coke Machine!") as null|anything in list("Pepsi","Sprite")) if (null) return if ("Pepsi") usr << "A Pepsi drops to the bottom. Click on it to pick it up!" usr.wealth -= 60 for(P in oview(1)) P.icon_state = "can" if ("Sprite") usr << "A Sprite drops to the bottom. Click on it to pick it up!" usr.wealth -= 60 for(P in oview(1)) P.icon_state = "can" Click() Purchase() Bottom_Pop icon = 'pop machine bottom.dmi' icon_state = "no can" density = 1 Click() if(src.icon_state == "no can") usr << "There is no pop here!!" else usr << "Drinka da pop" src.icon_state = "no can"
Thanks for the help!
All you should have to do is change it to this:
var/obj/Bottum_Pop/P
for(P in oview(1,src)) break
If it doesn't seem to work put in some test statements to track what's happening in the procs.
You also don't need those same loops in the switch statement, just use P again.