In findMatch Event there is error. There should be "matchRanked" instead "rankedMatch", because everywhere else is "matchRanked".
And also seems like in Match Found Message, script doesn't create challenge. It doesn't do anything. But if I create this request in Test Harness, it works.
here is code I wrote to create match with event, but it doesn't create match
It will return the response and you can see if there's any errors. I do advise that you manually call the match through test harness using the matchmaking request just to see that everything works fine before going to Cloud Code.
Sorry yeah I forgot to add that challenge.setNextPlayer() doesnt work right now. I will put a feature request in for it.
I didn't realise we haven't changed rankedMatch to matchRanked on the docs yet. I got that changed, it will reflect in the next Doc update, cheers for catching it.
And I suspect you can't create a challenge because you're feeding it the wrong date format. your format gives you:
"Mon May 15 2017 09:47:45 GMT-0000 (UTC)"
The correct format needed is :
"2017-05-15T10:43Z"
Here's a snippet that will help you create this format for your dates:
var tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
var inHalfMinute = new Date();
inHalfMinute.setSeconds(inHalfMinute.getSeconds() + 20);
var inOneMin = new Date();
inOneMin.setMinutes(inOneMin.getMinutes() + 1);
//Turn to ISO string format
var tomorrowISO = tomorrow.toISOString();
var inHalfMinuteISO = inHalfMinute.toISOString();
var inOneMinISO = inOneMin.toISOString();
//Cull the string and add Z at the end to suffice Challenge time format
tomorrowCorrectFormat = tomorrowISO.substr(0,16) + "Z";
inHalfMinuteCorrectFormat = inHalfMinuteISO.substr(0,16) + "Z";
inOneMinCorrectFormat = inOneMinISO.substr(0,16) + "Z";
Hope this helps,
Omar
V
Viacheslav Pimakhov
said
almost 5 years ago
didn't help
but, as I said, if I paste all the same parameters in test harness's createChallenge request it works.
It will return the response and you can see if there's any errors. I do advise that you manually call the match through test harness using the matchmaking request just to see that everything works fine before going to Cloud Code.
Sorry yeah I forgot to add that challenge.setNextPlayer() doesnt work right now. I will put a feature request in for it.
Cheers,
Omar
1 person likes this
V
Viacheslav Pimakhov
said
almost 5 years ago
Creation works now. Didn't know about that kind of debugging. Thanks!
Is there any way to change current player in turn base game?
cause now when I send ChallengeEvent from the "not next player", I get error
I can use ChatOnChallengeRequest to send data, but If it's possible to use RequestEvents, it'll be great
Tech Support
said
almost 5 years ago
Hey VIacheslav,
You can use Log Event Requests with a string attribute for challenge instance id and send/save/get data from challenge without it having to be the players turn. Calling a Challenge Log Event requires you to be the 'nextPlayer'. You can still use a normal log event request and reference the challenge.
Viacheslav Pimakhov
Hi!
page https://docs.gamesparks.com/tutorials/multiplayer/hearthstone-example/matchmaking.html
In findMatch Event there is error. There should be "matchRanked" instead "rankedMatch", because everywhere else is "matchRanked".
And also seems like in Match Found Message, script doesn't create challenge. It doesn't do anything. But if I create this request in Test Harness, it works.
here is code I wrote to create match with event, but it doesn't create match
I wrote specific challenged player id
-----------------------
var tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
var inHalfMinute = new Date();
inHalfMinute.setSeconds(inHalfMinute.getSeconds() + 20);
var inOneMin = new Date();
inOneMin.setMinutes(inOneMin.getMinutes() + 1);
//Create a challenge request
var request = new SparkRequests.CreateChallengeRequest();
request.accessType = "PRIVATE";
request.challengeShortCode = "chalRanked";
request.endTime = tomorrow;
request.expiryTime = inHalfMinute;
request.startTime = inOneMin;
request.usersToChallenge = ["57daddf292c95a70de9fbb21"];
request.maxPlayers = 2;
request.minPlayers = 2;
request.silent = false;
request.message = "WHAT?";
request.SendAs(Spark.getPlayer().getPlayerId());
//Send the request
// request.Send();
-----------------------
also when match started, when I call
challenge.takeTurn(challenge.nextPlayer);
or
challenge .consumeTurn(challenge.nextPlayer);
nextPlayer stays the same
Try to use:
It will return the response and you can see if there's any errors. I do advise that you manually call the match through test harness using the matchmaking request just to see that everything works fine before going to Cloud Code.
Sorry yeah I forgot to add that challenge.setNextPlayer() doesnt work right now. I will put a feature request in for it.
Cheers,
Omar
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstTech Support
Hi Viacheslav,
I didn't realise we haven't changed rankedMatch to matchRanked on the docs yet. I got that changed, it will reflect in the next Doc update, cheers for catching it.
And I suspect you can't create a challenge because you're feeding it the wrong date format. your format gives you:
"Mon May 15 2017 09:47:45 GMT-0000 (UTC)"
The correct format needed is :
"2017-05-15T10:43Z"
Here's a snippet that will help you create this format for your dates:
Hope this helps,
Omar
Viacheslav Pimakhov
didn't help
but, as I said, if I paste all the same parameters in test harness's createChallenge request it works.
{
"@class": ".CreateChallengeRequest",
"accessType": "PRIVATE",
"autoStartJoinedChallengeOnMaxPlayers": false,
"challengeMessage": "",
"challengeShortCode": "chalRanked",
"currency1Wager": 0,
"currency2Wager": 0,
"currency3Wager": 0,
"currency4Wager": 0,
"currency5Wager": 0,
"currency6Wager": 0,
"eligibilityCriteria": {},
"endTime": "2017-05-15T13:14Z",
"expiryTime": "2017-05-15T13:14Z",
"maxAttempts": 0,
"maxPlayers": 2,
"minPlayers": 2,
"silent": false,
"startTime": "2017-05-15T13:14Z",
"usersToChallenge": [
"57daddf292c95a70de9fbb21"
]
}
also when match started, when I call
challenge.takeTurn(challenge.nextPlayer);
or
challenge .consumeTurn(challenge.nextPlayer);
nextPlayer stays the same
Tech Support
Try to use:
It will return the response and you can see if there's any errors. I do advise that you manually call the match through test harness using the matchmaking request just to see that everything works fine before going to Cloud Code.
Sorry yeah I forgot to add that challenge.setNextPlayer() doesnt work right now. I will put a feature request in for it.
Cheers,
Omar
1 person likes this
Viacheslav Pimakhov
Creation works now. Didn't know about that kind of debugging. Thanks!
Is there any way to change current player in turn base game?
cause now when I send ChallengeEvent from the "not next player", I get error
I can use ChatOnChallengeRequest to send data, but If it's possible to use RequestEvents, it'll be greatTech Support
Hey VIacheslav,
You can use Log Event Requests with a string attribute for challenge instance id and send/save/get data from challenge without it having to be the players turn. Calling a Challenge Log Event requires you to be the 'nextPlayer'. You can still use a normal log event request and reference the challenge.
Hope that helps,
Omar
1 person likes this
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics