Potential Dictionary bug

Not favoritedFavorited Favorited 0 favourites
  • 8 posts
From the Asset Store
Unlock the full potential of Web3 gaming with the Metapro Web3 Plugin for Construct 3
  • Hello,

    Before I report a bug in the Construct github issues, could someone take a look at this code I have?

    I am using the debugger to see that the "Key_Mutation_DICT" has been loaded in properly and when I console log the LoopArrayString.Get("23") I am getting the value 0...

  • Use "Add key" instead of "Set key" for the dictionary.

  • Make sure you use addkey, Set key wont set anything if the key doesn't exist.

  • Ah I see. Now I'm getting somewhere. Thank you. So does this mean I have to load in the json dictionary differently from an array?

  • So does this mean I have to load in the json dictionary differently from an array?

    If you're asking about the JSON string format, then yes - the dictionary JSON format is different from the array JSON format.

    {"c2dictionary": true,"data": {"0": ""}}
    
    {"c2array":true,"size":[1,1,1],"data":[[[""]]]}
    
    

    Also, please remove the "Trigger once" condition from your events. Don’t use it until you clearly understand how it works and what it does.

  • No, not the string format. I used the built-in dictionary feature to create the dictionary json file. Assuming that the JSON string format is correct, do I have to load it in differently when using AJAX?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The dictionary seems like it is loading in properly but I still get 0 when trying to perform the .Get() method (Ex: ".Get("2")

  • No, loading dictionaries with AJAX is not different from loading arrays or any other files.

    You are probably trying to get the key before the dictionary is loaded. AJAX request is asynchronous, you need to wait for it to be completed before accessing the dictionary.

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