When player has done something (call cloud script), other players should know what happen. So I use ScriptMessage.Listener. As you can see on the documentation, it said "See the Spark.sendMessage function...". So I found Spark.sendMessage documentation, it said "DEPRECATED use Spark.message(extCode)".
Previously, I can send back the json data to players via Spark.sendMessage() but now it deprecated. Spark.message() receive only exit code. So where should I put the json data.
My point is please update documentation. When new feature(s) release, please do update documentation.
Best Answer
C
Customer Support
said
about 5 years ago
There was another API update. The current API call for sending messages is this...
var mess = Spark.message("messageShortCode"); mess.setPlayerIds(Spark.getPlayer().getPlayerId()) mess.send();
We are very sorry about this, and we are aware our documentation is lackin in certain areas. We are currently in the process of overhauling all our documentation, so please bear with us.
You can try using the following example for sending messages...
This example is for a script-message, but you should be able to adapt that for your own scipt-message, or sending another message by id the same way.
Thanks, Sean
N
Nirut Khemasakchai
said
almost 7 years ago
Hi Sean,
Thanks for your kind response. May I know why you suggest me to use deprecated function? or it will be not deprecated in the future?
Thanks,
Nirut
O
One More Turn
said
almost 7 years ago
So does "sendMessageExt" still work?
Customer Support
said
almost 7 years ago
Hey Nirut,
Sorry, i misunderstood. I thought your original question was where to put JSON data in the depreciated call. My advice was just to show you that sendMessageExt does still work, and you can use this also. Our API needs to be backwards compatible to older games, but unfortunately we have not updated that part of our documentation as of yet. Thanks for pointing this out.
Sean
Customer Support
said
about 5 years ago
Answer
There was another API update. The current API call for sending messages is this...
var mess = Spark.message("messageShortCode"); mess.setPlayerIds(Spark.getPlayer().getPlayerId()) mess.send();
Nirut Khemasakchai
When player has done something (call cloud script), other players should know what happen. So I use ScriptMessage.Listener. As you can see on the documentation, it said "See the Spark.sendMessage function...". So I found Spark.sendMessage documentation, it said "DEPRECATED use Spark.message(extCode)".
Previously, I can send back the json data to players via Spark.sendMessage() but now it deprecated. Spark.message() receive only exit code. So where should I put the json data.
My point is please update documentation. When new feature(s) release, please do update documentation.
There was another API update. The current API call for sending messages is this...
var mess = Spark.message("messageShortCode");
mess.setPlayerIds(Spark.getPlayer().getPlayerId())
mess.send();
1 person has this question
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstCustomer Support
We are very sorry about this, and we are aware our documentation is lackin in certain areas. We are currently in the process of overhauling all our documentation, so please bear with us.
You can try using the following example for sending messages...
myPlayers= [];
myPlayers.push(Spark.getPlayer());
Spark.sendMessageExt({"one" : 1, "two": 2, "three": 3}, "myScriptMessage", myPlayers);
This example is for a script-message, but you should be able to adapt that for your own scipt-message, or sending another message by id the same way.
Thanks,
Sean
Nirut Khemasakchai
Hi Sean,
Thanks for your kind response. May I know why you suggest me to use deprecated function? or it will be not deprecated in the future?
Thanks,
Nirut
One More Turn
So does "sendMessageExt" still work?
Customer Support
Sorry, i misunderstood. I thought your original question was where to put JSON data in the depreciated call.
My advice was just to show you that sendMessageExt does still work, and you can use this also.
Our API needs to be backwards compatible to older games, but unfortunately we have not updated that part of our documentation as of yet.
Thanks for pointing this out.
Sean
Customer Support
There was another API update. The current API call for sending messages is this...
var mess = Spark.message("messageShortCode");
mess.setPlayerIds(Spark.getPlayer().getPlayerId())
mess.send();
-
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