TTRS Auto Answer Bot

Auto answers TTRS questions with speed control and toggle menu

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği yüklemek için Tampermonkey gibi bir uzantı yüklemeniz gerekir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

Bu stili yüklemek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için Stylus gibi bir uzantı kurmanız gerekir.

Bu stili yükleyebilmek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı kurmanız gerekir.

Bu stili yükleyebilmek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

(Zateb bir user-style yöneticim var, yükleyeyim!)

Yazar
Amrinder Dhillon
Günlük kurulumlar
6
Toplam kurulumlar
711
Değerlendirmeler
0 1 2
Versiyon
1.1
Oluşturulma
21.08.2025
Güncellenme
21.08.2025
Boyut
5,57 KB
Lisans
N/A
Geçerli

// ==UserScript==
// @name TTRS Auto Answer Bot
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Auto answers TTRS questions with speed control and toggle menu
// @match https://play.ttrockstars.com/*
// @grant none
// ==/UserScript==

(function() {
'use strict';

// --- UI Setup ---

// Create overlay panel
const panel = document.createElement('div');
panel.style.position = 'fixed';
panel.style.top = '10px';
panel.style.right = '10px';
panel.style.background = 'rgba(0,0,0,0.8)';
panel.style.color = 'white';
panel.style.padding = '10px';
panel.style.borderRadius = '8px';
panel.style.fontFamily = 'monospace';
panel.style.zIndex = '999999';
panel.style.width = '180px';
panel.style.userSelect = 'none';
panel.style.cursor = 'move';

// Dragging support
let isDragging = false, dragOffsetX, dragOffsetY;
panel.addEventListener('mousedown', e => {
isDragging = true;
dragOffsetX = e.clientX - panel.getBoundingClientRect().left;
dragOffsetY = e.clientY - panel.getBoundingClientRect().top;
panel.style.cursor = 'grabbing';
});
window.addEventListener('mouseup', () => {
isDragging = false;
panel.style.cursor = 'move';
});
window.addEventListener('mousemove', e => {
if (isDragging) {
panel.style.top = `${e.clientY - dragOffsetY}px`;
panel.style.right = 'auto';
panel.style.left = `${e.clientX - dragOffsetX}px`;
}
});

// Title
const title = document.createElement('div');
title.textContent = 'TTRS Bot Menu';
title.style.fontWeight = 'bold';
title.style.marginBottom = '8px';
panel.appendChild(title);

// Status display
const status = document.createElement('div');
status.textContent = 'Status: OFF';
status.style.marginBottom = '8px';
panel.appendChild(status);

// Toggle button
const toggleBtn = document.createElement('button');
toggleBtn.textContent = 'Start Bot';
toggleBtn.style.width = '100%';
toggleBtn.style.marginBottom = '8px';
panel.appendChild(toggleBtn);

// Speed label and input
const speedLabel = document.createElement('label');
speedLabel.textContent = 'Speed (ms): ';
speedLabel.style.display = 'block';
speedLabel.style.marginBottom = '4px';
panel.appendChild(speedLabel);

const speedInput = document.createElement('input');
speedInput.type = 'number';
speedInput.min = '50';
speedInput.max = '2000';
speedInput.value = '150';
speedInput.style.width = '100%';
panel.appendChild(speedInput);

document.body.appendChild(panel);

// --- Bot Logic ---

let botRunning = false;
let intervalId = null;
let intervalMs = parseInt(speedInput.value);

function getQuestion() {
const leftElem = document.querySelector('span[data-qa-left]');
const opElem = document.querySelector('span[data-qa-operator]');
const rightElem = document.querySelector('span[data-qa-right]');

if (!leftElem || !opElem || !rightElem) return null;

let left = leftElem.textContent.trim();
let op = opElem.textContent.trim();
let right = rightElem.textContent.trim();

if (op === '×') op = '*';
else if (op === '÷') op = '/';

return `${left} ${op} ${right}`;
}

function clickNumberKeys(numberStr) {
for (const char of numberStr) {
if (char === '-') {
console.warn("Negative answer detected, no minus key.");
continue;
}
const key = document.querySelector(`div[aria-label="${char}"]`);
if (key) {
key.click();
} else {
console.warn(`Key for character "${char}" not found.`);
}
}
}

function clickEnter() {
const enterKey = document.querySelector('div.key-ent');
if (enterKey) enterKey.click();
else console.warn("Enter key not found.");
}

function clearInput() {
const deleteKey = document.querySelector('div.keyboard-del');
if (deleteKey) {
for (let i = 0; i < 5; i++) deleteKey.click();
}
}

function botTick() {
const question = getQuestion();
if (!question) return;

try {
const answer = eval(question);
if (answer === null || answer === undefined) return;

clearInput();
clickNumberKeys(String(answer));
clickEnter();

status.textContent = `Status: Running | Last answer: ${answer}`;
} catch (e) {
console.error("Error evaluating question:", e);
status.textContent = "Status: Error evaluating question";
}
}

function startBot() {
if (botRunning) return;
botRunning = true;
status.textContent = "Status: Running";
toggleBtn.textContent = "Stop Bot";
intervalMs = parseInt(speedInput.value) || 150;
intervalId = setInterval(botTick, intervalMs);
}

function stopBot() {
if (!botRunning) return;
botRunning = false;
status.textContent = "Status: OFF";
toggleBtn.textContent = "Start Bot";
clearInterval(intervalId);
intervalId = null;
}

toggleBtn.addEventListener('click', () => {
if (botRunning) stopBot();
else startBot();
});

speedInput.addEventListener('change', () => {
if (botRunning) {
stopBot();
startBot();
}
});

})();