ID:137950
 
I'm trying to implement a turf that uses icon arithmetic to construct its icon from the icons of neighbouring turfs, the icon of the underlying area, and a set of 16 masks that define which parts of those icons will be used. Each subclass of this turf will use the same set of names for its mask icons, but with a different directory. It would be useful if the turf's New proc could refer to these icons with syntax similar to the following:
/turf/masked
  var/MyMaskDir
  New(Loc)
    var/mask1 = '[MyMaskDir]/mask1.dmi'
    var/mask2 = '[MyMaskDir]/mask2.dmi'
    ConstructIcon(mask1,mask2)
so that its subclasses would only need to override the MyMaskDir variable:
/turf/masked/type1
  MyMaskDir = "masks/type1"

/turf/masked/type2
  MyMaskDir = "masks/type2"
I think you could probably emulate this nicely with the #define directive, but I'm not 100% sure.
In response to Gughunter
On 5/31/01 2:43 pm Gughunter wrote:
I think you could probably emulate this nicely with the #define directive, but I'm not 100% sure.

Unfortunately this wouldn't work; #defined symbols are not substituted when they are inside double or single quotes.
The stuff inside the 'resource' is evaluated at compile-time, so you can't put runtime expressions there. However, we should, I think, support this notation:

icon = file("[usr].dmi")

But I just tested and it doesn't work. I'll bug Dan.
In response to Tom
The stuff inside the 'resource' is evaluated at compile-time, so you can't put runtime expressions there. However, we should, I think, support this notation:

icon = file("[usr].dmi")

The compiler knows when something is a constant value, right? Would it be feasible to support something like:

icon = '[MY_DEFINE]'

Your way sounds fine... just curious if this would be practical. If I'm not mistaken (which I already have been once in this short thread), the latter method would permit the icons to be loaded into the .rsc file.