ID:272476
 
Ok so I have an icon that's larger than 32x32, but I've split it up into icon states. What I was wondering is if I could use something like overlays to create a multi-tiled icon, and then the Scale() proc to shrink it to 32x32 size? The reason I want to do this is so I an create dynamic preview images of multi-tiled icons, without having to go through all the work of putting the icons together and then shrinking them down.
I need this for a game I was working on, not sure if its the easyest way to do it but it works.

(code download and demo)
http://www.turboupload.com/download/h425utwJvwUW/scale.zip (20 odd sec wait)
http://www.mediafire.com/?bdjn9zlw9mj (no wait)
in a zip file.

notes:
icon_from_parts(var/list/iconsin = list())
needs to be sent a list thats 4 entrys long (and have icons)
it only does basic checks on size.

eg
icon = icon_from_parts(list(new/icon('test.dmi',"topleft"),new/ icon('test.dmi',"topright"),new/ icon('test.dmi',"bottomleft"),new/ icon('test.dmi',"bottomright")))
In response to Zero00012
Well I tried to download it, but neither of the links are working right now. Is there a way you could explain the basic strategy behind it?
world
view = "10x10"


mob
Login()
..()
loc = locate(1,1,1)
src << "click on the white box to see demo"
src << "each part is made up of a 32x32 icon scaled down and then joined into 1 icon"

proc
icon_from_parts(var/list/iconsin = list()) // in (topleft,topright,bottomleft,bottomright) as icons
if(length(iconsin) == 4)
var/icon/newicon = new/icon('test.dmi',"blank")
var/loop = 1
while(loop <= 4)
var/icon/workingon = iconsin[loop]
workingon.Scale(16,16)
if((loop == 1) || (loop == 2)) workingon.Shift(NORTH,16,0)
if((loop == 2) || (loop == 4)) workingon.Shift(EAST,16,0)
newicon.Blend(workingon,ICON_OVERLAY)
loop++
return newicon
else
return new/icon('test.dmi',"blank")

obj
test
icon = 'test.dmi'
icon_state = "whitebox"
Click()
..()
icon = icon_from_parts(list(new/icon('test.dmi',"topleft"),new/icon('test.dmi',"topright"),new/icon('test.dmi',"bottomleft"),new/icon('test.dmi',"bottomright")))

notes, not sure if its | or || but || seems to work for "or"
In response to Zero00012
Of course, it's all makes sense now! Thanks!
In response to Zero00012
Note to your note: When using the || operator in an "if," it tells the computer to be true if the fisrt and/or the second expressions are true.