Skip to content

Getting Started

dromse edited this page Aug 31, 2024 · 14 revisions

Welcome to Gamified Tasks, Honor User!
With this plugin, you can efficiently manage your tasks using a variety of craft tags. Let's dive in and explore how you can enhance your productivity by implementing the simplicity of markdown tasks and rewards system provided by the plugin.

Task Tracking

How to create task?

Just create a task in any note of your vault, like in example below:

- [ ] markdown task

Available Craft Tags

In the plugin, use #tags to craft your tasks. Here's what you can use:

  • Counter: #count/current/goal (e.g., #count/3 | #count/1/4)
  • Recurrence: #every/recurrence (e.g., #every/day | #every/week)
  • Difficulty: #diff/difficulty (e.g., #diff/trivial | #diff/easy | #diff/medium | #diff/hard)
  • Binding: #bind/property (e.g., #bind/coding | #bind/pushUps)

CompletedAt

To indicate the completed date, a link to a daily note is used:

  • WikiLink: ✅ [[2024-03-13|2024-03-13 | 21:46]]
  • Markdown Link: ✅ [2024-03-13 | 21:46](Everyday/2024-03-13.md)

Statuses

You can use the following statuses:

  • - [ ] todo - planned for execution.
  • - [/] doing - currently in progress.
  • - [x] done - completed.
  • - [-] denied - not of interest or other reasons.
  • - [?] delay - in progress but paused, under review, or delegated.
# Uncompleted task

- [ ] watch video about optimization #diff/easy

# Task in progress

- [/] watch video about optimization #diff/easy

# Completed task

- [x] watch video about optimization #diff/easy ✅ [[2024-03-13|2024-03-13 | 21:46]]

Difficulty

By default, difficulty earnings are as follows:

  • Trivial - 0.1
  • Easy - 1
  • Medium - 2.5
  • Hard - 5

Counters

You can use counters for common and recurring tasks. If a counter has a goal and it reaches it, the task automatically becomes done.

With #bind

You can bind your counter to frontmatter property in daily note.

Note

When you click the counter on the next day, it starts counting fresh numbers.

  • Previous day: #count/3 + #bind/coding = coding: 3
  • Next day: #count/5 + #bind/coding = coding: 2

With #diff

If a task has #diff and #count, with every counter increase you earn coins based on the difficulty level.

Note

If you click to decrease the counter, it will take coins back.

<!-- Difficulty usage -->

- [/] challange code everyday for 4 hours! #count/3/4 #diff/hard

<!-- In history file -->

5 | challange code everyday for 4 hours! | 2024-03-13 21:46
5 | challange code everyday for 4 hours! | 2024-03-13 21:46
5 | challange code everyday for 4 hours! | 2024-03-13 21:46

<!-- If you click decrease one time -->

-5 | challange code everyday for 4 hours! | 2024-03-13 21:50
5 | challange code everyday for 4 hours! | 2024-03-13 21:46
5 | challange code everyday for 4 hours! | 2024-03-13 21:46
5 | challange code everyday for 4 hours! | 2024-03-13 21:46

With #every

In recurring tasks when you reach goal and the day to show it arrives, the counter resets to zero.

<!-- You're clicking on increase counter in UI -->

- [/] challange code everyday for 4 hours! #count/3/4 #every/day #diff/hard

<!-- It saves to history -->

5 | challange code everyday for 4 hours! | 2024-03-13 21:46
5 | challange code everyday for 4 hours! | 2024-03-13 21:46
5 | challange code everyday for 4 hours! | 2024-03-13 21:46

<!-- Or without #diff -->

0 | challange code everyday for 4 hours! | 2024-03-13 21:46
0 | challange code everyday for 4 hours! | 2024-03-13 21:46
0 | challange code everyday for 4 hours! | 2024-03-13 21:46

<!-- When you reach counter goal, counter set to completed -->

- [x] challange code everyday for 4 hours! #count/4/4 #every/day #diff/hard

<!-- Task resets to zeros and appears in UI when its time arrives -->

- [ ] challange code everyday for 4 hours! #count/0/4 #every/day #diff/hard

Recurrence

For recurrence, you need to use the #every tag. A recurring task appears again based on the history file. Here is a list of recurrence durations (instead of 1, you can use another number):

  • Daily - day, 1day, 2day, etc.
  • Weekly - week, 1week, 2week, etc.

If a task doesn't have the #diff tag in its history, it is saved with a 0 balance change.

<!-- Create recurring task -->

- [ ] coding for 4 hours #every/day

<!-- Set in progress -->

- [/] coding for 4 hours #every/day

<!-- Complete task -->

- [x] coding for 4 hours #every/day

<!-- It saves in history and resets when the time arrives -->

- [ ] coding for 4 hours #every/day

How Does It Work?

  • You create a task with the #every tag; it shows in the UI.
  • You complete your recurring task.
  • The task body is saved to history.
  • The task counter resets to zero and appear again when its time arrives.

