How I Made $100K in Torn Using a Trading Bot

How I Made $100K in Torn Using a Trading Bot

Recently, I started playing another game called Torn. It’s a text-based RPG where you can perform crimes, trade, travel & do jobs to climb to the top.

As usual, I was looking for ways to exploit anything that I find, and ended up building a bot that used in-game methods to make money without even violating policies!

Disclaimer: This article is for educational purposes only. Attempting to replicate the methods described here may violate Torn’s terms of service. Please note that any mention to “money” means in-game currency. It has nothing to do with actual money.

Background

Torn is a text-based RPG set in Torn city, where you can perform crimes, do jobs, take education, travel & pretty much everything you can in real life.

It’s a popular game with more than 2 million users and thousands of concurrent active users.

You can use torn dollars as an in-game currency, that can be gained by several methods including trading, which consists of buying an item & selling it for higher price (as shown in Figure 1).

Article content

In the above example, a Glock 17 is listed for $180 by a player, which will be bought for $270 by in-game NPCs, so you can make a $90 profit by buying & selling it.

However, the above method is slow & profits are tiny, only making it feasible for new players.

Technical Details

In order to write such a bot, I needed the complete list of all items with sales prices, along with something that runs automatically & buys stuff that can make profit. I decided that I can just visit the shop & sell them manually later.

Extracting Sales Prices

From any in-game store, you can find the sales prices & type them manually, but I decided to write a script to do it for me.

function getItemPrices() {
    const result = {};

    // Get all <li> elements that contain items
    const items = document.querySelectorAll('li');

    items.forEach(item => {
        const nameElem = item.querySelector('.desc .name');
        const priceElem = item.querySelector('.desc .price');

        if (nameElem && priceElem && priceElem.dataset.sell) {
            const name = nameElem.textContent.trim();
            const priceText = priceElem.dataset.sell;  // e.g. "$1,250"
            const parsedPrice = parseInt(priceText.replace(/[$,]/g, ''), 10);

            if (!isNaN(parsedPrice)) {
                result[name] = parsedPrice;
            }
        }
    });

    return result;
}        

By executing the above function through browser console, I was able to extract the prices (view Figure 2).

Article content

By executing it on multiple stores, I was able to build a pretty complete list of all items.

Finding Profitable Deals

The next step was the find the deal that gains the most profit. I used a bit of JavaScript & wrote another function that would give me the most profitable item within seconds:

function findBestDeal(priceMap) {
    let maxProfit = -Infinity;
    let bestItemElement = null;

    // Select all <li> elements under ul with class starting with "itemList"
    const items = document.querySelectorAll('ul[class^="itemList"] li');

    items.forEach(li => {
        const nameElem = li.querySelector('[class*="name"]');
        const priceElem = li.querySelector('[class*="priceAndTotal"] span');

        if (!nameElem || !priceElem) return;

        const itemName = nameElem.textContent.trim();
        const priceText = priceElem.textContent.trim(); // e.g., "$574"
        const currentPrice = parseInt(priceText.replace(/[$,]/g, ''), 10);

        if (!priceMap.hasOwnProperty(itemName)) return;

        const internalPrice = priceMap[itemName];
        const profit = internalPrice - currentPrice;

        if (profit > 0) {
            console.log(`Profit = ${profit} from ${itemName}`);

            if (profit > maxProfit) {
                maxProfit = profit;
                bestItemElement = li;
            }
        }
    });

    return bestItemElement ? [maxProfit, bestItemElement] : null;
}        

By passing it the object generated in step 1, it would return an array containing the maximum profit & the item element.

Article content

Buying the Item

Even the above method is useful, so I can just quickly find what to buy & buy it, but why do it manually when you can automate it as well?

I wrote a final script that buys the best deal automatically.

async function buyBestDeal(prices) {
    console.log("Finding best deal");
    const result = findBestDeal(prices);

    if (!result) {
        window.scrollTo(0, document.body.scrollHeight);
        console.log("no item");
        return;
    }

    const [profit, li] = result;

    li.scrollIntoView();

    // Step 1: Click the first Buy button inside the li
    const buyTrigger = li.querySelector('[aria-controls*="wai-ariaControls-buy"]');
    if (!buyTrigger) {
        console.log("Buy trigger not found");
        return;
    }

    buyTrigger.click();
    await new Promise(resolve => setTimeout(resolve, 2000)); // Wait 0.5 seconds

    // Step 2: Click the actual Buy button in the pop-up
    const buyButton = document.querySelector('[class*="buyButton"]');
    if (!buyButton) {
        console.log("Buy button not found");
        return;
    }

    buyButton.click();
    await new Promise(resolve => setTimeout(resolve, 2000)); // Wait 0.5 seconds

    // Step 3: Click the confirm button
    const confirmButton = document.querySelector('[class*="confirmButtons"] button:nth-child(1)');
    if (!confirmButton) {
        console.log("Confirm button not found");
        return;
    }

    confirmButton.click();
    console.log(`Purchased an item for a profit of $${profit}`);

    await new Promise(resolve => setTimeout(resolve, 2000)); // Optional: wait for confirmation UI to settle

    // Step 4: Click the "Close panel" button
    const closePanelButton = document.querySelector('[aria-label="Close panel"]');
    if (closePanelButton) {
        closePanelButton.click();
    }
}        

Running this would result in the most profitable deal automatically being purchased.

By combining these, I was able to successfully purchase items efficiently, resulting in high profits.

Putting it All Together

My final attempt was to make it quick, effortless & efficient, so I can enable it with a single click & just watch as it makes profit for me.

I wrapped the code as a Google extension, and made it run repeatedly so I can use the extension to “mine” profitable items automatically.

Here’s the final output:

Conclusion

With this method, we can easily make thousands of dollars easily within minutes. It can run for hours without breaks and buy stuff in background. It can be used with above scripts, or the extension that I developed.

If you wish to get access to the extension, please comment below or message me directly. If you have any issues or require support in using the scripts, please also feel free to contact me.

That’s all for today. I hope you enjoy reading as much as I enjoyed finding the vulnerability. If there’s something specific you want me to patch, please let me know in the comments.

To view or add a comment, sign in

Others also viewed

Explore topics