ID:142696
 
Code:
turf
icon = 'turf.dmi'
turf
grass
icon_state = "grass" //conventional way

turf
New()
icon_state = name //maybe...?


Problem description:

I was wondering if the above way of setting an atom's icon state at runtime would be viable, or would it be really really laggy? It'd sure save on a lot of typing though :P all help appreciated.

turf
icon='turf.dmi'
grass
New()
..()
src.icon_state = src.name


Try that, not sure if it works, but worth a try.
In response to Sokkiejjj
turf 
New()
..()
var/turf/T = src
if(istype(T,/turf/Outside)) //can leave this out if you dont mind all turfs act like this
T.icon_state=T.name
In response to Sokkiejjj
Hahahaha no. Don't do that. The reasonable way of doing what you're trying to do is:

turf/Outside
New()
..()
icon_state = name
In response to Garthor
Thanks for all your replies!!!

What I really wanted to know though was, if say I was to use this for *every* turf in the world, on say a 300x300 map, would it lag or crash at start-up due to the 90000 (300^2) procs it would have to deal with simultaneously?
In response to Henther
...Hell no. Do you seriously think a simple set of a variable to value would bring BYOND to it's knees? How would you go about complexer things then. Did you ever read another person's code around, perhaps on the forum? What I'm saying is, most New() procs do larger, bigger and mightier things than yours. :P
Don't worry, BYOND, and probably almost all of the programming languages, are not that frail, heh. And it wouldn't make anything crash if it was a 'lot of work', just lag until it finished.

Oh, and also, never in BYOND do multiple procs run at the same time or we'd all have a lot to worry about, by the way. They run one after another.

EDIT:
Oh, yeah, one last thing, it just seems you didn't ponder over the question enough before answering. If you set the icon_state in the object definition, to a hardcoded value, it will still set the variable for each turf that's created. Not much difference, it's only done differently, and sets it to hardcoded string rather than a variable. And as you can see, it doesn't kill BYOND.