I'm building a fun Twitch chat mini-game called Hot Potato to keep my community engaged during streams. The concept is simple: viewers toss a virtual hot potato to one another using chat commands. If they hold onto it too long, it explodes. The game works almost how I want it to—but I'm having trouble implementing a critical feature: a 10-second timer that causes the hot potato to explode if not tossed in time.
The Goal:
A player starts the game using !hotpotato to toss it to someone.
That player then has 10 seconds to use !toss to pass it on, or the potato explodes in their hands.
There’s also a 20% chance the potato explodes instantly upon using !toss—this part is working well and adds excitement.
If it explodes (either by chance or delay), a message should display:
“💥 The hot potato EXPLODED in @(chatter)'s hands! Use !hotpotato to start again.”
Current Implementation:
These are the two commands I currently use:
!hotpotato:@(me) tosses the HOT POTATO to @(chatter)! Use !toss someone before it explodes!
!toss:@(me) tosses the hot potato to @(chatter)! Hurry, or it'll explode!...
And this is the eval command ChatGPT gave me for the explosion chance logic:
$(eval u="$(user)";t="$(touser)";e="🥔";t==""||t.toLowerCase()==u.toLowerCase() ? e+" You can't toss it to yourself, @"+u+"!" : Math.random()<0.2 ? "💥 The hot potato EXPLODED in @"+u+"'s hands! RIP." : e+" @"+u+" tosses the hot potato to @"+t+"! Hurry, or it'll explode!")
What Works:
The 20% chance explosion on toss is working great—thanks to this script.
What Doesn’t Work:
There’s no actual 10-second timer. If someone receives the hot potato and does nothing, the game just stalls.
The game doesn’t remember who currently holds the hot potato.