Using C3 to create a dictionary data file (possible bug?)

0 favourites
  • 3 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • I started this thread in the Construct 2 General Discussion board, but I think the problem may be specific to Construct 3 so I'm recreating it here.

    I was trying to learn about the Dictionary object the other day and I created a simple test:

    1. I started a new project

    2. I added a dictionary object, AJAX, a button, and a text object.

    3. I right clicked on "Files" and picked New --> Dictionary

    4. I made size = 4 and I created four sample keys:

    "Name" = "John"

    "Age" = 56

    "last_played" = 0

    "puzzles_lost" = 0

    Then I created a few events that looked like this:

    To my surprise, clicking the button on my layout did NOT change my text string to "John" as I expected. It changed to "0". When I looked at the debug panel the dictionary appeared to have the correct information, though when I looked at the string for AJAX.LastData it looked like this:

    {
       "c2dictionary": true,
       "data": {
          "\"Name\"": "\"John\"",
          "\"Age\"": 32,
          "\"last_played\"": 0,
          "\"puzzles_lost\"": 0
       }
    }[/code:1b28gtnl]
    
    Are the back slashes normal? I didn't edit the JSON data, I just had C3 make it for me...
    
    As a test I added some keys to my dictionary object using "Add Key" and everything worked as intended.
    
    [img="http://i68.tinypic.com/2s1m2rq.jpg"]
    
    I'm stumped. Is this a bug in Construct 3? Or is it, [b][i]once again[/i][/b], something stupid I'm doing wrong? 
    
    Here's my .c3p file:
    [url]https://ufile.io/hk7a1[/url]
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You don't need the quotes in the JSON file. Get rid of all of them, and it works.

  • [quote:34y3482z]You don't need the quotes in the JSON file. Get rid of all of them, and it works.

    That did the trick! Thank you very much, blackhornet. That was driving me nuts.

    For anyone else who might run into this same issue in the future I made a quick diagram:

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