"Bin" expression

New releases and general discussions.

Post » Sun May 24, 2009 7:49 pm

We have an "AppPath" expression, and it's really useful for loading external files.

I propose a "Bin" expression for loading files stored as resources. Any files, whatever they may be (as long as it's a file that some object or construct itself can open).

The idea came to me when I was thinking about the .mesh files exported by the mesh editor. I thought it may be possible to do a sort of frame-by-frame animation on a mesh by loading a series of .mesh files. I thought storing the .mesh files into the binary might be nice, but then there'd have to be a "Load mesh from resource" action, etc. Then it occurred to me that if you were allow the loading of files from binary, you'd have to add the "Load file from resource" action to all objects for whatever other file types, and that wouldn't really be necessary if you had a more general "Bin" type expression.

It would also be useful for text files, .ini files, hell... even .jpgs or whatever else. Wherever you have to load a file, just use

[code:hfo4t2zi]Bin "filename.ext"[/code:hfo4t2zi]

Of course, this feature would have to come after the capability to use resources for more than just sounds.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun May 24, 2009 9:38 pm

That's a good idea, actually. How about calling it getfilename("resource name")? If it hadn't already, it'd just dump a resource to a temporary file and return that path.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Sun May 24, 2009 9:53 pm

I think dedicated actions make it a bit easier and have the advantage of being able to pick the resource. Submit it to the feature tracker.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Sun May 24, 2009 10:00 pm

[quote="Ashley":279w7zhk]That's a good idea, actually. How about calling it getfilename("resource name")? If it hadn't already, it'd just dump a resource to a temporary file and return that path.[/quote:279w7zhk]

If not "Bin" then how about getResource("name.ext")? getfilename might be a bit confusing, as folks might think they're getting an actual external file. Might as well call a spade a spade.

[quote="Rich":279w7zhk]Submit it to the feature tracker.[/quote:279w7zhk]

Okay, will do.

E: Done
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun May 24, 2009 10:03 pm

Possibly better called 'fileresource', as there are several types of resources.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Sun May 24, 2009 10:17 pm

That's true, I didn't think about that. I think it needs a nice, snappy name like AppPath, though. Something short, sweet, and to the point.

"BinFile" or "ResFile" or maybe "Banana"
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun May 24, 2009 10:26 pm

FileRes sounds like a good one.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Mon May 25, 2009 1:26 am

Binfile is a good name for it.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Mon May 25, 2009 1:50 am

Inc for included
Incfile?
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Mon May 25, 2009 9:03 am

Why BinFile? Not every file is binary. Every file is a file :P.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Next

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 1 guest