ID:149439
 
The following code:

mob
proc
charpick()
var/mainicon = 'player2.dmi'
var/icon/greenicon = mainicon- rgb(255,000,000) + rgb(000,156,000)
var/icon/blueicon = mainicon - rgb(255,000,000) + rgb(000,000,156)
src << browse_rsc(mainicon)
src << browse_rsc(greenicon,"greenicon.dmi")
src << browse_rsc(blueicon,"blueicon.dmi")
src << browse("<body bgcolor=black text=white><center><h1>Pick your suit</h1><br><a href=?reg><img src=[mainicon]><br>Regular</a><br><br><a href=?green><img src=greenicon.dmi><br>Green suit</a><br><br><a href=?blue><img src=blueicon.dmi><br>Blue suit</a>","window=charpick;size=530x415;can_close=0")


Seems to corrupt any icon file I use for var/mainicon, it was working I didn't change anything (well it was player.dmi but I changed it to player2.dmi to test, and it corrupted both.) I'm not sure if this is a bug or a code problem. I'm still using 322.
Nadrew wrote:
The following code:
mob
proc
charpick()
var/mainicon = 'player2.dmi'
var/icon/greenicon = mainicon- rgb(255,000,000) + rgb(000,156,000)
var/icon/blueicon = mainicon - rgb(255,000,000) + rgb(000,000,156)
src << browse_rsc(mainicon)
src << browse_rsc(greenicon,"greenicon.dmi")
src << browse_rsc(blueicon,"blueicon.dmi")
src << browse( ... )

Seems to corrupt any icon file I use for var/mainicon, it was working I didn't change anything (well it was player.dmi but I changed it to player2.dmi to test, and it corrupted both.) I'm not sure if this is a bug or a code problem. I'm still using 322.

It's curious that your original icon is being altered (that part is surely a bug), but I can see a few problems in your code that are probably triggering it. (I would still report this in Bug Reports, because the corruption shouldn't be happening.)

Here's one major problem: You're using the /icon datum, but you're using straight addition and subtraction using the + and - operators. The result is an icon file (without a name), not an /icon. To use the /icon you'd have to create a new datum from mainicon, then use Blend() to add and subtract things from it.

Another potential problem: I'm not sure browse_rsc() for icons works all that well without specifying a file name, which you didn't do for mainicon. Even if it makes no difference, you should probably opt for safety and specify the same name, "player2.dmi".

Whether it's browse_rsc() or the assignment of a file to /icon that's causing your problem, I don't know. You should be able to clean up the code to fix the bug, but there's still a BYOND bug under that that should be fixed. (After all, it still counts as a bug even if it's incorrect code that triggers it.)

Lummox JR
In response to Lummox JR
You see, the code worked fine one day and broke the next, the main icon showed up and everything, now the main icon shows up as a red "X" and the RGB edited ones show up fine. But the fact is it worked at one point or another.