Torn Virus Timer

Display virus coding timer in the sidebar using Torn API v2

Você precisará instalar uma extensão como Tampermonkey, Greasemonkey ou Violentmonkey para instalar este script.

You will need to install an extension such as Tampermonkey to install this script.

Você precisará instalar uma extensão como Tampermonkey ou Violentmonkey para instalar este script.

Você precisará instalar uma extensão como Tampermonkey ou Userscripts para instalar este script.

Você precisará instalar uma extensão como o Tampermonkey para instalar este script.

Você precisará instalar um gerenciador de scripts de usuário para instalar este script.

(Eu já tenho um gerenciador de scripts de usuário, me deixe instalá-lo!)

Você precisará instalar uma extensão como o Stylus para instalar este estilo.

Você precisará instalar uma extensão como o Stylus para instalar este estilo.

Você precisará instalar uma extensão como o Stylus para instalar este estilo.

Você precisará instalar um gerenciador de estilos de usuário para instalar este estilo.

Você precisará instalar um gerenciador de estilos de usuário para instalar este estilo.

Você precisará instalar um gerenciador de estilos de usuário para instalar este estilo.

(Eu já possuo um gerenciador de estilos de usuário, me deixar fazer a instalação!)

Autor
Woeka
Instalações hoje
2
Total de instalações
20
Avaliações
0 0 0
Versão
1.2
Criado
15/01/2026
Atualizado
15/01/2026
Tamanho
14,8 KB
Licença
MIT
Aplicável a

Torn Virus Timer - Documentation

Torn Virus Timer

A Tampermonkey userscript that displays your virus coding timer in the Torn City sidebar. Shows the remaining time until your virus coding is complete, automatically updates, and integrates seamlessly with the Torn Tools sidebar.

Features

  • ✅ Displays virus coding timer in the sidebar
  • ✅ Auto-updates every hour
  • ✅ Smart caching to reduce API calls
  • ✅ Clickable error messages to edit API key
  • ✅ Works with Torn Tools sidebar extension
  • ✅ Clean, minimal display (time only)

Installation


1. Install Tampermonkey

2. Install the Script

Alternatively, you can manually install:

  • Click on the Tampermonkey icon → Dashboard
  • Create a new script
  • Copy the contents of Torn Virus Timer.user.js into the editor
  • Save the script (Ctrl+S or Cmd+S)
  • Ensure the script is enabled

3. Install Torn Tools (Optional but recommended)
  • This script works best with the Torn Tools browser extension
  • Install from your browser's extension store

Setup

Getting Your API Key

  1. Go to Torn City Preferences → API
  2. Generate a Limited API key (not Public - virus data requires limited access)
  3. Copy your 16-character API key

Configuring the Script

  1. When you first load Torn City with the script installed, you'll see "Enter limited key" in the sidebar
  2. Click on it to open the API key popup
  3. Enter your 16-character limited API key
  4. Click "Save"

The script will immediately start fetching your virus status.

Usage

Viewing the Timer

  • The timer appears in the Torn Tools sidebar under "Virus:"
  • Displays remaining time in format: Xd Xh Xm (e.g., "19d 9h 10m")
  • Updates automatically every hour

Editing API Key

Click on any of the following to edit your API key:

  • "Enter limited key" (when no key is set)
  • "No virus" (when no virus is being coded)
  • "Invalid key" (when API key has permission issues)
  • "API error" (when there's an API error)
  • "Network error" (when there's a network issue)

States

The timer can show:

  • Time remaining (e.g., "19d 9h 10m") - When a virus is being coded
  • "No virus" - When no virus is currently being programmed
  • "Enter limited key" - When no API key is configured
  • "Invalid key" - When the API key doesn't have proper permissions
  • "API error" - When there's an API error
  • "Network error" - When there's a network connectivity issue

How It Works

  1. API Integration: Fetches virus data from https://api.torn.com/v2/user/virus using the Torn API v2
  2. Smart Caching: Caches virus information in localStorage to reduce API calls
  3. Auto-refresh: Checks for updates every hour automatically
  4. Immediate Display: Shows cached timer immediately on page load

Technical Details

Storage Keys

  • API Key: virus_api_key (in localStorage)
  • Virus Info: virus_last_info (in localStorage)

API Requirements

  • Endpoint: /v2/user/virus
  • Authentication: Authorization: ApiKey {YOUR_KEY} header
  • Key Type: Limited API key (required for user virus data)
  • Rate Limiting: Checks every hour (3600 seconds)

Troubleshooting

Timer Shows "No virus" but you're coding a virus

  • Check that your API key is set correctly
  • Verify your API key is a Limited key (not Public)
  • Click "No virus" to edit your API key

Timer Shows "Invalid key"

  • Your API key doesn't have permission to access virus data
  • Make sure you're using a Limited API key
  • Go to Torn City Preferences → API and verify your key permissions

Timer Not Appearing

  • Make sure Torn Tools extension is installed
  • Refresh the page
  • Check browser console for errors (F12)

Wrong API Key Being Used

  • Click on the timer display to edit the API key
  • The script clears cache when the key is changed
  • Make sure to save the new key correctly

Privacy

  • Your API key is stored locally in your browser's localStorage
  • No data is sent to any third-party servers
  • All API calls go directly to Torn City's API

License

MIT License

Credits

  • Based on the Torn War Timer script structure
  • Uses Torn City API v2