Posts ID:140219 Favorites Creations
ID:140219

Code:
 var/icon/I=new('[P.Type1].dmi') 

Problem description:I need the [P.Type1] to be in that special color, like it is when it's between "" but the icon itself needs to be in ''. How can I get it to work? Thanks.

 #1 Mar 27 2010, 2:21 am You can not do what you described, since 'filename.extension' does compile-time checking on the resource. In order to reference a file during run-time, you could use file(Path).
 #2 Mar 27 2010, 8:25 am In response to Schnitzelnagler (#1) Perhaps I'm just going about it the wrong way then. What I need to do is winset() an image based on the Type1 variable onto a label. Is that possible? Like if the Type1 variable is Grass, output the Grass.dmi icon into the label.
 #3 Mar 27 2010, 8:48 am In response to DisturbedSixx (#2) If you want an image you can just add another map control, and make the image display in that, then you can easily do it, just look up in DM (HUD / screen objects) that will tell you that you can output screen objects to a map control other than that of the default map control. If you want an image to the label you can set one from the interface file itself as well. If you want the image to change as well in a label you could also use winset() to hide one label, and show another that has the different image already. Or you could wait for someone else to tell you how to set the image via winset().
 #4 Mar 27 2010, 8:54 am In response to Dan0971 (#3) Yeah I am trying to set the image via winset(). I know how to do that without the variable, but with it, I can't get it to work. Thanks for the help anyway though.
In response to Schnitzelnagler (#1)
I've tried to use file() and it's not giving me any runtimes but it doesn't work. Am I using it the wrong way?
 var/icon/I=file("[P.Type1].dmi")winset(src,"Type1","image=\ref[I]") 
In response to DisturbedSixx (#5)
  var/icon/i = new("[P.Type1].dmi") winset(src, "Type1", "image=\ref[fcopy_rsc(i)]") 
 #7 Mar 27 2010, 10:19 am In response to Schnitzelnagler (#6) I've tried to use the code but it gives me a bad icon operation runtime. I've tried to change it up a little hoping I can get the problem fixed but no luck. Any idea why?
 #8 Mar 27 2010, 10:26 am In response to DisturbedSixx (#7) Does your dmi file contain only a single icon_state with the name ""? Else you might have to refrain to the icon proc, though I'm just guessing here, as the code snippet works perfectly fine with me.
 #9 Mar 27 2010, 10:27 am In response to Schnitzelnagler (#8) The file is in a folder called Types and only has one icon_state with no name underneath it. By folder, I mean it's not directly inside of the project folder but in a sub-folder within that.
 #10 Mar 27 2010, 10:32 am In response to DisturbedSixx (#9) Oh! Well, then you would have to include the file-path.
 #11 Mar 27 2010, 10:33 am In response to Schnitzelnagler (#10) Ah I see, I got it now. Thank you for your help.