ID:179154
 
Hello,

I've been placing images instead of objects on certain locations. I'd like to be able to delete all images that reside on a certain square. For example:

location = locate(1,2,3)
var/image/blah
for(blah in location)
del blah

(of course this doesn't work ;)
Bootyboy wrote:
Hello,

I've been placing images instead of objects on certain locations. I'd like to be able to delete all images that reside on a certain square. For example:

location = locate(1,2,3)
var/image/blah
for(blah in location)
del blah

(of course this doesn't work ;)

There could be another way, now. With the client.images list, if you know who has those images, you can loop through and eliminate all images on that square.

Alternatively, it might be easier to, when you create the image, add it to a list somewhere for future reference.

Lummox JR
Something that can be done really easily is to give the image a tag when you create it and using a for loop go through all the images in client.images with that particular tag and remove them. For example:

for(var/image/I in src.client.images)
if(I.tag == "TagName")
src.client.images -= I
In response to SilkWizard
SilkWizard wrote:
Something that can be done really easily is to give the image a tag when you create it and using a for loop go through all the images in client.images with that particular tag and remove them. For example:

for(var/image/I in src.client.images)
if(I.tag == "TagName")
src.client.images -= I

But if you've got a client.images list to go through already, then finding the images in a particular location can be done without a tag just by checking I.loc.

Bootyboy's image problem is actually pretty interesting because it highlights the fact that there's no equivalent of an atom.contents list pointing to attached images. That would be the quickest way to find those things, but no such structure exists; he'd have to create lists of images himself.

Lummox JR