[PLUGIN] Resource Access

Completed plugins, behaviors and effects.

Post » Sun Jan 09, 2011 2:50 am

The only reasons for crashes is if the file has not been extracted yet or there are no Resource instances. In both cases the resource plugin doesn't crash, it is another plugin trying to load a file that crashes.

The expression Resource ("foo") will return the path of the file if it's been extracted, otherwise if the file isn't extracted it will return an empty string :"".
The action of loading a file with the path "" is what causes the crash. For example this will crash:
[code:3s0tnvwh]-> EditBox: Load file ""[/code:3s0tnvwh]

All that should be needed is 1 global resource object. When a object is global it will exist on the layout it was created on then all other layouts run after that. If there are no instances of Resource the expression Resource ("foo") will return 0, which also causes a crash if it's used as a file path to load. It's a default behavior of construct to return 0 when a expression is used and there are no instance of that object.
B
79
S
24
G
54
Posts: 4,746
Reputation: 40,755

Post » Sun Jan 09, 2011 7:16 am

[quote="R0J0hound":2maq9f0a]The only reasons for crashes is if the file has not been extracted yet or there are no Resource instances. In both cases the resource plugin doesn't crash, it is another plugin trying to load a file that crashes.

The expression Resource ("foo") will return the path of the file if it's been extracted, otherwise if the file isn't extracted it will return an empty string :"".
The action of loading a file with the path "" is what causes the crash. For example this will crash:
[code:2maq9f0a]-> EditBox: Load file ""[/code:2maq9f0a]

All that should be needed is 1 global resource object. When a object is global it will exist on the layout it was created on then all other layouts run after that. If there are no instances of Resource the expression Resource ("foo") will return 0, which also causes a crash if it's used as a file path to load. It's a default behavior of construct to return 0 when a expression is used and there are no instance of that object.[/quote:2maq9f0a]
I see and it is exactly what I thought, too. And I wasn't clear enough of what I was using it for. I used it to load a font from a folder on disk. And it really only works the way I describe it. Here is the project (just some private text removed), in case you are curious:
[url:2maq9f0a]http://www.mediafire.com/file/j82u8distd6x68c/Xmas%20Yv.rar[/url:2maq9f0a]

btw, what happens if you are trying to load and use a font that is already installed on the computer? Is it safe to load it anyway?
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Sat Apr 16, 2011 12:33 pm

Thanks R0J0, can use fonts now!
B
4
S
1
G
1
Posts: 63
Reputation: 776

Post » Thu May 26, 2011 6:20 pm

This plugin is awesome, though I can't figure out how to use it with 3D objects. Is there any way to use it in conjunction with the 3D object plugin?
B
77
S
49
G
25
Posts: 346
Reputation: 17,409

Post » Fri May 27, 2011 4:05 am

No, I don't think so. There is no set path action feature for the run-time in the 3d object.
B
21
S
4
G
4
Posts: 280
Reputation: 2,934

Post » Fri May 27, 2011 5:53 am

Edit:
Never mind I'm an idiot.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Fri May 27, 2011 10:25 pm

Thanks, this is something that Construct really needed. I didn't notice that the fonts wouldn't work on a different computer until I made a test .EXE of one of my near-completed games and ran it on another computer...

Thanks to you, I won't have to settle for the boring Small Fonts font if I want retro fontage.

Great job, R0j0!


EDIT:
As for finding the true file-name of the font, I just right-click and go to properties, right?

The font I want to load is called Atari Classic Chunky, and that's the file name.

When i rightclick properties, it says at the top ATARCC_
Does that mean I do AppPath + "ATARCC_.ttf" ??

EDIT 2:

NVM, I think I answered my own question after a little experimentation.



EDIT 3:

Ok I thought of a real question, bear with me. :shock:


Now, in your example .cap, you nonetheless have the font in the .CAP directory file (where all the examples are kept), so I assume the .CAP gets the font from there.

If I make a .cap with a font that computers wouldn't normally have, would I have to put it in with all the other files I put together (like the music) before I export to an .EXE? Or will the plugin carry over the font into other computers without me needing to put the .ttf file into it?

I don't think the plugin would be that powerful, but I would like to make sure, just in case.
Check out my VGM on my soundcloud page!
Video-Game Music: E.C.2151
B
7
S
2
G
2
Posts: 193
Reputation: 1,561

Post » Sat May 28, 2011 3:30 am

Rojo, since you are now helping to develop Construct Classic, is there any way to incorporate this functionality into the main features of the program? It really seems like this kind of thing should be part of the program itself, and not a separate plugin. Fonts especially, since I believe it was originally planned that you be able to embed font resources anyway, and that feature just fell by the wayside somewhere over the course of development.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat May 28, 2011 9:51 am

Good idea, i agree it would be much nicer to have it built directly into the program.
B
2
S
2
G
1
Posts: 121
Reputation: 1,092

Post » Fri Jul 22, 2011 11:45 pm

-snip, fixed it-

This is really awesome! Thank you so much for making this! Phobos0022011-07-23 14:46:51
B
26
S
7
G
5
Posts: 202
Reputation: 5,235

PreviousNext

Return to Completed addons

Who is online

Users browsing this forum: No registered users and 0 guests