ID:165172
 
How do I take one icon state from one file and add it to a new file?

example:

src.icon = 'blah.dmi'
src.icon_state = "BLAH!!!"
//Everything under this comment I'm making up
//But you can probably figure out what I want
var/icon/O = new("Icon file 2.dmi")
O << //src's icon's icon state of "BLAH!!!"


I'm using this so that when I save a map I only save the icon states I need so that I don't save turfs.dmi with 100 icon states 65000 times on a 150x150x9 map x_x I tried that last month in my quest to do map saving and it took 30 GB to save my map :O! (BUT IT WORKED!)
Actually look up the icon related entries in the DM Reference, namely the icon() proc and icon/New(), thank you very much.

Also, why are you even saving icons when saving a map to begin with? :O
In response to Kaioken
well my game has a Custom Tile verb so that people can use any icons I was too lazy to put in myself or if they have recolored versions of icons they want to use or something, and I can't save them without putting them in an icon file or a savefile since I won't have them :O

This whole system is kinda iffy so I'll probably have to bail on it anyway because I'm still wondering how I'm going to stop from saving one icon state twice or save two icon states with the same name :( I'll probably just try something else~
You're not going to be able to insert icons into one of the compiled-in icon files your game uses, and if you create a new file then you'll need to somehow save that too. But, if you can keep track of where each icon is coming from, you can probably recreate it from a lot less data.

Lummox JR
In response to Lummox JR
Even though I've bailed on the map saving again since it's not as important to the players as they pretend it is, I decided to make a "Steal Icon" verb (except I'll of course ask people before stealing any icons that weren't taken from sprite sheets anyway; if I don't we get "OMG COW STEALS ICONS" posts on forums and Byond Members pages :O oh noes) so that I can put extra icons into the built-in build macros to force people to want to use them even though they complain even though I see no way for them to be more hassle than clicking a verb over and over o_O

With build macros you set one of the four diagonal buttons and press it once to make a tile. Yay. Without, you have to click your mouse on Bookcase or Redcobble o_O but I'm way off of topic now D:

---------------IGNORE ABOVE THIS--------------------

I've looked through DM Reference a bunch but all I can find is how to use Blend and icon procs like that to edit an icon variable; but nowhere in the listed procs can I find a way to output an icon to a dmi file :(

Uploading an icon is easy:

var/icon/I = icon('icon.dmi')
or
var/icon/I = input("What icon?") as icon

or something like that, but how do I take an atom's icon and put it into a dmi?
In response to Cowdude
You should be able to use fcopy() for that.