External Data Extension [2.0.0]

ETHproductions

  • *
  • Posts: 430
@yoplalala: I tried using the two different methods in the post you linked to. Here's what I've come up with:

- Method 1 (accepted answer): Stencyl generates the .hxml files on compilation, and apparently doesn't include -resource links to the files in the extras folder. However, using Settings -> Advanced -> Haxe Flags, the files can be included manually, and retrieving them is just as easy as a single line of code. The problem with this is that the extension user will need to enter each file manually into the Haxe Flags box. @Master Stencylers: Is there a way to do this automatically?

- Method 2 (other answer): I managed to get an XMLHttpRequest working properly, and it doesn't need any customized fine-tuning from the user. The only problem is, this request is asynchronous, meaning that the text is not returned immediately; this in turn means that the text cannot be returned from the function, and has to manually be assigned to a variable. I don't know of any workaround to this, but I'll see what I can find.
Fontstruct - Stencyl - Website (in progress)

Proud Member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

yoplalala

  • *
  • Posts: 1591
Thanks for having taken some time @ETHProduction :)

For the method 2 maybe  you could use this tactic ( and put a timeout)

https://licson.net/post/turn-asynchronous-functions-to-their-synchronous-counterpart/

( didn't know you could do  "@MasterStencylers" , cool :) )

Justin

  • *
  • Posts: 4405
Using @ before a name has no functionality. It doesn't notify anybody of anything lol

Why the special solution for html5? Does putting a text file into the extras folder not work like it does in other targets?

For Live Support: Join our discord server and ping me @justin.
I'm most often available between 8am and midnight Japan time. (GMT+9)

yoplalala

  • *
  • Posts: 1591
Oh indeed . I looked at the bad file. Tried to modify the getText from Filesave instead of modyfing getTextData(file:String) from DataUtils  ....

Sorry @ETHProduction to have made lose your time :(

( still I'll put the @ at ETHProduction @Justin :P)

edit : @Justin  It seems unicode characters don't work on HTML5.

« Last Edit: November 19, 2015, 11:18:18 am by yoplalala »

ETHproductions

  • *
  • Posts: 430
@Justin: Oh hey, you're right! Changing "#if flash" to "#if (flash || js)" in the getTextData function (and a few others) appears to be all that is needed. How did I not think of that? :P

@yoplalala: Don't worry, I made the same mistake. ;) It should be fixed now (except for the Unicode problem; I'll look into that soon). Let me know if you experience any more problems.
Fontstruct - Stencyl - Website (in progress)

Proud Member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

Minimo

  • Posts: 201
This looks cool.

Is there any way to set a file path for saving an image outside the /extras folder ?
For example: to save an image to the camera roll (in Mobile) or desktop (desktop) ?


I found this for desktop:
http://community.openfl.org/t/resolved-saving-a-png-to-desktop/1831

And this for Android:
http://www.openfl.org/archive/community/programming-haxe/how-create-folders-write-files-android/


« Last Edit: November 25, 2015, 07:44:44 am by Minimo »

Donni11

  • *
  • Posts: 2182
Hello :) ! Pretty cool extension , so for the " save png" what do I type in into the field where it wants me to save the file ?
(2nd field)
Peace

ETHproductions

  • *
  • Posts: 430
@Minimo: I'm pretty sure this is possible, but I'll need to investigate. I hope to take a look later today.

@Donni11: Just enter the name with which you want to save the image. You don't need to include the ".png" at the end. If you want to save it in a folder, you can enter something like "images/screenshots/screenshot001".
Fontstruct - Stencyl - Website (in progress)

Proud Member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

Donni11

  • *
  • Posts: 2182
Peace

TheIndieStation

  • *
  • Posts: 2263
I can't get this extension to instal on my mac? I tried instilling the zip file, and putting it in manually, but without succes. Any idea what might cause this?

DudeMakingAGame

  • *
  • Posts: 306
I sent you a message but just a heads-up if other people have seen this:
I'm getting a hard crash on iOS and MAC when trying to save an image to extras:
[haxelib] FileSave.hx:135: ERROR: Failure type not string @ ./File.cpp:123

I'm on 3.4 (b8853).

Thanks!

Arafrael

  • Posts: 64
Hi! First: thanks for great extension.
Second: i had a bit different expectations, thought my game could use external resources without compilation.
For example, i wish i could create game, which prints text from "print.txt", then change this .txt file, save it, run already generated build (without compiling) and saw latest changes in game.
Maybe its too far from your planing functionality, but if you know how to get described feature with any kind of extension or something else - i would be very thankful.

DudeMakingAGame

  • *
  • Posts: 306
hey Arafrael, what do you mean by "without compilation". Code can't run without being compiled first. Stencyl games can't run without being compiled.
This extension allows you to get text from a text file, change text in a text file, save it and then get the new text from the file.
Could you explain differently what you're trying to accomplish?

Arafrael

  • Posts: 64
I solved my case by putting external .txt file on server, than using HTTP get request and parsing respond. Now i can change .txt and use new data without compilation.
It wasnt obviously for me, that response from external .txt file could be used and parsed as simple text - but it can! :)
I strongly recommend for developing team to put this info into documentation, because it was random attempt and i didnt expect this would work.

MichaelPel

  • *
  • Posts: 458
If I wanted to save a game on mobile, and load it after completely shutting the app down, how should I go about it?