public void GetMessages(GameSparks.Api.Messages.ScriptMessage message)
{
if (message.ExtCode == "test")
{
Debug.Log("Got message " + message.Title);
}
}
When I go into the test harness, I log in as another user, then run the logEvent script. Each time I do, it pops up a windows showing the cloud code and telling me it isn't working.
Any ideas?
Best Answer
C
Customer Support
said
over 6 years ago
Hi Phillip,
The 'sendMessageExt' function doesn't take a username as it's third parameter, it needs either a SparkPlayer or an array of SparkPlayers. You can obtain these using the target player's id - var player = Spark.loadPlayer(playerId)
What error are you seeing in the Test Harness debugger?
Regards,
Vinnie
1 Comment
Customer Support
said
over 6 years ago
Answer
Hi Phillip,
The 'sendMessageExt' function doesn't take a username as it's third parameter, it needs either a SparkPlayer or an array of SparkPlayers. You can obtain these using the target player's id - var player = Spark.loadPlayer(playerId)
What error are you seeing in the Test Harness debugger?
Phillip Borm
Hi there,
I've tried various solutions from the forum, but have a question...
I set up "ScriptMessage Extensions" test message. I then put the following in a sendTest message cloud script...
Spark.sendMessageExt({"test" : "test"},
"test",
"1");
where "1" is the username I'm sending it to.
Here is what I have on the receiving end in c#...
void Start () {
// time to hook in the Gamesparks message listener
GameSparks.Api.Messages.ScriptMessage.Listener += GetMessages;
}
public void GetMessages(GameSparks.Api.Messages.ScriptMessage message)
{
if (message.ExtCode == "test")
{
Debug.Log("Got message " + message.Title);
}
}
When I go into the test harness, I log in as another user, then run the logEvent script. Each time I do, it pops up a windows showing the cloud code and telling me it isn't working.
Any ideas?
Hi Phillip,
The 'sendMessageExt' function doesn't take a username as it's third parameter, it needs either a SparkPlayer or an array of SparkPlayers. You can obtain these using the target player's id - var player = Spark.loadPlayer(playerId)
What error are you seeing in the Test Harness debugger?
Regards,
Vinnie
Customer Support
Hi Phillip,
The 'sendMessageExt' function doesn't take a username as it's third parameter, it needs either a SparkPlayer or an array of SparkPlayers. You can obtain these using the target player's id - var player = Spark.loadPlayer(playerId)
What error are you seeing in the Test Harness debugger?
Regards,
Vinnie
-
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