How To Format (Content) In The Submitmove Function?

Superb, looking forward to the outcome…

Hi qwertier,

There seems to be a typo in the docs, the HTTP Method for rejecting a challenge should be DELETE, rather than POST.

This also needs to be updated in the corona-cloud-core.lua file.

Thanks

-Mohamed

Hey Mohamed,

The 404 error has been resolved by changing the HTTP method to DELETE.

However now I get the following response for both of the functions accept/decline:

status: 500;

We’re sorry, but something went wrong (500)

Not sure where this is coming from.

I now use the following configuration:

    - acceptChallenge(matchID, “lets play”)    HTTP method POST

    - declineChallenge(matchID)                     HTTP method DELETE

I am quite sure that my matchID is legal, while I first call getMatches() to get the matchID for the match that has a user with the state pending. Then I log in with this user and call either accept/declineChallenge(matchID) which both give me the 500 error.

Hope I have provided you with enough information to tackle the error :slight_smile:

I’m not getting the 500 error, but I’m getting a different issue.  I’ve email the folks on the cloud team to look into this further.  In my case though, the decline seemed to take effect when I got my next match list.

Ok, the corona-cloud-core.lua file on GitHub https://github.com/coronalabs/corona-cloud-core has been updated.

Please try again and let me know.

Thanks

-Mohamed

Ok testing it now.

BTW here a quick bug report for registering Android devices for push notifications:

In the register device function it currently says

if curDevice == "iPhone" or "iPad" then

However, it should really be

if curDevice == "iPhone" or curDevice == "iPad" then

Otherwise the device will always be seen as an Apple one

I get back to you as soon as possible!

It is a pity really but I still get the 500 error.

I have started a new game with a new invite so everything fresh, but it’s still not working.

Is it a problem if the game has already been started? When I create the game I always instantly set its state to started, don’t know if that might be a problem.

No its fine to add players after the game has started.

Can you please PM me your details like; userIDs, matchIDs, and any outputs your are getting.

Thanks

-Mohamed

Yeah sure, just a minute…

Hey qwertier or Rob,

Hoping you could help elaborate on the Base 64 decode resolution from the very beginning of this thread…I think I am getting the same type issue and wondering why it’s happening. 

I am looping through all submitted moves with getRecentMoves() and noticing that the most recent move will get returned correctly, but every move after that seems to bring back data like what qwertier was seeing. I am using the lua wrapper and it seems like the most recent move is getting base 64 decoded but the rest are not. Below is the code I’m using from the “getRecentMoves” event type (scaled down for the purposes of this example). 

local moves = event.response for i = 1, #moves do      print ("Move "..i..": "..moves[i].content) end  

The very first print statement shows my move content correctly, but the rest shows data in the following format:

W3siQTMiOjEwMzAsIkE1Ijo0MTUsIlExIjoxNTkyLCJTMyI6MjAwLCJBNCI6MTI0OSwiUTMiOjM1MjAsIlM0Ijo0MDAsIlM1IjowLCJRNCI6NDEwMSwiUTUiOjU2Niwi QTIiOjg5LCJRMiI6MTI3NSwiUzEiOjIwMCwicm91bmQiOjEsIkExIjo0NjYsIlMyIjowfV0=  

Is there an issue with my code or do I just need to base 64 decode every move after the first one?

Thanks!

Hi bonesmalone133,

How does your gerRecentMoves() look in the coronacloud.lua file?

It might be that you have an old version that only decodes the first item of the response table, which is the last move that has been made. I have added the following code in my getRecentMoves function in order to fix the issue:

local response = json.decode(event.response) for k,v in pairs( response ) do if (v ~= nil) then if coronaCloudController.debugEnabled then print(coronaCloudController.debugTextPrefix .. "Decoding Content") end response[k]["content"] = \_b64dec(v.content) end end

Hope this helps!

Cheers,

Qwertier

Thanks for the quick response! That fixed it!

I did just update to the most recent version of the cloud.lua file from the github and the issue is still there, so it looks like this hasn’t been fixed yet by Corona. I was able to use your code though to get it working properly…so hopefully Rob or Mohamed see’s this so they can get this on the issue list if it isn’t already.

Thanks again!

Glad it works now!

They won’t probably fix it anymore, while they have released a new CC file I believe.

It has a totally new structure if I am right.

Happy coding :slight_smile:

I believe I am using the newer version…unless there is a NEW new version?

I got it from here: https://github.com/coronalabs/framework-cloud after reading this blog post: http://www.coronalabs.com/blog/2013/04/23/new-corona-cloud-api-library/

Here is an article on the NEW Corona Cloud:

http://www.coronalabs.com/blog/2013/04/23/new-corona-cloud-api-library/

Cheers

Hey qwertier or Rob,

Hoping you could help elaborate on the Base 64 decode resolution from the very beginning of this thread…I think I am getting the same type issue and wondering why it’s happening. 

I am looping through all submitted moves with getRecentMoves() and noticing that the most recent move will get returned correctly, but every move after that seems to bring back data like what qwertier was seeing. I am using the lua wrapper and it seems like the most recent move is getting base 64 decoded but the rest are not. Below is the code I’m using from the “getRecentMoves” event type (scaled down for the purposes of this example). 

local moves = event.response for i = 1, #moves do      print ("Move "..i..": "..moves[i].content) end  

The very first print statement shows my move content correctly, but the rest shows data in the following format:

W3siQTMiOjEwMzAsIkE1Ijo0MTUsIlExIjoxNTkyLCJTMyI6MjAwLCJBNCI6MTI0OSwiUTMiOjM1MjAsIlM0Ijo0MDAsIlM1IjowLCJRNCI6NDEwMSwiUTUiOjU2Niwi QTIiOjg5LCJRMiI6MTI3NSwiUzEiOjIwMCwicm91bmQiOjEsIkExIjo0NjYsIlMyIjowfV0=  

Is there an issue with my code or do I just need to base 64 decode every move after the first one?

Thanks!

Hi bonesmalone133,

How does your gerRecentMoves() look in the coronacloud.lua file?

It might be that you have an old version that only decodes the first item of the response table, which is the last move that has been made. I have added the following code in my getRecentMoves function in order to fix the issue:

local response = json.decode(event.response) for k,v in pairs( response ) do if (v ~= nil) then if coronaCloudController.debugEnabled then print(coronaCloudController.debugTextPrefix .. "Decoding Content") end response[k]["content"] = \_b64dec(v.content) end end

Hope this helps!

Cheers,

Qwertier

Thanks for the quick response! That fixed it!

I did just update to the most recent version of the cloud.lua file from the github and the issue is still there, so it looks like this hasn’t been fixed yet by Corona. I was able to use your code though to get it working properly…so hopefully Rob or Mohamed see’s this so they can get this on the issue list if it isn’t already.

Thanks again!

Glad it works now!

They won’t probably fix it anymore, while they have released a new CC file I believe.

It has a totally new structure if I am right.

Happy coding :slight_smile:

I believe I am using the newer version…unless there is a NEW new version?

I got it from here: https://github.com/coronalabs/framework-cloud after reading this blog post: http://www.coronalabs.com/blog/2013/04/23/new-corona-cloud-api-library/