How To Format (Content) In The Submitmove Function?

Hey guys,

The getRecentMoves function gives me some random string in the content parameter, some examples are:

NztFTl9VUzsxMQ==

N0VOVVMxMQ==

NztFTl9VUzsxMQ==

These values seem random to me. Am I using the wrong format for the content parameter in the submitMove function?

This is what the call looks like: submitMove( “somestring”, nil, userID, matchID, nil )

Hope you guys can help me with this one :slight_smile:

Those look like Base 64 encoded strings.  Are you calling the REST api calls directly or using the corona-cloud-core.lua file?  The Lua file’s wrapper calls will Base 64 encode your data (to keep it web-safe) and it should decode it for you when the RecentMoves Multiplayer event is dispatched. 

The mime module (mime = require(“mime”) ) has a Base 64 decode function.  The corona-cloud-core.lua file has a b64 decode function in it as well but it’s not exposed so you would need to probably copy it to your local code.

Awesome Rob I got it to work thanks for your help.

Unfortunately I have got another question for you.

I am unable to call the functions acceptChallenge and declineChallenge this is what I get as a response:

“status”:404,“url”:"[https://api.coronalabs.com/matches/********match_id**********/reject_request.json](https://api.coronalabs.com/matches/ match_id** /reject_request.json)",“isError”:false

With the response being:

The page you were looking for doesn’t exist (404) … etc.

Have you guys changed the address of these two API calls?

Thanks in advance

Are you using our Lua API calls or are you making the REST calls directly?

I am making the calls from LUA so coronaCloud.acceptChallenge(matchID)

I just duplicated the problem.  I’ll email the team and find out what’s going on.

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…

Those look like Base 64 encoded strings.  Are you calling the REST api calls directly or using the corona-cloud-core.lua file?  The Lua file’s wrapper calls will Base 64 encode your data (to keep it web-safe) and it should decode it for you when the RecentMoves Multiplayer event is dispatched. 

The mime module (mime = require(“mime”) ) has a Base 64 decode function.  The corona-cloud-core.lua file has a b64 decode function in it as well but it’s not exposed so you would need to probably copy it to your local code.

Awesome Rob I got it to work thanks for your help.

Unfortunately I have got another question for you.

I am unable to call the functions acceptChallenge and declineChallenge this is what I get as a response:

“status”:404,“url”:"[https://api.coronalabs.com/matches/********match_id**********/reject_request.json](https://api.coronalabs.com/matches/ match_id** /reject_request.json)",“isError”:false

With the response being:

The page you were looking for doesn’t exist (404) … etc.

Have you guys changed the address of these two API calls?

Thanks in advance

Are you using our Lua API calls or are you making the REST calls directly?

I am making the calls from LUA so coronaCloud.acceptChallenge(matchID)

I just duplicated the problem.  I’ll email the team and find out what’s going on.