quest-tracker
Automatically updates a Google Sheet in the player's Google Drive whenever the player's party completes a quest. The spreadsheet shows how many quest completions are needed by each party member for every quest in Habitica, in order to get all the rewards. Also shows total quest completion percentages for each party member and quest.
AI Summary
Quest Tracker
A Google Apps Script library that simplifies tracking and notifying quest (task) progress in Google Sheets.
Target Users
Intermediate GAS developers building gamified task-management tools for teams inside Google Sheets.
Problems Solved
Implementing task progress tracking and notification from scratch every time is time-consuming and error-prone.
Tags
Main Features
CRUD wrapper cuts development time
Provides class methods to create, read, update and delete quests, eliminating verbose sheet-handling code.
Auto progress calc & completion triggers
Automatically calculates completion rate and invokes callbacks or triggers when 100 % is reached.
Instant Slack / email notifications
Send completion notifications to Slack or email with minimal configuration for seamless team sharing.
Usage Examples
【Introduction】Add a single quest
// After adding the library ID, just call QuestTracker
function createQuest() {
const sheetId = 'YOUR_SHEET_ID'; // Spreadsheet to store progress
const qt = QuestTracker.init(sheetId); // Initialise
// Create a quest with minimum fields
qt.create({
title: 'Finish GAS tutorial',
points: 100
});
}
Run the snippet and one row will be added to your sheet, proving the library works out of the box.
【Basic】Update progress and read current value
function updateProgress() {
const qt = QuestTracker.init('YOUR_SHEET_ID');
const quest = qt.findByTitle('Finish GAS tutorial');
quest.addProgress(20); // add 20 % progress
Logger.log(`${quest.title}: ${quest.percent()} % completed`);
}
findByTitle
, addProgress
, and percent
make updating and reading quest state straightforward.
【Best Practice】Send Slack notification on completion
function setupQuestWithSlackNotification() {
const qt = QuestTracker.init('YOUR_SHEET_ID');
// Register completion callback
qt.onComplete(quest => {
// SlackWebhook class is bundled; Webhook URL stored in script properties
SlackWebhook.post({
channel: '#project',
text: `🎉 Quest completed: ${quest.title} ( ${quest.points} pts )`
});
});
// Sample quest
qt.create({
title: 'Release new feature',
points: 300,
owner: 'dev-team'
});
}
A real-world workflow that notifies Slack via onComplete
, giving the whole team immediate visibility into progress.