Rewards

  • You need to create a rewards file to add rewards.
  • You can buy rewards with earned coins.
  • By default, the rewards file is rewards.md, but you can change it in the settings.
  • You need to define your rewards in the rewards file.
  • The format of a reward row is reward name | price | description in the rewards file.
  • If you want to add a comment, use the | symbol, e.g., | my favorite rewards.
  • Frontmatter are ignored.

Note

Markdown comments <!-- comment --> don't work in the rewards file.

| shows `📺️ watch an episode` for 1 coin
📺️ watch an episode

| shows `🍦 Ice cream` for 10 coins
🍦 Ice cream | 10

| shows `🍬 candy` with desc `earn and eat it.` for 1 coin
🍬 candy | earn and eat it.

| shows `🌴 relax one day` with desc `you work hard you deserve it.` for 1500 coins
🌴 relax one day | 1500 | you worked hard you deserve it.

Here's a corrected version:

History

  • The history file stores all your earnings and spendings.
  • A task is considered to be written to history only if it has #diff or #every.
  • By default, the history file is history.md, but you can change this in the settings.
  • By default, you don't need to do anything with this file. However, if you want to correct some data or cheat sometimes, you're welcome... cheater *bruh*.
  • The format of a history row is: balance change | task body | date

It saves to history only if:

  • The task has #diff.
  • The task has #every.
  • A reward is given.

Conditions (1.5+)

To empower users with more flexibility in filtering and displaying tasks based on their own criteria, our team (consisting of just one member) has introduced a new feature called Conditions using #if tag.

Where are conditions stored?

By default, the plugin scans the Conditions/ folder for available JavaScript files that define these conditions.
However, you can customize this behavior. If you'd prefer to keep your condition scripts in a more discreet location, such as .scripts/, or even directly in the root directory /, you can easily change the default folder in the plugin settings.

How to create conditions?

To create a condition, add a JavaScript file that defines your custom logic. For instance, you could write a script that returns true or false depending on the specific day of the week:

// weekday.jsconst weekday = (arg) => {
    const dayOfWeek = new Date().toLocaleDateString('en-US', { weekday: 'long' }).toLowerCase()if(dayOfWeek === arg) {
        return true;
    }

    return false;
}

export default weekday

Or filter by date range:

// range.js
export default (arg) => {
    const dayOfMonth = new Date().getDate()
    
    const rangeDays = arg.split('-').map(day=>Number(day))

    if(dayOfMonth >= rangeDays[0]  && dayOfMonth <= rangeDays[1]) {
        return true;
    }

    return false;
}

How to use conditions?

Using conditions is straightforward. Simply add a tag with your desired condition to a task in the main editor or within the plugin.
Here are some examples:

- [ ] shows task on every friday #if/weekday/friday
- [ ] show task from 15 to 30 day of month #if/range/15-30

image

Also you can leverage conditions without using argument parameter for example:

- [ ] go hiking #if/good-weather

And the code for condition using fetch API to get current weather from Open-Meteo:

// good-weather.js
export default async function() {
  try {
    const response = await fetch(
      "https://api.open-meteo.com/v1/forecast?latitude=50.45&longitude=30.52&current_weather=true",
    );

    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }

    const data = await response.json();
    const temperature = data.current_weather.temperature;
    const windSpeed = data.current_weather.windspeed;
    const weatherCode = data.current_weather.weathercode;

    if (temperature > 30 || weatherCode >= 80 || windSpeed > 10) {
      return false; // Not good
    }

    return true; // good
  } catch (error) {
    console.error("Error fetching weather data:", error);
    return false;
  }
}

How to show conditions

Once you've added conditions to your tasks, enable the filter in the plugin's UI:

  • Check the "Filter by condition" radio button.
  • Tasks that meet the specified conditions will appear in the Plugin UI. For example, tasks for a Friday and the 30th day of the month will be displayed accordingly like below.

image

Ideas to move forward

With the power of JavaScript and web APIs, you can now create your own conditions to dynamically filter and display tasks based on various factors. Here are some ideas to get you started:

  • Weather-Based Tasks: Fetch weather data using APIs like Open-Meteo to show tasks only when the weather is suitable. For example, display outdoor activities only if the weather is good.

  • Date and Time Conditions: Display tasks based on specific dates, times, or ranges. You can show tasks that are relevant after a certain date/time or within a specified time frame.

  • Location-Based Tasks: Use geolocation APIs to fetch the user's current location and show tasks that are relevant to that location, such as nearby errands or location-specific reminders.

  • Calendar Integration: Integrate with calendar APIs to display tasks related to upcoming events, deadlines, or appointments automatically.

  • Custom Reminders: Utilize the Notifications API to send reminders for tasks at specific times or under certain conditions, such as when the weather changes or an event is approaching.

  • Device and Network Conditions: Tailor task visibility based on the user’s device, battery status, or network connection. For example, show tasks that require a strong internet connection only when the user is online.

Clone this wiki locally