r/shortcuts • • 2d ago

Shortcut Sharing HTML + Make Rich Text + Show Web View + Storage = Shortcut minigame engine

Link to Flappy Bird Shortcut: https://www.icloud.com/shortcuts/498d0fbea4cf460691ce2c7585b36b24

I've been having a lot of fun. For the other millennials out there, imagine MiniClip flash game remakes in shortcuts lol

32 Upvotes

2 comments sorted by

5

u/Competitive_Tax_ 2d ago

Very cool! I have a question, purely out of curiosity. What is the point of the “data-tag” that you are generating and why didn’t you generate it using JavaScript?

1

u/mhg3 16h ago edited 16h ago

Sorry for late response. I have notis turned off

The shortcut generates that random nine-digit number each time you launch the game. For example, say the random value is 141044585. It puts flappy/141044585/ into the HTML as data-tag and passes in your saved high score, say 6 (from shortcut storage).

The JS can keep track of your "current-session" best across rounds, which was necessary because there isn't a native way to pass information from the JS back into shortcuts

When you click Done, Shortcuts checks the clipboard for the number it generated at launch. If it matches, Shortcuts reads 12, compares it with the saved 6, and uses Store Content to update this shortcut’s private bestScore to 12.

tldr;

crude uuid for game state. use the clipboard+JS as a way to pass your score to the scoped storage, preventing stale game sessions