ID:2507646
 
(See the best response by SpaceManiac.)
Code:
var/timeday='Time Day.png'
mob
proc
BackgroundAdd(var/num, var/numy)
for(var/image/asd in src)
del asd
var/image/asd=image(tech, src)
src.icon='Time Day.png'
src.pixel_y=numy
src.pixel_x=num
src.layer=1
src << asd


BackgroundRemove()
for(var/image/asd in src)
del asd


Problem description:
That's my background's add proc and my remove proc. I know that it's not the better one. Everytime i add a background, it works fine. The problem is when i want to remove it. It simply does not work, nothing is removed, even when every "asd" (background image) is supposed to be deleted. Is there a way to remove it or modify its icon (the asd one) atleast?
Best response
for(var/image/asd in src) will not find the images because they are not "in" src (that is, not in its contents list). They go into client.images and that's where you have to remove them from.
In response to SpaceManiac
It worked! Thanks alot!
In response to Dourado
Nice practice is bind some stuff to variables.

mob
var/backgroundImage

proc/setBackground(image, ..args)
backgroundImage = image
..magic

//now you can manipulate your background just by recall to your bg var, like

src.backgroundImage.icon = 'namekBG.png'
//..
// remove it form client screen
src.client.screen -= src.backgroundImage
// add it again
src.client.screen += src.backgroundImage