Tasker and automating a video game tracker
I did something fun today. Under the category of "because I can", I'm currently setting up a tracker for a Franchise Mode in MLB The Show 241. I used to write fictional team write-ups back in the day when I had fewer cares, and I thought it might be fun to do it again to give myself some extra incentive to play through a few seasons.
I'm setting all of this up in Obsidian, mostly because I might put this up as a website (at least as a database to refer to in some way) later, so being able to put it together as markdown is handy. I think most people use spreadsheets for this but that's not the way I wanted to go.
I initially set up some data with 9 games from a previous franchise which helped inform me of how I want to put together the information. In short, the vault is organized with a "dashboard" that links to the most recent game I played; weekly recaps; and some basic player and team statistics. The weekly recaps link to individual game logs, which are the backbone of the whole system. One day I'll lay it out in more detail.
Anyway - creating a game log is incredibly tedious, especially since I'm doing it primarily on mobile. I looked around at some solutions and one of the more recommended options is using Templater, but it doesn't seem to work well on mobile. But...since Obsidian is a file folder system...I could use Tasker!
It's actually a rather simple task. I have a series of Input Dialog
actions that prompt me for things like game number, date, score, player of the game, etc. Once all the variables are collected2, I used a Write File
action with a template written up in markdown with the variables. The file name itself is dynamic based on variables:
Obsidian/MLBTheShow/Game Logs/G%game_num %game_date Blue Jays %vstype %opponent.md
The file is saved successfully and shows up in my vault!
Here's the full Tasker task:
Task: MLB Game Log
A1: Input Dialog [
Title: Week Number
Close After (Seconds): 30
Input Type: 2
Output Variable Name: %week_num ]
A2: Input Dialog [
Title: Game Number
Close After (Seconds): 30
Input Type: 2
Output Variable Name: %game_num ]
A3: Input Dialog [
Title: Game Date
Text: YYYY-MM-DD
Close After (Seconds): 30
Output Variable Name: %game_date ]
A4: Input Dialog [
Title: Your Score
Close After (Seconds): 30
Output Variable Name: %your_score ]
A5: Input Dialog [
Title: Vs or At
Close After (Seconds): 30
Output Variable Name: %vstype ]
A6: Input Dialog [
Title: Opponent
Close After (Seconds): 30
Output Variable Name: %opponent ]
A7: Input Dialog [
Title: Opponent Score
Close After (Seconds): 30
Input Type: 2
Output Variable Name: %opp_score ]
A8: Input Dialog [
Title: Record
Close After (Seconds): 30
Output Variable Name: %team_record ]
A9: Input Dialog [
Title: Winning Pitcher
Text: Pitcher Name (Record)
Close After (Seconds): 30
Output Variable Name: %win_pitcher ]
A10: Input Dialog [
Title: Losing Pitcher
Text: Pitcher Name (Record)
Close After (Seconds): 30
Output Variable Name: %loss_pitcher ]
A11: Input Dialog [
Title: Save
Text: Pitcher Name (Record)
Close After (Seconds): 30
Output Variable Name: %save_pitcher ]
A12: Input Dialog [
Title: Player of the game
Close After (Seconds): 30
Output Variable Name: %potg ]
A13: Input Dialog [
Title: Player of the game stats
Close After (Seconds): 30
Output Variable Name: %potg_stats ]
A14: Input Dialog [
Title: Notable Player 1
Text: Player Name - stats
Close After (Seconds): 30
Input Type: 81
Output Variable Name: %notable_1 ]
A15: Input Dialog [
Title: Notable Player 2
Text: Player Name - stats
Close After (Seconds): 30
Input Type: 81
Output Variable Name: %notable_2 ]
A16: Input Dialog [
Title: Notable Player 3
Text: Player Name - stats
Close After (Seconds): 30
Input Type: 81
Output Variable Name: %notable_3 ]
A17: Write File [
File: Obsidian/MLBTheShow/Game Logs/G%game_num %game_date Blue Jays %vstype %opponent.md
Text: ##### Result:: Blue Jays %your_score %vstype %opponent %opp_score
**Record:** %team_record
Game:: %game_num
Date:: %game_date
## Player of the Game
- Player:: %potg
- Line:: %potg_stats
## Pitching
- **W:** %win_pitcher
- **L:** %loss_pitcher
- **S:** %save_pitcher
## Notable Performances
- %notable_1
- %notable_2
- %notable_3
---
[[2024 Week %week_num]]
Add Newline: On ]
Potential output would look like:
Result:: Blue Jays 5 at Rays 4
Record: 1-0
Game:: 01
Date:: 2024-03-28
...and so on.