External Data Extension [2.0.0]

Justin

  • *
  • Posts: 4514
No, not required at all. That was totally unrelated to the problem you're facing.
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

arpeggiudio

  • *
  • Posts: 14
Thanks just wanted to be sure.

Still same issue: I can't append text to 'test.txt' in the 'extras' folder. Very simple test game, just one scene (attached) Perhaps interesting: if text is appended when clicking screen nothing happens. If appended on a timer (after 5 seconds) the game exits. FWIW I do have an sd card attached to the device (would rather not depend on user having an sd card though) THX!!



yoplalala

  • *
  • Posts: 1611
@arpeggidio

Sorry I forgot about you ....

I reread the last few posts but I think I understand .

I'm not sure sure appending text to the file  when it is an internal extra should work.
Why ?   Because android doesn't unzip the apk when it plays it. So it cannot write inside of it. Normally you should be able to read it


possible (untested solution) : copy the text from the apk to the userDirectory and applicationStorageDirectory then write to it.

note to self: check what is userdirectory  and appplicationStorageDirectory/

Now it's compiling :) and I'll tell you how to do it with a tested solution

yoplalala

  • *
  • Posts: 1611
Here's a new FileSave.

I've juste replaced "userDirectory" with "applicationStorageDirectory".
So it doesn't need to save on the sd card.

It doesn't have the same use as the original FileSave as a normal mobile user who doesn't have "root access" won't able to be copy the file or modify the file from outside your stencyl's program.   ( like with file explorer).

If you want to have access to the sd card. you have to set the permission like Justin said.


PS : the sd card isn't a real external sd card. it's the normal mobile memory card, so everyone has as a card.

arpeggiudio

  • *
  • Posts: 14
I appreciate your work here. Thank you so much. Sadly I still haven't gotten the hang of this  :-[ I am obviously out of my depth here *cry*
At this point, my question is: is what I am trying to do actually supposed to work?

In this project, there is one text file (test.txt) saved in the Extras folder. The contents of that file is "abc" When run on android, I hope to see "abc" being appended to the text every 10 seconds. Is that supposed to work, or have I have I got the wrong idea about this extension?

arpeggiudio

  • *
  • Posts: 14
I'm just going to answer my own question here. It does work as I expected. I remade the project and it works now. Really not sure why, but I followed the rule:

Don't forget to erase your work often.

Thanks again for all your help here!

arpeggiudio

  • *
  • Posts: 14
Hey I spent some time experimenting with this extension (and harassing Luyren a lot) One place I ran into trouble:

1 Text file in extras folder has the text abc
2 App told to do something if text in file is abc - this works
3 App appends def to that text
4 App is to do something if the text in the file is abcdef - doesn't work.

If I have a 'when drawing' event on the scene to draw the text it updates as expected.

At this point I have a workaround but I would really love to use this extension to be able to do step 4 - if that is possible? Let me know when you have a moment, thanks!


yoplalala

  • *
  • Posts: 1611
Quote
I'm just going to answer my own question here. It does work as I expected. I remade the project and it works now. Really not sure why, but I followed the rule:

Don't forget to erase your work often.

Thanks again for all your help here!

I think it's because when you modify something from outside Stencyl. Stencyl doesn't jknow you've changed something  so you have to clean your cache.

So yes better to clean your cache times to times to see if there's somthing not wokring befire the day you want to publish.


Quote
4 App is to do something if the text in the file is abcdef - doesn't work."

How are you checking it  ?

Normally it should be possibly.  I have maybe an idea why id doesn't work as expected.