Unable to load an array

0 favourites
  • 8 posts
From the Asset Store
Is a circular loading screen with code ready to use. No Animation.
  • Hello,

    I am using two different Arrays for equipment and inventory.

    The thing is i use exact same events for inventory and equipment.

    For inventory i am able to save it as json and load it back, but for equipment i am able to save it but unable to load it back. any idea why this is happening?

    Thanks in advance

    images for reference

    the local storage names for inventory and equipment is inventory_array and equipment_array, as you can see the inventory array is able to load the data in array, but equipment array is not loading data.

    events:

    Both the events are same.

    Tagged:

  • Right-click on the Array and choose "Find all references" to check if there is another event changing the values of the Array.

  • Tried that and inactivated all the other events other than this for the equipment array. Still same issue

  • The issue might be that the asyncronous "set item" action gets interupted by the layout change. Or that the saving has not finished yet on start of layout.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Any idea how i can fix that ?

  • At first, I was gonna replay the same thing as Fedca as you dont use the "On Item Set" or "Wait for previous actions" when you save at the end of the layout but your picture shows that the Local storage has the Array Json saved so that's why I thought could be something else.

    You can do a quick test since the Local storage has the data:

    1-Create an empty Layout + Attach a new empty Event-Sheet

    2-Add a text box

    3-Add these events:

    4-Preview directly into that new layout

    See if it will print the data from the local storage into the text box

    If it prints the Data then the problem must be something else, if not then it could be the data corrupted, delete the key and save it again using the methods I mention above.

  • I did what you mentioned and i am able to get the data in the text box, any idea what the issue could be ?

  • I did what you mentioned and i am able to get the data in the text box, any idea what the issue could be ?

    If it works then the Array should work swell on that layout as on a new layout + New Event-sheet it shouldn't be anything interfering with the Array.

    You can test loading the Array on that layout and if it fails press F12 to check the console logs and see if there is any error as it most probably could be a bug.

    Also, you can validate if the data is a valid Array JSON by printing it on the textbox as you did then copy the data and open a new empty project and add an Array and try to load the Array directly from that JSON string without using any Local storage and see if it works.

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