ID:114352
 
Resolved
browse_rsc() failed on the first try in some cases when used for client-side icons.
BYOND Version:485
Operating System:Windows XP Pro
Web Browser:Opera 9.80
Applies to:Dream Seeker
Status: Resolved (486)

This issue has been resolved.
Descriptive Problem Summary:
I'm trying to display images in the browser using browse_rsc(), but I get an error message saying "Unable to read cache file." and the image doesn't show up.

Numbered Steps to Reproduce Problem:
1. Make an icon
2. Run the code snippet and use the verb

Code Snippet (if applicable) to Reproduce Problem:
mob
verb
test()
src << browse_rsc(icon('icons.dmi', "icon"), "icon.png")
src << browse("<img src=icon.png>")


Expected Results:
The image should be displayed in the browser tab.

Actual Results:
IE's broken image icon is displayed.

Does the problem occur:
Every time? Or how often?
In other games?
In other user accounts?
On other computers?
All the time.

When does the problem NOT occur?
As far as I know, it always happens.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
It works in v483, but not v484 or v485.

Workarounds:
I haven't found any.
I found a rather strange workaround for this.
mob
verb
test()
var/F=fcopy_rsc('icons.dmi')
src << browse_rsc(F,"icon.png")
src << browse_rsc(F,"icon.png")
src << browse("<img src=icon.png>")
Repeating the browse_rsc line seems to be the trick. This also works:

src << browse_rsc(icon('icons.dmi', "icon"), "icon.png")
src << browse_rsc(icon('icons.dmi', "icon"), "icon.png")
src << browse("<img src=icon.png>")


It works for now, but once it's fixed I'd have duplicate calls everywhere :-/
Nice job figuring it out Forum_account, yes the fix is ugly for this bug & you should probably just wait until it's fixed so you don't have to make any changes & it'll just work when people update BYOND.

You should release the game update now(if not done already) since the problem will fix itself as people update BYOND.