Auto Cron[]
by cTheDragons
Run after your Custom Day Start, this script will cron you automatically. Please note, using this method will not allow you to use the Record Yesterday's Activities. Any dailies not ticked off at the time of cronning will be marked as missed.
- Go to script.google.com. If this is your first script, this will automatically create a new Google script for you and open an editor for it. Otherwise, edit an existing project by clicking the pencil icon next to it, or create another.
- Paste the code snippet below into the editor, replacing the spaces marked #HabiticaUserID# and #HabiticaAPIToken# with Habitica User ID and API Token (leave the quotes). These can be found under the API tab in your Habitica settings.
function scheduleCron() { var habId = "#HabiticaUserID#"; var habToken = "#HabiticaAPIToken#"; paramsTemplate = { "method" : "post", "headers" : { "x-api-user" : habId, "x-api-key" : habToken } } var params = paramsTemplate; UrlFetchApp.fetch("https://habitica.com/api/v3/cron", params) }
- Under Edit, select Current project's triggers. Then add a trigger that runs scheduleCron Time-driven on a Day timer with the parameter of the same hour starting with your Custom Day Start. For example, if your Custom Day Start is midnight set your trigger to Midnight to 1am.
- Save and you're done!
If you have cron before the script has run, the script will not do anything. You can use this feature as a catch-all in case you miss your regular time. For example, if your Custom Day Start is set to midnight, you can set this script to run at 3am to 4am. This will allow you cron manually between midnight and 3am, and thus use the Record Yesterday's Activities feature if you have a late night. Otherwise, this script will cron you automatically between 3am and 4am, so your party quest damage occurs before you wake up.