ID:132905
 
Make it so file() can access compiled resources along with added resources.

Uses:

Changing a mobs icon to another icon without a placeholder

The ability to loop threw a set of icons

for(var/A=1,A<10,A++)
usr.icon=file("[A].dmi")

The ability to assign an icon with a string

mob/verb/ChangeMyIcon(var/A as text)
var/B=file([A].dmi)
if(isicon(B))
usr.icon=B

Yeah crappy examples but I'm just trying to get a point threw. o.o

There's even a chance that it not being able to do this is a bug.

In the built-in help file it says under
icon var (atom)
"... You can also assign this to an external file at run-time with an expression such as file("wall.dmi"), but you would only want to do that when the other method is not possible, because it requires addition of the file to the resource cache, which can take a little time."

Meaning it finds the file and adds it to the resource catchy
But if it cant find the file it checks if it has one and uses that, but its not returning resource files

I would be happy with an option on it to include compiled resources in its search.

Thank you for reading. o.o

Edit:

If there's a method that I am unaware of please prove me wrong.
http://www.byond.com/developer/forum/?id=713773

I really don't care if I'm wrong or right as long as I can finish my script.
This would be a very nice feature to have, would make everyone's lives easier.
The file() command can already access compiled resources. I doubt there's any bug involved though, so perhaps if you're having problems with it, it would be a good idea to post in Code Problems.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
The file() command can already access compiled resources. I doubt there's any bug involved though, so perhaps if you're having problems with it, it would be a good idea to post in Code Problems.

This only works locally. Meaning its useless in pretty much every situation; unless you plan on always hosting your game directly from the project folder.
And even then, its not referencing the file from the rsc, its getting the one from the local folder.
In response to Falacy
Right if you have your icons in a sub directory it wont work
and if you have them in the same directory it increases the weight of the resource cache needlessly o.o
In response to Chowder
Chowder wrote:
Right if you have your icons in a sub directory it wont work

You can specify the path in file()
file(folder/icon.dmi)

and if you have them in the same directory it increases the weight of the resource cache needlessly o.o

wat o.O
In response to Falacy
"file("wall.dmi"), but you would only want to do that when the other method is not possible, because it requires addition of the file to the resource cache, which can take a little time. "

This says it adds it to the resource cache o.o?

And this does too

Format:
fcopy_rsc(File)
Args:
File: file to copy into the resource cache

The only difference is fcopy_rsc actually adds it to the rsc
while file appears to only add it to the memory. o.o

Proof being file is not persistent but fcopy_rsc is.

About your first argument thing o.o Compile it take away the source icons and your method will fail D:
In response to Falacy
Doesn't look like you really understand the matter at hand and what Lummox JR was saying.

Falacy wrote:
its not referencing the file from the rsc, its getting the one from the local folder.

That depends on how you use the instruction. If in the argument, you specify the filename*1 instead of the cache reference*2, that's exactly what it's supposed to be doing - grabbing the file at runtime, from the folder the DMB resides in. And no, it's not useless at all - that's even the main point of the instruction in the first place, look it up before talking about it, will you. Anyway, what Lummox said is that file() supports taking a cache reference, which would indeed access a file compiled into the resource archive.

*1: Means you give a [potentially dynamic] text string (so you're using double quotes) containing the filename.
*2: Means you specify the filename in the special resource file notation (single quotes), to be checked, 'compiled' into the RSC and referenced at-compile time.
In response to Kaioken
Kaioken wrote:
*1: Means you give a [potentially dynamic] text string (so you're using double quotes) containing the filename.
*2: Means you specify the filename in the special resource file notation (single quotes), to be checked, 'compiled' into the RSC and referenced at-compile time.

And whats being asked for is a combination of the two?
Being able to use dynamic text string to pull resource files.
In response to Falacy
Ah, I didn't actually fully read the first post, my bad. Then I'm not sure about what Lummox said now. Maybe he misinterpreted the original post, or maybe file() really works like that (did you confirm it before you said it doesn't?), but that seems unlikely to me.
In response to Chowder
Just to clarify things, if you use fcopy_rsc() on a local file that also happens to be in the .rsc, it will not be added to the .rsc a second time. The .rsc file stores and identifies files by a checksum; it will never contain two copies of an identical file.

Lummox JR
In response to Lummox JR
How about clarifying your previous post in this thread instead. >_> Things aren't so clear about that at the moment, at least to me. It could be taken in more than one way. Did you say that in the context of what the OP wanted to do?
In response to Kaioken
I ran so many tests on it x3
In response to Lummox JR
So in other words if I use fcopy_rsc which makes it so file can access it on all my icons it wont increase the size o.o?

"Just to clarify things, if you use fcopy_rsc() on a local file that also happens to be in the .rsc, it will not be added to the .rsc a second time. The .rsc file stores and identifies files by a checksum; it will never contain two copies of an identical file."

Tested it and its false it adds it to something with the extention -> *.dyn.rsc

Regardless of whether it was compiled with it

If you want proof you can use this
mob/verb/Test2(var/a as text)usr.icon=file("[a].dmi")
Just check the file size before and after you use that verb
successfully. For this test make sure the dmi your giving
this verb is one that was compiled with it. o.o
In response to Lummox JR