I want To gift a object every hour only when player is connected. I try different solution and nothing work complete, right know I try to get the last time user is connected but I need the Server Time to do that and I dont know how to get it ( by the way, use client time is bad).
Thanks for the help
Best Answer
A
Ayyappa R
said
almost 8 years ago
I tried this earlier, this might help you get started on this.
I see you can do your requirement in 2 ways.
1. Create a system script for "Every Hour" and check if the player is online by fetching data from SparkPlayer info.
- I'm not sure whats the issue you faced in this as no complete info from your question.
2. You can use Date class of Javascript. I found this class in w3Schools and tried it in cloud code, its working fine.
var timeInEpoch = Date.now();
Spark.getLog().debug("Now : " + timeInEpoch);
Adding to these, I found ${now} and some more fields defined by GS and are handy to use in configurator (when setting attributes for Events). More info at the end of this page Default Time Expressions Supported
I wish you find success in first approach as it should work the way you think and its the right place as well to do these tasks. Let me know if I can help you more on this.
You can see example in this link: https://docs.gamesparks.net/howtos/cloud-code-scripting/how-to-schedule-cloud-code-scripts
A
Ayyappa R
said
almost 8 years ago
Answer
I tried this earlier, this might help you get started on this.
I see you can do your requirement in 2 ways.
1. Create a system script for "Every Hour" and check if the player is online by fetching data from SparkPlayer info.
- I'm not sure whats the issue you faced in this as no complete info from your question.
2. You can use Date class of Javascript. I found this class in w3Schools and tried it in cloud code, its working fine.
var timeInEpoch = Date.now();
Spark.getLog().debug("Now : " + timeInEpoch);
Adding to these, I found ${now} and some more fields defined by GS and are handy to use in configurator (when setting attributes for Events). More info at the end of this page Default Time Expressions Supported
I wish you find success in first approach as it should work the way you think and its the right place as well to do these tasks. Let me know if I can help you more on this.
L
Luis Vieira
said
almost 8 years ago
Thank to all,
Is a combination of the GS Scheduler and Date.now().
Luis Vieira
Hi GameSpark,
I want To gift a object every hour only when player is connected. I try different solution and nothing work complete, right know I try to get the last time user is connected but I need the Server Time to do that and I dont know how to get it ( by the way, use client time is bad).
Thanks for the help
I tried this earlier, this might help you get started on this.
I see you can do your requirement in 2 ways.
1. Create a system script for "Every Hour" and check if the player is online by fetching data from SparkPlayer info.
- I'm not sure whats the issue you faced in this as no complete info from your question.
2. You can use Date class of Javascript. I found this class in w3Schools and tried it in cloud code, its working fine.
Adding to these, I found ${now} and some more fields defined by GS and are handy to use in configurator (when setting attributes for Events). More info at the end of this page Default Time Expressions Supported
I wish you find success in first approach as it should work the way you think and its the right place as well to do these tasks. Let me know if I can help you more on this.
- Oldest First
- Popular
- Newest First
Sorted by Oldest Firstrd tech
You can use Scheduler in GS.
You can see example in this link: https://docs.gamesparks.net/howtos/cloud-code-scripting/how-to-schedule-cloud-code-scripts
Ayyappa R
I tried this earlier, this might help you get started on this.
I see you can do your requirement in 2 ways.
1. Create a system script for "Every Hour" and check if the player is online by fetching data from SparkPlayer info.
- I'm not sure whats the issue you faced in this as no complete info from your question.
2. You can use Date class of Javascript. I found this class in w3Schools and tried it in cloud code, its working fine.
Adding to these, I found ${now} and some more fields defined by GS and are handy to use in configurator (when setting attributes for Events). More info at the end of this page Default Time Expressions Supported
I wish you find success in first approach as it should work the way you think and its the right place as well to do these tasks. Let me know if I can help you more on this.
Luis Vieira
Thank to all,
Is a combination of the GS Scheduler and Date.now().
I think will be work :)
Luis Vieira
It work Thanks to all
-
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