ID:147547
 
I've recently run into a snag and was wondering if anyone had any solutions or suggestions.

I plan on having my equipment show in a browser pop-up. I've gotten the code to work so far, except for one small problem: it won't replace previously browsed images.

For example, let's say that I'm not wearing any armor.
I use
M<<browse_rsc('blank.dmi',"armor.png")


Now, if I equip the armor, and run the proc again, it will use
M<<browse_rsc(icon(armor.icon, armor.icon_state),"armor.png")


If I wear the armor before calling the proc, everything shows up fine. If I call the proc while wearing nothing, and then call it with stuff equipped, it still shows blank.

I thought that perhaps the entry of "armor.png" was already in the cache, so it wouldn't be changed.
Ok, so I now save it as "armor[world.time].png". Still no dice.

Is there anyway to clear the cache or get it to recognize a new image under an already browse_rsc()'d name?
Find a way to delete the image from the cache, then generate the new image. But that would be impossible i think unless you hacked into your player's computers.

Another way to go is create a var for the image. Like below but it might take up alot of space if the browser comes up ALOT.

mob/var/armorvar = 0

mob/verb/armor()
src.armorvar += 1
//Define the var Armor.
M<<browse_rsc(icon(armor.icon, armor.icon_state),"armor[armorvar].png")
//Whatever here

I really don't know. Wait till some good programmer (Not me) like Lummox replies. I'm sure he can help.

- Hated Anarchy
In response to HatedAnarchy
HatedAnarchy wrote:
Find a way to delete the image from the cache, then generate the new image. But that would be impossible i think unless you hacked into your player's computers.

Another way to go is create a var for the image. Like below but it might take up alot of space if the browser comes up ALOT.

mob/var/armorvar = 0

mob/verb/armor()
src.armorvar += 1
//Define the var Armor.
M<<browse_rsc(icon(armor.icon, armor.icon_state),"armor[armorvar].png")
//Whatever here


I would like to point out that this is more or less what the armor[world.time].png was doing. And I did try deleting the images from the cache folder (which only works for me, since I don't know your windows UN). Still no dice, which leads me to believe that the images are created there just because they need an actual hardcopy to transfer into the .rsc file.
In response to sapphiremagus
Here's an idea, Assign a picture for every armor, give the mob a var that is called "armortype" and when the button that shows it in the browser is called, show the pic based on the armortype var. For example if(src.armortype = "none") then display the "none.jpg" image in the browser maybe?

Sorry if i can't help you.

- Hated Anarchy
Have you tried using browse() instead of browse_rsc()? I would test this theory for you, but I'm on a school computer that for some reason has no trouble overwriting files in the cache.

mob/verb/browse_image()
usr << browse('green.dmi',"display=0;file=picture.png")
usr << browse("Here's your picture! <br><img src=picture.png>")
sleep(20)
usr << browse('red.dmi',"display=0;file=picture.png")
usr << browse("Here's your picture! <br><img src=picture.png>")


This bit seems to work for me... I'll try again when I get home to double-check.

-Koshigia