User Tag List

Page 1 of 4 1 2 3 ... LastLast
Results 1 to 10 of 32

Thread: How to use array files for Android Saving?

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Simflare's Avatar
    Join Date
    Oct 2013
    Location
    Australia
    Posts
    374
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to use array files for Android Saving?

    Hi guys

    I can't get my array files to save for Android Exporter. Attached is an example file.

    I read Danny's guide for adding ini files to binary, and got inis to work with the Android Exporter, but I can't get arrays to work with the Android Exporter. I can get saving and loading working while the application is running on the phone, but as soon as I close the application, the save data resets. Can someone please help me use arrays for saving with Android Exporter?

    Thanks in advance
    Simflare


    Update

    Further testing has showed that I seem to have included the array in the binary, but for some reason cannot then save back in to the array on the phone. What I mean is, in testing on the PC, the value I stored in the array was 10.
    When I tested the latest version on the phone, it loaded that value of 10 in to the counter. But then when I try to change that value inside the application and save it, it goes back to 10 when I close and re-open the game.

    It appears I added the array to the binary from Fusion, but am unable to save to it again while running the application.

    Help please?
    Attached files Attached files

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export Module
    Muldoon's Avatar
    Join Date
    Dec 2013
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello!

    This is how i do it.
    In the splash screen / title screen:

    Start of Frame
    + clear array
    + load array from file (DataStorageDirectory$( "Android object" ) + "array.arr")

    Condition ValueAtX("array", 0) = 0 (only one action when event loops)
    + write value 1 to (0)
    + save array to file DataStorageDirectory$( "Android object" ) + "array.arr"

    Basicaly, i create(save) an array when the app launches for the first time and change the value of the first position to 1 so it won't create it again (the condition IF ValueAtX("array", 0) = 0).
    This example uses a 1-dimension array but it can be changed to 2 or 3. Also if you need more initial values written in your array you do this under the condition mentioned above.

    I hope this helps, good luck!

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Simflare's Avatar
    Join Date
    Oct 2013
    Location
    Australia
    Posts
    374
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Muldoon! Thanks for your reply

    So from what I understand, you are programming the game to create the array at runtime on the phone? And by setting the value of (x, 1) to 0, you create the array on the phone? Yes?

    Whereas I was trying to create the array on the PC and ship it with the game.

    Also, why do you "clear array" at the Start of the Frame? Will this erase save data inside the array?

    Thanks for your reply!

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export Module
    Muldoon's Avatar
    Join Date
    Dec 2013
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Let's say you have your splash/title frame in Fusion 2.5. You have an array object named "array". This is a number array having a 0 index.
    When you launch the app for the first time this array will get saved and stored in the phone. Initially it will be empty so the value of the 0 position will be 0.

    i set the value to 1 so that it will bypass the check for value 0 after creating the array for the first time. Basicaly you can set it to any value, except 0.
    I use "clear array" before loading an array from an external file. I don't know if it's really necessary, it's more of a habit of mine.
    If you need to populate the array with initial values you can do this under the condition [ ValueAtX("array", 0) = 0 (only one action when event loops) ] since it will only run once, when the app is launched for the first time.

    I used this technique in 2 of my Android games and it works flawlessly. Also, the array file created by the app will stay there when updating the app in Google Play (i tested this some time ago).

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    paobrasil's Avatar
    Join Date
    Apr 2012
    Location
    Rio de Janeiro, Brazil
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,

    I'm getting the same problem of Simflare......seens to array dont save the value.....

    Muldoon, in case of save and load array from iOS.....the iOS object dont provide "DataStorageDirectory$" to save or load.

    Can someone help me?

  6. #6
    Clickteam Clickteam
    Fernando's Avatar
    Join Date
    Dec 2006
    Posts
    6,247
    Mentioned
    176 Post(s)
    Tagged
    3 Thread(s)
    Regards,


    Fernando Vivolo

    ... new things are coming ...

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    paobrasil's Avatar
    Join Date
    Apr 2012
    Location
    Rio de Janeiro, Brazil
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you FVivolo,

    I can use this method to iOS too? for example this expression: "/storage/sdcard1" + "/testme.arr" will work on iOS too?

    So, I dont need to insert the array file to the Binary Data on Data Elements?

    Best regards, thank you again

  8. #8
    Clickteam Clickteam
    Fernando's Avatar
    Join Date
    Dec 2006
    Posts
    6,247
    Mentioned
    176 Post(s)
    Tagged
    3 Thread(s)
    no, path location are OS dependent

    Correct, NO need to add in binary data if you want to create at once, it will stay there when you need it and can be modify whenever you need it.

    but please be aware path location depend on devices.
    Regards,


    Fernando Vivolo

    ... new things are coming ...

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    paobrasil's Avatar
    Join Date
    Apr 2012
    Location
    Rio de Janeiro, Brazil
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you FVivolo!

    I've got it here...

  10. #10
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Simflare's Avatar
    Join Date
    Oct 2013
    Location
    Australia
    Posts
    374
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Muldoon, I cannot find out how to code the condition 'ValueAtX("array", 0) = 0 (only one action when event loops)'.

    I go to create a new event and right click on the array and all I can see is "Is X/Y/Z dimension at end" or "Loops>On Each Object"

    How am I support to set the condition 'Condition ValueAtX("array", 0) = 0 (only one action when event loops)' to check if the value of x,1 is 0?

    Thank you for your help.

Page 1 of 4 1 2 3 ... LastLast

Similar Threads

  1. Saving Array files
    By MTCMusic in forum HTML5 Export Module 2.5
    Replies: 2
    Last Post: 27th July 2013, 07:39 PM
  2. [RC5] Saving and/or loading array files
    By colej_uk in forum Android Export Module Version 2.0
    Replies: 9
    Last Post: 11th March 2013, 01:49 AM
  3. Saving to array from a sub app
    By Windybeard in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 6th June 2012, 02:44 PM
  4. Saving an array?
    By Tsun in forum SWF/Flash Export Module Version 2.0
    Replies: 3
    Last Post: 7th April 2012, 05:08 PM
  5. Array Saving
    By B5E in forum The Games Factory 2 - Technical Support
    Replies: 10
    Last Post: 28th July 2010, 04:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •