question

usachovdailymagic avatar image
usachovdailymagic asked

Is there any global variable in cloudscript like to get TitleId

I would like to access my titleId("XXXX") from cloudscript as simple variable like currentPlayrId. Is it possible?

10 |1200

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

brendan avatar image
brendan answered

No, this is the first time this has ever come up, so there's no TitleId define in Cloud Script. What exactly is the usage case? What are you attempting to do that requires a dynamic reference to the Title ID?

2 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.

usachovdailymagic avatar image usachovdailymagic commented ·

ok)) It is not necessary. Just wanted to use it to call AdminApi from cloudscript.

0 Likes 0 ·
brendan avatar image brendan usachovdailymagic commented ·

The Admin API is not available to Cloud Script specifically because no Admin API call should ever be triggered due to a player action. We'll be updating in future to differentiate between player-based Cloud Script execution (from a Client API call, a PlayStream Rule, or a Scheduled Task for a Segment), and title-based (a Scheduled Task for the title, rather than a Segment). Once that's in place, we'll be allowing title-based Cloud Script handlers access to the Admin API.

0 Likes 0 ·
matthewregul avatar image
matthewregul answered

For anyone landing here via search, we now have a global CloudScript object that contains the current Title ID.

script.titleId  // Represents the ID for the current title.
script Global object that contains Revision and titleId. Revision represents the Revision Number for the currently executing CloudScript, and titleId represents the ID for the current title.

Read more about our global CloudScript objects and variables here

10 |1200

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

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.