Is there any way to access the player collection in cloud code?
S
Samuel Edwin
started a topic
almost 8 years ago
I can't get it via Spark.runtimeCollection or Spark.metaCollection. What I want to generate guest player's display name using the format guest[some number], like guest4321. The number is generated from the number of players in player collection. Any reason why player collection access is not allowed from cloud code? This seem to complicate things :(
Best Answer
T
Tech Support
said
almost 8 years ago
Hi Sam
I would probably write a script in AuthenticationResponse that checked to see if I needed to update the displayName, and if I did, send a ChangeUserDetails request from within the script.
I would probably write a script in AuthenticationResponse that checked to see if I needed to update the displayName, and if I did, send a ChangeUserDetails request from within the script.
Would this work for you?
Gabriel
S
Samuel Edwin
said
almost 8 years ago
Thank you for your response Gabriel. I've done this already and it's working fine. The real problem for me is getting the next guest number. Assuming the player collection is accessible from cloud code, I'll just get the number of players in collection and assign it as the new guest number. Now since I can't do that, I need a way to generate guest number, and I think I'll do it with SparkCache and or SparkRedis. I have a few questions if you don't mind:
1. What's the difference in storing data between SparkCache and SparkRedis? Which solution would you recommend? All I need is a simple storage for a single number
2. What do I need to do if I want to get a list of players that matches certain criteria?
Tech Support
said
almost 8 years ago
Hi Sam
Another customer used a counter in a mongo collection to get an incrementing number, does this work for you ?
Samuel Edwin
I can't get it via Spark.runtimeCollection or Spark.metaCollection. What I want to generate guest player's display name using the format guest[some number], like guest4321. The number is generated from the number of players in player collection. Any reason why player collection access is not allowed from cloud code? This seem to complicate things :(
Hi Sam
I would probably write a script in AuthenticationResponse that checked to see if I needed to update the displayName, and if I did, send a ChangeUserDetails request from within the script.
Would this work for you?
Gabriel
2 people have this question
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstTech Support
Hi Sam
I would probably write a script in AuthenticationResponse that checked to see if I needed to update the displayName, and if I did, send a ChangeUserDetails request from within the script.
Would this work for you?
Gabriel
Samuel Edwin
Thank you for your response Gabriel. I've done this already and it's working fine. The real problem for me is getting the next guest number. Assuming the player collection is accessible from cloud code, I'll just get the number of players in collection and assign it as the new guest number. Now since I can't do that, I need a way to generate guest number, and I think I'll do it with SparkCache and or SparkRedis. I have a few questions if you don't mind:
1. What's the difference in storing data between SparkCache and SparkRedis? Which solution would you recommend? All I need is a simple storage for a single number
2. What do I need to do if I want to get a list of players that matches certain criteria?
Tech Support
Hi Sam
Another customer used a counter in a mongo collection to get an incrementing number, does this work for you ?
https://support.gamesparks.net/discussions/topics/1000052630
Gabriel
Samuel Edwin
That could work, thanks Gabriel
-
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