question

jonathanjarri avatar image
jonathanjarri asked

Call a scheduled task from a Cloud Script

Hello everyone,

I have an issue I don't know how to handle yet, maybe someone here can help me?

I have a Cloud Script function that creates some content in the PlayerData of a player, and I would like to update this data after X minutes calling another Cloud Script automatically.

What I'm looking for seems similar to scheduled tasks, except that I would like to call it from a Cloud Script.

Do you know how I can do that?

:perplexe:

CloudScriptscheduled tasks
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

·
Sarah Zhang avatar image
Sarah Zhang answered

It seems not the best workaround that calling a scheduled task from a Cloud Script. Firstly, We can’t do the delayed call on Cloud Script. There is a limit of Cloud Script execution time. It’s for 4.5 seconds. You can navigate to [Game Manager]->[Settings]->[Limits] to check it. Cloud Script also can’t use the admin API RunTask. Recurring Scheduled Task is not suitable for such usages too.

A possible workaround of your case is implementing a timer function on the server or client. In most applications, it’s better to implement delayed calls on the server. But if you don’t have a custom server. You can try to do delayed calls to CloudScript on the client. However, if we do it on the client, there is a risk that the user may disconnect accidentally. We should write some verification functions to handle it.

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.