// ==UserScript== // @name TypingGhost v6 - Badge Farmer & Stealth // @namespace…
- User
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
// ==UserScript== // @name TypingGhost v6 - Badge Farmer & Stealth // @namespace https://chat.openai.com/ // @version 6.0 // @description Fully automated TypingClub mod with stealth, badge farming & KaHack-inspired UI // @author GhostDev // @match https://www.typingclub.com/* // @grant none // ==/UserScript==
(function () { 'use strict';
const html = <div id="ghost-header">TypingGhost v6</div> <div class="ghost-section"> <label>Target WPM: <input id="ghost-wpm" type="number" value="60" /></label> <label>Max Lessons: <input id="ghost-maxlessons" type="number" value="10" /></label> </div> <div class="ghost-section"> <label class="ghost-switch"><input type="checkbox" id="ghost-retry"> Retry on Fail</label> <label class="ghost-switch"><input type="checkbox" id="ghost-mistakes"> Simulate Mistakes</label> <label class="ghost-switch"><input type="checkbox" id="ghost-stealth"> Stealth Mode</label> </div> <div class="ghost-section"> <button id="ghost-start">▶ Start Farming</button> <button id="ghost-stop">⏹ Stop</button> </div> <div id="ghost-status">Idle</div> ;
const css = #ghost-container { position: fixed; top: 80px; left: 80px; width: 280px; font-family: Arial, sans-serif; background: #1c1c1c; color: #fff; border-radius: 10px; box-shadow: 0 0 20px #00000088; z-index: 999999; padding: 10px; user-select: none; } #ghost-header { font-size: 18px; background: #4b0082; padding: 10px; border-radius: 8px 8px 0 0; cursor: move; text-align: center; font-weight: bold; } .ghost-section { margin: 10px 0; } #ghost-container input[type=number] { width: 100%; padding: 4px; border: none; border-radius: 5px; font-size: 14px; } .ghost-switch { display: block; margin: 6px 0; font-size: 14px; } #ghost-container button { width: 48%; margin: 2px 1%; padding: 6px; background: #28a745; color: white; border: none; border-radius: 5px; font-size: 14px; cursor: pointer; } #ghost-container button:hover { background: #218838; } #ghost-status { margin-top: 8px; text-align: center; font-size: 13px; color: #ccc; } ;
const style = document.createElement('style'); style.textContent = css; document.head.appendChild(style);
const box = document.createElement('div'); box.id = 'ghost-container'; box.innerHTML = html; document.body.appendChild(box);
// Draggable UI
let offsetX, offsetY, dragging = false;
const header = document.getElementById('ghost-header');
header.addEventListener('mousedown', (e) => {
dragging = true;
offsetX = e.clientX - box.getBoundingClientRect().left;
offsetY = e.clientY - box.getBoundingClientRect().top;
});
document.addEventListener('mousemove', (e) => {
if (dragging) {
box.style.left = ${e.clientX - offsetX}px;
box.style.top = ${e.clientY - offsetY}px;
}
});
document.addEventListener('mouseup', () => dragging = false);
// Core logic let isRunning = false; let hidden = false; let lessonCount = 0;
function setStatus(msg) { document.getElementById('ghost-status').textContent = msg; }
function getCharacters() { const els = Array.from(document.querySelectorAll('.token span.token_unit')); return els.map(el => { if (el.firstChild?.classList.contains('_enter')) return '\n'; let char = el.textContent?.[0] || ''; return keyOverrides[char] || char; }); }
function recordKey(c) { window.core?.record_keydown_time(c); }
function sleep(ms) { return new Promise(res => setTimeout(res, ms)); }
async function autoType(chars, wpm, simulateMistakes) { const delay = 12000 / (wpm * 5); for (let c of chars) { if (!isRunning) return; if (simulateMistakes && Math.random() < 0.02 && c !== ' ' && c !== '\n') { recordKey('x'); recordKey('\b'); await sleep(100); } recordKey(c); await sleep(delay * (0.9 + Math.random() * 0.2)); } }
async function waitForEnd() { while (isRunning && !document.querySelector('.continue-button')) { await sleep(1000); } }
async function clickContinue() { const btn = document.querySelector('.continue-button'); if (btn) btn.click(); await sleep(2000); }
async function runLessons() { const maxLessons = +document.getElementById('ghost-maxlessons').value; const wpm = +document.getElementById('ghost-wpm').value; const retry = document.getElementById('ghost-retry').checked; const simulate = document.getElementById('ghost-mistakes').checked;
lessonCount = 0;
while (isRunning && lessonCount < maxLessons) {
lessonCount++;
setStatus(`Typing lesson ${lessonCount}...`);
const chars = getCharacters();
await autoType(chars, wpm, simulate);
await waitForEnd();
await clickContinue();
}
setStatus("✅ Finished.");
isRunning = false;
}
document.getElementById('ghost-start').onclick = () => { if (!isRunning) { isRunning = true; runLessons(); } };
document.getElementById('ghost-stop').onclick = () => { isRunning = false; setStatus("⏹ Stopped."); };
// Stealth toggle: Ctrl + Backspace document.addEventListener('keydown', (e) => { if (e.ctrlKey && e.key === 'Backspace') { hidden = !hidden; box.style.display = hidden ? 'none' : 'block'; isRunning = !hidden; setStatus(hidden ? "⏳ Paused" : "🟢 Resumed"); } }); })(); im trying to build a auto typing and lesson can you fix this and make it better
This is an excellent starting point! The UI and basic structure are well-designed. The main issues in your current script are:
keyOverrides is undefined: You declare keyOverrides in the getCharacters function, but it's not defined anywhere, leading to an error.window.core?.record_keydown_time(c): TypingClub usually uses a different global object for key events, typically TYPING_TEST_HELPER.onKeyDown. Relying on window.core might be outdated or incorrect for your version of TypingClub. We need to simulate a proper keyboard event.isRunning = !hidden on toggle will stop/resume the loop, but the status message could be clearer.Let's fix these issues and make it more robust.
Here's the improved and corrected UserScript:
// ==UserScript==
// @name TypingGhost v6 - Badge Farmer & Stealth
// @namespace https://chat.openai.com/
// @version 6.1
// @description Fully automated TypingClub mod with stealth, badge farming & KaHack-inspired UI
// @author GhostDev
// @match https://www.typingclub.com/*
// @grant none
// ==/UserScript==
(function () {
'use strict';
const html = `
<div id="ghost-header">TypingGhost v6</div>
<div class="ghost-section">
<label>Target WPM: <input id="ghost-wpm" type="number" value="60" min="10" max="200"></label>
<label>Max Lessons: <input id="ghost-maxlessons" type="number" value="10" min="1"></label>
</div>
<div class="ghost-section">
<label class="ghost-switch"><input type="checkbox" id="ghost-retry"> Retry on Fail</label>
<label class="ghost-switch"><input type="checkbox" id="ghost-mistakes"> Simulate Mistakes</label>
<label class="ghost-switch"><input type="checkbox" id="ghost-stealth"> Stealth Mode</label>
</div>
<div class="ghost-section">
<button id="ghost-start">▶ Start Farming</button>
<button id="ghost-stop">⏹ Stop</button>
</div>
<div id="ghost-status">Idle</div>
`;
const css = `
#ghost-container {
position: fixed;
top: 80px;
left: 80px;
width: 280px;
font-family: Arial, sans-serif;
background: #1c1c1c;
color: #fff;
border-radius: 10px;
box-shadow: 0 0 20px #00000088;
z-index: 999999;
padding: 10px;
user-select: none;
box-sizing: border-box; /* Ensure padding doesn't increase width */
}
#ghost-header {
font-size: 18px;
background: #4b0082;
padding: 10px;
margin: -10px -10px 10px -10px; /* Adjust to cover full top */
border-radius: 8px 8px 0 0;
cursor: move;
text-align: center;
font-weight: bold;
}
.ghost-section {
margin: 10px 0;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
}
.ghost-section label {
width: 100%;
margin-bottom: 5px;
font-size: 14px;
}
#ghost-container input[type=number] {
width: calc(100% - 10px); /* Adjust width for padding */
padding: 6px;
border: none;
border-radius: 5px;
font-size: 14px;
background-color: #333;
color: #fff;
margin-top: 5px;
}
.ghost-switch {
display: flex;
align-items: center;
width: 100%; /* Each switch on its own line */
margin: 4px 0;
font-size: 14px;
cursor: pointer;
}
.ghost-switch input[type="checkbox"] {
margin-right: 8px;
width: auto; /* Override 100% width for checkboxes */
}
#ghost-container button {
width: 48%;
margin: 2px 1%;
padding: 8px;
background: #28a745;
color: white;
border: none;
border-radius: 5px;
font-size: 14px;
cursor: pointer;
transition: background 0.2s ease;
}
#ghost-container button:hover {
background: #218838;
}
#ghost-container button#ghost-stop {
background: #dc3545;
}
#ghost-container button#ghost-stop:hover {
background: #c82333;
}
#ghost-status {
margin-top: 10px;
padding-top: 8px;
border-top: 1px solid #333;
text-align: center;
font-size: 13px;
color: #ccc;
}
`;
// Inject CSS
const style = document.createElement('style');
style.textContent = css;
document.head.appendChild(style);
// Inject UI
const box = document.createElement('div');
box.id = 'ghost-container';
box.innerHTML = html;
document.body.appendChild(box);
// Draggable UI
let offsetX, offsetY, dragging = false;
const header = document.getElementById('ghost-header');
header.addEventListener('mousedown', (e) => {
dragging = true;
offsetX = e.clientX - box.getBoundingClientRect().left;
offsetY = e.clientY - box.getBoundingClientRect().top;
box.style.cursor = 'grabbing';
});
document.addEventListener('mousemove', (e) => {
if (dragging) {
box.style.left = `${e.clientX - offsetX}px`;
box.style.top = `${e.clientY - offsetY}px`;
}
});
document.addEventListener('mouseup', () => {
dragging = false;
box.style.cursor = 'grab';
});
box.style.cursor = 'grab'; // Initial cursor
// Core logic
let isRunning = false;
let uiHidden = false; // Renamed 'hidden' to 'uiHidden' to avoid confusion with internal logic
let currentLessonProgress = 0; // Tracks lessons completed successfully or skipped
function setStatus(msg) {
document.getElementById('ghost-status').textContent = msg;
}
function sleep(ms) {
return new Promise(res => setTimeout(res, ms));
}
// --- TypingClub Specific Functions ---
/**
* Simulates a key press event for TypingClub.
* TypingClub often uses TYPING_TEST_HELPER.onKeyDown to process key events.
* @param {string} char The character to type ('a', ' ', '\n').
*/
function simulateKeyPress(char) {
let key = char;
let keyCode = char.charCodeAt(0);
if (char === '\n') {
key = 'Enter';
keyCode = 13;
} else if (char === ' ') {
keyCode = 32;
}
const eventOptions = {
key: key,
keyCode: keyCode,
which: keyCode,
code: key === 'Enter' ? 'Enter' : `Key${char.toUpperCase()}`, // Best guess for 'code'
bubbles: true,
cancelable: true,
};
const event = new KeyboardEvent('keydown', eventOptions);
// Check if TypingClub's specific handler exists
if (window.TYPING_TEST_HELPER && typeof window.TYPING_TEST_HELPER.onKeyDown === 'function') {
window.TYPING_TEST_HELPER.onKeyDown(event);
} else {
// Fallback: Dispatch to document (less reliable for TypingClub)
document.dispatchEvent(event);
console.warn("TypingGhost: TYPING_TEST_HELPER.onKeyDown not found. Falling back to document dispatch.");
}
}
/**
* Extracts the characters from the current TypingClub lesson.
* Handles normal characters and newlines.
* @returns {string[]} An array of characters to type.
*/
function getCharacters() {
const els = Array.from(document.querySelectorAll('.token span.token_unit'));
if (els.length === 0) {
console.warn("TypingGhost: No characters found. Is a lesson active?");
return [];
}
return els.map(el => {
// Check for newlines marked by a specific class
if (el.firstChild && el.firstChild.classList.contains('_enter')) {
return '\n'; // Represent newline as \n
}
// Get the text content, take the first character, or default to space if empty.
// TypingClub often shows spaces as ' ' which textContent handles fine.
let char = el.textContent?.[0] || '';
return char;
});
}
/**
* Simulates typing the given characters with WPM control and optional mistakes.
* @param {string[]} chars Array of characters to type.
* @param {number} wpm Target words per minute.
* @param {boolean} simulateMistakes Whether to randomly make and correct mistakes.
*/
async function autoType(chars, wpm, simulateMistakes) {
// Calculate delay per character (5 chars per word)
const delay = 60000 / (wpm * 5); // delay in ms per character
console.log(`Typing at ~${wpm} WPM, delay per char: ${delay.toFixed(2)}ms`);
for (let i = 0; i < chars.length; i++) {
if (!isRunning) return; // Allow stopping mid-typing
const c = chars[i];
// Simulate a mistake and correction
if (simulateMistakes && Math.random() < 0.03 && c !== ' ' && c !== '\n') { // 3% chance, exclude space/enter
setStatus(`Typing... Simulating mistake for '${c}'`);
simulateKeyPress('x'); // Type wrong character
await sleep(delay * (0.5 + Math.random() * 0.5)); // Pause after wrong char
simulateKeyPress('Backspace'); // Correct it
await sleep(delay * (0.5 + Math.random() * 0.5)); // Pause after backspace
}
setStatus(`Typing... ${i + 1}/${chars.length}`);
simulateKeyPress(c);
await sleep(delay * (0.9 + Math.random() * 0.2)); // Add natural variation to typing speed
}
}
/**
* Waits for the lesson to conclude and show a continue/retry button.
*/
async function waitForEnd() {
setStatus("Waiting for lesson to end...");
// Look for the common result/continue button or retry button
while (isRunning && !document.querySelector('.continue-button') && !document.querySelector('.button.orange._try-again, .button.orange._retry')) {
await sleep(1000); // Check every second
}
}
/**
* Main function to run the automation for multiple lessons.
*/
async function runLessons() {
const maxLessons = +document.getElementById('ghost-maxlessons').value;
const wpm = +document.getElementById('ghost-wpm').value;
const retryOnFail = document.getElementById('ghost-retry').checked;
const simulate = document.getElementById('ghost-mistakes').checked;
currentLessonProgress = 0; // Reset progress count
while (isRunning && currentLessonProgress < maxLessons) {
setStatus(`Lesson ${currentLessonProgress + 1}/${maxLessons}: Preparing...`);
// Wait for the typing interface to be ready and characters to be present
let chars = [];
let attempts = 0;
while (isRunning && chars.length === 0 && attempts < 15) { // Max 15 seconds wait
chars = getCharacters();
if (chars.length === 0) {
setStatus(`Lesson ${currentLessonProgress + 1}/${maxLessons}: Waiting for text to load... (Attempt ${attempts + 1})`);
await sleep(1000);
attempts++;
}
}
if (!isRunning) {
setStatus("⏹ Stopped.");
return;
}
if (chars.length === 0) {
setStatus(`Lesson ${currentLessonProgress + 1}/${maxLessons}: No text found, skipping. (Check if already finished lesson)`);
await sleep(2000); // Give user time to read status
currentLessonProgress++; // Treat as completed for count
continue; // Move to next iteration (or finish if maxLessons reached)
}
await autoType(chars, wpm, simulate); // Perform typing
if (!isRunning) {
setStatus("⏹ Stopped.");
return;
}
await waitForEnd(); // Wait for result screen
if (!isRunning) {
setStatus("⏹ Stopped.");
return;
}
const retryButton = document.querySelector('.button.orange._try-again, .button.orange._retry'); // Common retry button selectors
const continueButton = document.querySelector('.continue-button'); // Common continue button selector
if (retryOnFail && retryButton) {
setStatus(`Lesson ${currentLessonProgress + 1}/${maxLessons}: Failed or low score, retrying...`);
retryButton.click();
await sleep(3000); // Wait for page to reload/transition
// Do NOT increment currentLessonProgress, as we are repeating the same lesson
} else if (continueButton) {
setStatus(`Lesson ${currentLessonProgress + 1}/${maxLessons}: Completed, continuing...`);
continueButton.click();
await sleep(3000); // Wait for next lesson or summary page to load
currentLessonProgress++; // Increment only on successful continuation
} else {
setStatus(`Lesson ${currentLessonProgress + 1}/${maxLessons}: No continue/retry button found. Assuming end or manual intervention needed.`);
await sleep(2000);
currentLessonProgress++; // Treat as completed for count in this scenario
}
await sleep(1000); // Small pause between actions for stability
}
if (currentLessonProgress >= maxLessons) {
setStatus(`✅ Farming session complete! ${maxLessons} lessons finished.`);
} else {
setStatus("⏹ Stopped.");
}
isRunning = false;
}
// --- UI Event Listeners ---
document.getElementById('ghost-start').onclick = () => {
if (!isRunning) {
isRunning = true;
setStatus("🚀 Starting farming...");
runLessons();
} else {
setStatus("Already running.");
}
};
document.getElementById('ghost-stop').onclick = () => {
isRunning = false;
setStatus("⏹ Stopped by user.");
};
const stealthCheckbox = document.getElementById('ghost-stealth');
stealthCheckbox.addEventListener('change', () => {
if (stealthCheckbox.checked) {
uiHidden = true;
box.style.display = 'none';
// When going into stealth, automatically pause if running
if (isRunning) {
isRunning = false;
setStatus("Stealth Mode On: ⏳ Paused.");
} else {
setStatus("Stealth Mode On.");
}
} else {
uiHidden = false;
box.style.display = 'block';
// When coming out of stealth, do NOT automatically resume. User must click Start.
setStatus(isRunning ? "Stealth Mode Off: Running." : "Stealth Mode Off: Idle.");
}
});
// Global keyboard shortcut for stealth mode: Ctrl + Backspace
document.addEventListener('keydown', (e) => {
if (e.ctrlKey && e.key === 'Backspace') {
e.preventDefault(); // Prevent browser back navigation if any
stealthCheckbox.checked = !stealthCheckbox.checked; // Toggle checkbox state
stealthCheckbox.dispatchEvent(new Event('change')); // Trigger its change listener
}
});
})();