Description[]
This script allows a user to change their pet and mount randomly. Users can also limit the options or exclude certain kinds of pets. The script can either be run manually or automatically using a trigger.
Tips[]
- Set a trigger to change your pet daily during the night, so the morning gives you a new surprise.
- Use multiple triggers to see your pet change automatically throughout the day
- Use the
petLimitandmountLimitvariables and thelimitfunctions to choose what types of pets and mounts you want to randomize. - Use the
petExceptandmountExceptvariables and theexceptfunctions to exclude types of pets you don't want to randomize. This can be helpful in avoiding phobias.
Code[]
You can find the code here: Google Apps Script | GitHub | raw code
Setup Instructions[]
- Click here to go to the Equip Random Pet & Mount script.
- If you're not already logged in to your Google account, you will be asked to sign in.
- If this is your first script, this will automatically create a new Google script for you and open an editor for it. If this is the case, come back here and click the link again to go to the script after logging in.
- In the menu on the left, click on "Overview" (looks like a lowercase letter i inside a circle).
- Click the "Make a copy" button (looks like two pages of paper).
- At the top of your screen, click on "Copy of Equip Random Pet & Mount (Script)." Remove "Copy of" and click "Rename."
- Open your API Settings. Highlight and copy your User ID (it looks something like this:
377a4d3d-c55c-48b8-9bf8-59b97480daf8). In the script, paste your User ID between the quotations on line 7 where it saysconst User_ID = "".)- Delete brackets, but leave the quotation marks
- It should now look something like this:
const User_ID = "377a4d3d-c55c-48b8-9bf8-59b97480daf8".
- On the same page where you copied your User ID, click the "Show API Token" button, and copy your API Token. In the script, paste your API Token between the quotations on line 8 where it says
const API_Token = "".- Delete brackets, but leave the quotation marks
- It should now look something like this:
const API_Token = "377a4d3d-c55c-48b8-9bf8-59b97480daf8".
- Click "Save" (looks like a disk).
- Optional If you're using a
limitorexceptfunction, input your choice of egg, potion, or special types in lines 22-23 or 25-26 by using the format: 'Type1|Type2|Type3'. See the list of options at the end of the script. - Select the function you want to run from the drop-down list to the right of the "Debug" button, near the top of the page. The list will include the following:
- randomPetandMount
- randomPet
- randomMount
- limitedPetandMount
- limitedPet
- limitedMount
- Click "Run" at the top of the screen.
- You may need to grant permission on your Google account to run the script for the first time. If you see a pop-up, click "Review permissions" then select your Google account. Click on "Advanced," then "Go to Equip Random Pets & Mounts (Script) (unsafe)" (Don't worry, it is safe!) Then click "Allow."
- Wait for it to say "Execution completed."
- Return to your Habitica app and refresh or sync the page. You'll see your pet, mount, or both change based on your choice of function!
Setting up a Trigger[]
- Open the script in Google Apps Script.
- Select "Triggers" from the menu on the left side of the screen.
- Select "create a new trigger" and choose from the options.
Contact[]
Please message @benniefolyfe for questions, suggestions, or troubleshooting. I'm happy to help!
Gratitude[]
Thanks to @eyeshield77 for their major code contribution to this script!