[PLUGIN] Resource Access

This forum is currently in read-only mode.
  • NEW VERSION Resource Plugin 1.1

    Download: http://dl.dropbox.com/u/5426011/res%20plug/ResourcePlugin1.1.zip

    Examples:http://dl.dropbox.com/u/5426011/res%20plug/ResExamples.zip

    What's New:

    An action to load fonts. So now you can include and use fonts in your cap regardless if those fonts are installed on your system.

  • Nice!

    Looks like you can stick them into the resource folder as well.

    + System: Start of layout

    -> Resource: Extract Resource "BMutopia.TTF" as "BMutopia.TTF"

    -> Resource: Load Font Resource ("BMutopia.TTF")

    -> Text: Set font to "BM utopia"

  • This saved my life Thanks a looot! Now I can use my fonts \o/

  • I used the plugin in a small side project and had severe crashes. I could avoid the crashes by using one object per layout while all of them needed to be ticked global. Using one global object crashed as well as having several local objects.

  • 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:

    -> 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 [b]Resource ("foo")[/b] 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.
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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:

    -> 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 [b]Resource ("foo")[/b] 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.
    

    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:

    http://www.mediafire.com/file/j82u8distd6x68c/Xmas%20Yv.rar

    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?

  • Thanks R0J0, can use fonts now!

  • 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?

  • No, I don't think so. There is no set path action feature for the run-time in the 3d object.

  • Edit:

    Never mind I'm an idiot.

  • 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.

    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.

  • 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.

  • Good idea, i agree it would be much nicer to have it built directly into the program.

  • -snip, fixed it-

    This is really awesome! Thank you so much for making this! <img src="smileys/smiley4.gif" border="0" align="middle" />

  • Hello! I'm having trouble getting the plugin to work. I've installed it, and everything seems to be set up properly. I didn't use the "AppPath" format of the example, because I wanted to include the file as a resource.

    At the start of the layout, I set up the Extract and Load actions for the font, which is included in my project's "Files" folder. Then I added the action for the text to change to my desired font. But when I run the layout, the text displays as Ariel.

    Here's a cap:

    http://micahjones.info/games/Hujiko%20test.cap

    Maybe I've done something wrong?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)