ID:148878
 
Whenever i remove all the obj/weapons of my client.screen, it removes them out of my inventory to, i want it to only delete them onscreen. Why doesnt my code work?

mob/verb
Inventory()
if(!usr.openalr)
client.OpenPopup(usr,length=3,width=3,name="Inv")
usr.openalr = 1
else
client.ClosePopup("Inv")
for(var/obj/weapons/P in client.screen)
del(P)
usr.openalr = 0
Mrhat99au wrote:
Whenever i remove all the obj/weapons of my client.screen, it removes them out of my inventory to, i want it to only delete them onscreen. Why doesnt my code work?

Because you're thinking "delete" instead of "remove from the list".
for(var/obj/weapons/P in client.screen)
client.screen-=P

Lummox JR
In response to Lummox JR (#1)
Instead of looping could you make client.screen = newlist()
since it is a list?
In response to Super16 (#2)
Even better: client.screen.Cut().
YEAHAH! Thanks! Now i can make a onscreen inventory!
In response to Super16 (#2)
That would clear out all the objects in client.screen, but he might have other non-weapon things he wants to keep.
In response to tenkuu (#5)
Yep you are right in saying that, so i dint use cut i use the other one.