Including external files and/or binary data with interpreted expressions

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I've been trying to include fairly large volumes of external files into my project's exe that are loaded at runtime via expressions, like generating backdrops or loading tilesets from PNG files, or level INIs and data. After testing the binary data extensively and looking up all the guides and threads, it really doesn't look like it works properly. I made sure I had proper syntax extracting files, loading them from the temp file address, releasing them on app close, etc- and no matter what permutation of where the build path was or data path was really worked, the compiled .exe would still care what folder it was in compared to the absolute path of the files that didn't exist, which is a big no-go. A lot of attempts came up with similar results as other people have reported in other threads, it didn't work at all.

    But the "include external files" option seems to work just as expected. Any files in the same path as the MFA/EXE build folder can be compiled into the exe and will extract as temp files and reference them just fine in the code on other machines regardless of exe location, looks great. Except one huge limitation- this feature is limited to only static file paths and doesn't work with interpreted strings. I can for example have a line that says
    >Load image "C:/Dev/Images/Sword_01.png"
    but I cannot have a line that says;
    >Load image "C:/Dev/Images/" + image_name + ".png"

    I understand the compiler may be flagging static paths to included files and aliasing them for those included in the .exe build, but my question is: Could a feature be added to allow a check at runtime whether an expression matches an included file, and if so, use that instead of looking for an external file? This might require some iterating string comparison and be less optimal, so it could be an optional checkbox. But would it be technically possible? I mean something like taking the string after its resolved and compare it to the original external file path (not temp path) of included files, and if it matches one, load from the temp path of that file instead.

    Its possible to include large numbers of external files without a direct reference in an application's main code by just slapping some deactive dummy code into a spare frame or level that tells an active picture object to load 500 different images or whatever, that's a simple enough solution to make them included without any interface for including external files like data elements allow. But without expressions, the only way to load them in via static paths would be.... creating an absurdly long switch statement kind of code that loads each direct asset based on an input index, like;

    >* On loop "load image"
    >>child events-
    >>* If image_name = "Sword_01"
    >>= Load image "C:/Dev/Images/Sword_01.png"
    >>* If image_name = "Sword_02"
    >>= Load image "C:/Dev/Images/Sword_02.png"
    >>* If image_name = "Sword_03"
    >>= Load image "C:/Dev/Images/Sword_03.png"
    ....

    performance aside, that's a bit problematic when I already have 358 external files of various types and will probably wind up 700+

  • Put the folder and its files in the same folder as the mfa, then in the path for the binary data files, replace the start by apppath$ + then the rest of the path.

    So for example:
    C:\Fusion\Projects\Data\image.png

    Lets suppose the mfa is inside Projects, so change it to:
    Apppath$ + "Data\image0.png"

    Then you can use a expression, like:
    Apppath$ + "Data\image" + Index + ".png"

    This will also make sure when you move the mfa with the files, it will find their new location automatically.

  • Put the folder and its files in the same folder as the mfa, then in the path for the binary data files, replace the start by apppath$ + then the rest of the path.

    So for example:
    C:\Fusion\Projects\Data\image.png

    Lets suppose the mfa is inside Projects, so change it to:
    Apppath$ + "Data\image0.png"

    Then you can use a expression, like:
    Apppath$ + "Data\image" + Index + ".png"

    This will also make sure when you move the mfa with the files, it will find their new location automatically.

    hmm so a lot of other older posts I saw about it said the way to go about including binary data was set aside a separate path like set it in D:/Bin/.... and using that absolute path
    but testing it out, it appears that putting everything in the same origin folder as the exe / build path and using that apppath$ is what did the trick, thanks.

    I guess it was trying to use a non-current-working-directory path that was screwing it up, so hopefully if someone in the future is googling up threads on it like I did with the other ones, they find this one.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!