How do I correct my json array mistake?

0 favourites
  • 6 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • Hello all,

    Please, can you help me with a mistake I made?

    I want to use arrays in my game. So I right-clicked on "Files" then "New" and then "Array". Then I set up the dimensions and filled those array elements manually with the data, which during the program cycle, does not change.

    The problem started when I wanted to check the contents of the created arrays. I added a simple text object and in the "Start of layout" I wanted to show the content of a particular array element in that text.

    The problem is that I do not know how I can reference that json array so that the content of a cell inside the array is shown.

    I double-clicked the layout and chooses "Array" however, I cannot manually add content as I did with the json array.

    I looked on the Internet, and the manuals and found a lot of information, but nothing that I am looking for.

    Can you please, tell me how to reference the created json arrays so I can show the content into the text object.

    Thank you so much for your help which is appreciated.

    Chris

  • Add the Ajax object to the project.

    Events :

    On start of layout : ajax request project file (your file)

    Ajax on completed : array object - load action with value ajax.lastdata

    This loads the file into the array, you can then manipulate it with the events.

  • Hello Lionz,

    Thank you so much for your reply, which I do appreciate.

    I tried your solution but failed to load the array with ajax.lastdata.

    In one of my former replies (which failed because of a time out error) I included a screen capture which contained the events and actions.

    At this moment I have to go to bed because it is late. I will try again during the weekend and share the results here.

    Chris

  • Hi Lionz,

    I try to resend the screen capture here:

    Hope this succeeds.

    Chris

  • Hi Chris

    The on completed "tag" needs to be the same as the request. Should be on "GetHomeFields" completed as it is waiting for the "tag".

    Also the action is not system load game, you should pick the Array object and use Load action, remember you are loading data into the array. System load is for save game type stuff.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello Lionz,

    Thank you so much for your help which solved my problem. I successfully loaded the JSON file into the array.

    Wish you a lovely weekend and all the best!

    Chris

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