...use dictionary correctly

0 favourites
  • 2 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • Hi everyone,

    working with my dev partner on a early test project. using the google app engine we have a project working.. we can pass data to it, but what we're trying to do now is use a dictionary.

    testing it out we know there is 1 item out there because it shows up with a 1 in the .count but everything else we try seems to result in a 0 which means there is nothing out there. Our data never has a zero in it.. the two parameters are "content" and "success" content being where you enter your name..

    the data is out there, we just can't seem to get the dictionary to load that data correctly.. any ideas? here is the project currently.

    dropbox.com/s/4ghclu7va0nx61w/Test%20AJAX%20Project_ver.3.capx

    it's 3:47am here.. so if i left something out that would help please let me know! :)   questions like maybe, "do we need to make instance variables inside the dictionary? we tried that, but that didn't seem to help.

    we just can't seem to get the data out of the dictionary trying numerous different approaches.

    Sincerely,

    Caleb

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm working with the poster of this thread. We've found the answer. The answer lies in the response object. You must specify which construct 2 datatype you want to dump your json data to. In our case we had to set a key of 'c2dictionary':True and set your game related data to an key 'data:{}'.

    def post(self):

             self.response.headers['Access-Control-Allow-Origin'] = '*'

             # logging.info(self.request.get('name'))

             # self.response.out.write(self.request.get('name'))

             name = self.request.get('name')

             data = {

                  'c2dictionary':True,

                  'data':{

                       'success':True,

                       'content':name

                  }

             }

             

             logging.info(data)

             self.response.out.write(json.dumps(data))

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