[Suggestion] Game Option for Timers

Just a quick super simple suggestion, I’d like to be able to have timers that are only active if you are playing a certain game. Should be super simple to implement too.

if (timer.game !== null && timer.game !== channel.game) {
  return
}

sendMessage()

Something along those lines.

1 Like

Hey @mrfigg!

Here’s the solution, put this in your timer’s message:

$(eval g=`$(twitch $(channel) "{{game}}")`; b=[`SPECIFIC_GAME1`,`SPECIFIC_GAME2`];b.includes(g)?`MESSAGE_IF_SPECIFIC_GAME`:` `)

Replace SPECIFIC_GAMES, make sure their syntax is the same as Twitch’s, you can add as many games as you want as long as you don’t exceed 500 characters for the command, just respect the syntax of the code I wrote.
Replace MESSAGE_IF_SPECIFIC_GAME too with your message.

I believe this would cause nightbot to send empty messages to chat if you are not on the correct game, right? Or does nightbot attempting to send a single space (" ") in chat get automatically suppressed?

Empty messages don’t appear in chat, I use this technique all the time, it works great!

Cool, that’s good to know. Thanks!

So I’ve tried to implement your solution:

$(eval g=`$(twitch $(channel) "{{game}}")`;g.includes(`Jackbox`)?`Want to play Jackbox with us? Subscribe and head over to our discord to get the room code! Then visit https://jackbox.tv/ on your web browser of choice to join!`:` `)

And I’m getting an error I can’t quite make sense of:

[variable not permitted in timers]

That test was run when the game was set to Just Chatting. Any ideas? Thanks in advance.

Edit:
Further testing seems to indicate $(eval) isn’t allowed in timers now… This gives the same error message:

$(eval g='Test';g)

Yeah… Sorry about that.
I encountered this issue some time ago as well, and the dev thought he fixed it.
@night any information?

I’m not sure why it was not permitted in timers, but I’ve enabled it.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.