How do I retrieve array values when using built in array objects?

Not favoritedFavorited Favorited 0 favourites
  • 8 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I have an Array object - pointValuesArray.json - an array created with built in array table and populate with some values.

    On start of layout, I request file pointValues.json and on completed, set PointsValue json from parse AJAX.LastData

    Consol log PointValues.Get(".Value1")) - returns value of 0 - which is incorrect.

    If I put same values in a flat json text file, calling this returns value as expected.

    What is wrong with my syntax for getting values from an Array or Dictionary table object?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you mean the built in array file loaded into an array object then you use the array actions such as array.at(0,0). Also you can check in debug view if the array object is populated with the values as expected.

  • set PointsValue json from parse AJAX.LastData

    Consol log PointValues.Get(".Value1")) - returns value of 0 - which is incorrect.

    Looks like your PointsValue object is a JSON object. It needs to be an Array object.

    You use "Array Load" (not "Parse") action to load the data, and Array.At() expression (not Array.Get()) to access it.

  • If you mean the built in array file loaded into an array object then you use the array actions such as array.at(0,0). Also you can check in debug view if the array object is populated with the values as expected.

    Under file, I have PointValuesArray.json - an array table thing - is this an array object? - it can be edited in the Array Editor. It is populated with a few lines of data.

    I can't work out how to call array.at(0,0) on this data to use it in real life.

    I'm staring blankly at the manual -

    construct.net/en/make-games/manuals/construct-3/interface/file-editors/array-editor

    Am I missing a part 2 or is what I need to know somewhere on this page?

  • > set PointsValue json from parse AJAX.LastData

    > Consol log PointValues.Get(".Value1")) - returns value of 0 - which is incorrect.

    Looks like your PointsValue object is a JSON object. It needs to be an Array object.

    You use "Array Load" (not "Parse") action to load the data, and Array.At() expression (not Array.Get()) to access it.

    Is a table created with this thing - construct.net/en/make-games/manuals/construct-3/interface/file-editors/array-editor <-- an array object?

    When I try write to consol: "PointValues value A: " & PointValuesArray.At(0,1)

    'PointValuesArray' is red - error message - PointValuesArray is not an object name.

    How do I make PointValuesArray.json an object?

  • Look at the PointValues object in your project - what is its type, what icon does it have?

    I'm almost certain that your PointValues object is JSON, which is wrong. You need to delete it and add a new Array object instead.

  • I have a file - pointValuesArray.json, which can be edited with the array editor.

    AJAX on "PointValuesArray" completed -

    Returned pointValuesArrayJsonObj json data from debug:

    {"c2array":true,"size":[2,13,1],"data":[[["A"],[2],[3],[4],[5],[6],[7],[8],[9],[10],["J"],["Q"],["K"]],[[1],[2],[3],[4],[5],[6],[7],[8],[9],[0],[0],[0],[0]]]}

    When I double click pointValuesArray.json, I get an editable table like this table -

    construct.net/en/make-games/manuals/construct-3/interface/file-editors/array-editor

    but unable to retrieve values.

    "PointValues A: " & pointValuesArrayJsonObj.Get(".A")

    returns 0

    I can see this JSON data in the debug, but unable to show this data in the consol and thus anywhere else - thus reluctant to delete it

    I also have a PointValues array object - but have no idea how to populate it with data - unable to figure out how to insert data into the array object.

  • I also have a PointValues array object - but have no idea how to populate it with data - unable to figure out how to insert data into the array object.

    Use "PointValues Load" action.

    -> PointValues: Load from JSON string AJAX.LastData

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