ID:146340
 
Code: This code is to put the train.dmi picture in the a users screen when pressing on a certain object that is also on the screen. Then delete that object once the PARENT object is clicked again.

Click()
if(usr.shown)
usr.client.screen -= /obj/Buttons/Train
usr.shown=0
else
usr.client.screen += new/obj/Buttons/Train
usr.shown=1


Problem description: I was wondering how I would be able to remove a specific object from the usr.client.screen.

You could use locate:
usr.client.screen -= locate(/obj/Buttons/Train) in usr.client.screen


I think that would work atleast....
Also, try not to use usr when you can avoid it..
In response to DarkCampainger
Where should he avoid it in this code?
In response to DarkCampainger
DarkCampainger wrote:
Also, try not to use usr when you can avoid it..

This is Click(); usr is perfectly valid there.

Lummox JR