ID:153161
 
I'm trying to make a system, where, you have a block of wood, and it shows up as a block on the screen. Each tile (32x32) has, maybe, 4 blocks on it, so the blocks are 16x16 each and the map is an 8tile by 8tile square. If you click on one of the blocks, it dissapears, and you carved it. This part, I can code. But the thing is, I want the carving to be saved into a 32x32 .dmi file, or an icon_state in an already made on. Since the chunk of wood has 32 blocks by 32 blocks, it would fit into a .dmi if the blocks are reduced to pixels. Would this be possible? If so, can you help me out on making it?
To start with, you could make it an /icon without too much trouble. var/icon/I = new and then use I.DrawBox() to draw pixels on it.

You could probably something like fcopy_rsc() to turn that into an actual DMI file. I'm not sure exactly how fcopy_rsc() works; Lummox JR would know more.
In response to Crispy
I think I figured out my own idea in a surprising blast of insanity.

Firstly, you get the board on the map, and cut it. Each chunk of cuttable wood would have a variable, such as "2,3". Then after you're done cutting, it checks to see which chunks are left. Then you get a .dmi file with a blank icon_state called "null". There is an object called "Wooden Figurine" and it's icon_state is "null". Then you have another icon_state called "Block", which is a 1x1 brown pixel. Then the variables are transferred. So if you have a block with "2,3", one of the pixels blocks has a pixel_x of 2 and a pixel_y of 3. Then you do the "src.icon+=p", where src is the blank figurine and p is the pixel.

I'm not sure if you understood any of that rambling, but it makes sense to me, and thats all that matters in the end. :D

Thanks again, Crispy!
To save an edited icon as an actual .dmi file, you need to use ftp().

Lummox JR
In response to Lummox JR
So...instead of O << ftp(File,Name) as seen in the DM Reference, I'd use O >> ftp(File,Name)?
In response to FireEmblem
FireEmblem wrote:
So...instead of O << ftp(File,Name) as seen in the DM Reference, I'd use O >> ftp(File,Name)?

No. I don't know where you got that idea, but ftp() is always used with the output operator.

Lummox JR
In response to Lummox JR
Okay...so...would you be so kind to provide an example?
In response to FireEmblem
var/icon/I = new

// Manipulate icon here

usr << ftp(I,"suggestedname.dmi")