Skip to main content

Twitch Polls Web App

Introduction

The Twitch Polls Web App has been designed to allow Twitch viewers to start predefined polls and vote for specific actions in predefined polls. The outcome of a poll triggers one or more iRacing Live Timing variable value changes. It can be found here: Twitch Polls.

Edit Mode

The application has an Edit mode to build polls and a Run mode for normal operation. Mode can be selected by clicking the Run/Edit button. Settings are automatically saved on exit. If several sets of settings or several simultaneous sessions are required an ?instance=xyz parameter can be added to the URL. For example https://livetiming.sdk-gaming.co.uk/polls.html?instance=settings1 would have different settings than https://livetiming.sdk-gaming.co.uk/polls.html?instance=settings2.

Edit mode user interface:

  • Room name – The room declared in iRacing Live Timing.
  • User name – Represents a user which has been granted access to variables in iRacing Live Timing / F3 Settings / Overlay / Variable Access Credentials. Ensure the user name is entered identically. Set the variable filter to Overlay (to control overlay elements) and/or IRacing (to control cameras and driver selection).
  • Twitch channel – The Twitch channel the application is listening to and is displaying in the Run page.
  • Message timeout – The time after which chat messages vanish.
  • Polls – Text in JSON format describing polls. Each poll has a name and should have the following properties:
    • Actions – A list of actions allowed in the poll. Each action has a name and a commands string holding statements sent to iRacing Live Timing if the poll succeeds.
    • Duration – The time in seconds the poll lasts. Each poll is started as soon as a matching chat message is found. When the poll ends it is waiting for a restart.

Run Mode

In run mode the live Twitch chat is displayed in the upper part of the screen. The lower part displays the current state and results of running polls.

As soon as the Twitch Polls Web App is in run mode it is listening to the chat of the Twitch channel configured in the Edit mode. When a chat message fulfils the following requirements a new poll is started or an existing poll is incremented:

  • Chat message contains 2 words
  • First word is a poll name
  • Second word is an action name of the poll

In our example logo show or logo hide are valid commands that will be interpreted and displayed in the Poll events window. Operating rules of a poll:

  • When a poll is started the corresponding action (second word) point count is set to 1.5
  • When a poll is incremented the corresponding action point count has 1 point added
  • When the timeout time of a poll expires the poll ends. The action with the highest point count has its action commands sent to iRacing Live Timing. Then the poll returns to the inactive state waiting to start again.
  • When a viewer changes his mind 1 point is deducted from the previous action point count and 1 point is added to the new action point count
Was this article helpful?

Related Articles

Leave a Reply

Need Support?

Join our Community Discord Server
Join Discord