Launch Quests With Link

== Summary ==
The Launch Quests With Link script generates a URL (link) that, when clicked/followed, displays the user’s quest inventory and allows a chosen quest to be launched by pasting a code into the browser address bar. The main link can be shared with some or all party members to allow them to launch your quests while you’re not available. The script, and the sharing of the link, is safe and does not give the party access to your account. It only allows quests to be launched from your inventory, and only to the party that you're a member of.
This script may also be used in conjunction with the Quest Queue script. Quest Queue can be installed by one member of the party (usually the party leader) in order to automatically launch (upon completion of quests) the next quest in a spreadsheet queue from the inventory of any member who has the Launch Quests With Link script (version 3 or higher) installed.
== Usage Instructions ==
Follow the installation instructions below and share the 2nd URL generated with party members to allow them to launch your quests. When they follow the URL, party members will see instructions in their browser window to launch a specific quest from your inventory using the displayed activation URL and quest code. Using the activation URL again before the quest has started will cancel the first and launch the newly chosen one. Once everyone's joined and the quest has started, the activation URL won't do anything.
When the activation link is successfully used, the browser will display a page: “Command to launch the quest X has been sent." If the code entered is incorrect, or a code is entered for an unavailable quest, the browser will display a page: “The quest X is not in the user’s inventory. Click the back button to try again.”
This version of the script requires two deployments. Be sure to follow all of the installation instructions below.
IMPORTANT NOTE: Google Apps Script has a limitation: The links will only work when there is ONE and ONLY ONE Google account signed in to the browser. Rather than logging out of all Google accounts, it's much easier to just open an unused browser, or an incognito (Chrome), private (Firefox), or inPrivate (Internet Explorer) window, log in to one Google account, and paste the link there.
== Installation ==
You need to use a desktop computer for this. It will not work on a phone or tablet!
# Click here to go to the Launch Quests With Link script. If you're not already signed into your Google account, you will be asked to sign in. If your browser is signed in to multiple Google Accounts, the page may not load. In this case, use another browser, or a private browsing window.
# In the main 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 Launch Quests With Link". Rename it "Launch Quests With Link" and click the "Rename" button.
# Click here to open your API Settings. Highlight and copy your User ID (it looks something like this: 35c3fb6f-fb98-4bc3-b57a-ac01137d0847). In the Launch Quests With Link script, paste your User ID between the quotations where it says const USER_ID = "";. It should now look something like this: const USER_ID = "35c3fb6f-fb98-4bc3-b57a-ac01137d0847";
# On the same page where you copied your User ID, click the "Show API Token" button, and copy your API Token. In the Launch Quests With Link script, paste your API Token between the quotations where it says const API_TOKEN = "";. It should now look something like this: const API_TOKEN = "35c3fb6f-fb98-4bc3-b57a-ac01137d0847";
#Click the "save" button (floppy disk icon) in the toolbar.
#Click the blue "Deploy" button near the top of the page, then click "New deployment". Under "Description", type "Initial Deployment" (without the quotes). Then click the "Deploy" button.
#Click the "Authorize access" button and select your Google account. Click on "Advanced", then "Go to Launch Quests With Link (unsafe)". (Don't worry, it is safe!) Then click the "Allow" button.
#Under "Web app", click the "Copy" button to copy the Web App URL. Then click the "Done" button.
#Paste your Web App URL inside the quotations where it says const WEB_APP_URL = "";
#(Again) click the "save" button (floppy disk icon) in the toolbar.
#(Again) click the blue "Deploy" button near the top of the page, then click "New deployment". Under "Description", type "Final Deployment" (without the quotes). Then click the "Deploy" button. If you correctly authorized the script access in the previous deployment, you shouldn’t be asked to authorize again.
#Under "Web app", click the "Copy" button to copy the Web App URL. This is the URL to share with party members. Paste it somewhere to save it. click the "Done" button.
#The party leader can now update the party's description to include a link to launch your quests. Be sure to include the IMPORTANT NOTE from the usage instructions (above) regarding being logged in to one and only one Google account in the browser being used to launch quests. Congratulations, you're done!
== Lost your link? ==
If you lose your Web App URL, follow these instructions to find it again:
# Click on the blue "Deploy" button.
# In the dropdown that appears, click "Manage deployments".
# In the window that pops up, below "Web app URL," click the "copy" button to copy it to your clipboard.
# Click cancel to close the window.
== Contact ==
If you have questions, or to report a bug contact Snefferdy on habitica.
Category:Extensions, Add-Ons, and Customizations