question

capricornum avatar image
capricornum asked

Can I access a list using CloudScript

Dear Community,

In my online game players are drawing from a shared deck of 24 cards.

Is it possible to save a list of ints (card ID's) somewhere within my PlayFab title, access that list using a CloudScript function and within that function remove the drawn card ID from the list? So that the next player calling the CloudScript function will draw from the modified list?

I hope I am making myself clear.

Thank you for your help.

CloudScriptTitle Data
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

That would depend on how many players you have using that data. If you mean a relatively small group of players, then yes, a Group Entity Object would be the best storage to use. If you mean a very large group, then no, you would need to use an external data source (an in-memory data system, like Redis, would work for that).

5 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

capricornum avatar image capricornum commented ·

Thank you Brendan, that's very helpful. Yes indeed I am talking about a small group of players.

So if I understand correctly a Group Entity Object stores data as a JSON. So would I then need a JSON converter within my CloudScript to read and write to that Group Entity Object?

0 Likes 0 ·
brendan avatar image brendan capricornum commented ·

Depending on how you're using it, you may need to convert between JSON and an Object, yes. If you mean the legacy Cloud Script service, you can use the normal JavaScript JSON.parse() and JSON.stringify().

1 Like 1 ·
capricornum avatar image capricornum brendan commented ·

Thank you. I didn't know about those JavaScript Options.

So, (I'm sorry for being so new to all of this): There is a new CloudScript, that does not allow these JavaScript methods?

Are you by any chance talking about the Azure Functions, where I can use any language?

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.