[Script] BSP - Battle Stats Predictor [New Model] | Tools & Us…

[Script] BSP - Battle Stats Predictor [New Model]

    • TDup [2660552]
    • Role: Civilian
    • Level: 100
    • Posts: 2,588
    • Karma: 3,605
    • Last Action: Now
      • 22
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Thread created on 15:06:25 - 12/08/22 (2 years ago)
    |
    Last replied 03:04:18 - 15/04/25 (4 days ago)

    This script predicts total battle stats for each Torn player.
    Predictions are fast and displayed in a bunch of useful places, almost everywhere actually, using a patented handy color system.

    Predictions are based on a machine learning model trained with thousands of real spies.
    Predictions can also be overridden by spies (link with TornStats/YATA), so you can see the most reliable information.





    Chain window : Easy retals with the color system! (click on the colored area for quick attack too!)


    The first week of use is free, then it's 1 xan/15 days.
    Send to me. Process is automated. You can pay in bulk.
    Price might increase in the future as I keep improving it.

    Discord is the place to discuss installation / question / improvement / wrong predictions / roadmap or just anything really
    It has the most up to date information.

    Disclaimer : Keep in mind predictions can't be 100% accurate, this script really shines to give you a super quick & relatively precise estimation.

    Link to the Script - It requires ViolentMonkey/GreaseMonkey to work, see installation steps below for more info
    For TornPDA -> use Kwack installer instead <-

    Video showing how useful it can be in Elimination

    Last edited by TDup on 03:20:13 - 20/01/25 (2 months ago)
    • TDup [2660552]
    • Role: Civilian
    • Level: 100
    • Posts: 2,588
    • Karma: 3,605
    • Last Action: Now
      • 1
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 15:06:36 - 12/08/22 (2 years ago)
    Post link copied to clipboard Copy post link
    How to install
     

    For TornPDA - Kwack (thanks! 🙏) made a simple installer for TornPDA:

    CLICK ON THIS WITHIN TORNPDA

    Then go to Step 2 below.

     

    PART A - First you need a tool such as Tampermonkey
     It's what injects scripts in the appropriate pages.

    • On computer, if you use Chrome, install it directly from Chrome extensions. (don't forget to enable developer mode, in 
    • chrome://extensions)
    • On computer, if you use Firefox, install Greasemonkey instead
    • On Android, it's a bit more complicated : because Chrome on Android doesn't allow ViolentMonkey to work properly (for some reason), you need another web browser. Usually, people on Torn pick Kiwi Browser (this is what I've done, and I'm playing Torn within Kiwi on my android) So Install Kiwi, then inside kiwi, install ViolentMonkey (using the Extensions page, that can also be accessed through chrome://extensions)
    • On Iphone, you can use TornPDA. 

    Tamper.png


    Then, in chrome://extensions/ enable developer mode
    devel.png

    PART B
    - The script

    Step 1: Install the script 
    From within the browser having Tampermonkey/Violentmonkey installed (can be kiwi) click on this:
    https://github.com/tdup-torn/userscripts/raw/master/battle_stats_predictor.user.js
    It should open the script within ViolentMonkey, click install.

    For TornPDA, CLICK ON THIS WITHIN TORPDA



    Step 2: Open the settings panel
    Now, it's installed, go on your profile page, you'll see a new option box on the top


    Step 3: Create a new API key. You can use the button for that .

    The key doesn't require any special right, this key will be the one sent to my server. It will be used to authenticate you, and to get info for other players you want to have prediction - in order to get their xan usage for example-


    Step4 : make sure you have this confirmation. Your API key is verified locally, and the BSP backend returned your subscription (1 free week for new user)


    Step 5 : Configure the Color tab
    It's important as it is what's going to display differently the players in Torn, depending on their stats (predictions or spies)
    Generate a key with access to your battlestats, and fill it properly then press Import stats
    You could also manually fill your stats if you wish. Note that those stats, or this API Key is not sent to the BSP backend. It's only stored locally on your machine.


    Step 6: Take the time to understand how it works:
    With the default configuration, in regular RW:
    -> gray (less than 5% of your TBS) Don't touch, way too weak and wouldn't yield respect
    -> white (between 5% and 35% of your TBS) Not great, but hey, you might want to unload your E at some point
    -> green (between 35% and 75% of your TBS) Perfect target, you should defeat them and they would yield decent respect
    -> blue (between 75% and 125% of your TBS) Same tbs as you, great FF but can be tough
    -> orange (between 125% and 400% of your TBS) Stronger than you, but you can damage them
    -> red (more than 400% of your TBS) : Only to assist your beasts.


    [The next steps are optional, you can already check what Torn looks like now, with this script configured. Go on your chain view, any faction, RW, hall of fame, do a quick search if you are a subscriber... You should see the predictions displayed a bit everywhere now]

    Step 7: In the Pages tab, select where you want BSP to be enabled.
    Also, for those who don't display honor bars, make sure to uncheck it here (so the placement works properly)
    I went a bit YOLO on this page stuff, you DON'T HAVE TO ENABLE IT in forums (but you can xD)

    Step 8: You can enable TornStats spies

    Tick the checkbox, fill your TornStats API key and validate. Then go on a faction page, and click BSP Import spies



    Notice the star, along with the TBS, the star means it comes from a spy, and not a prediction (so it's "reliable", except if you have forged spies in your TornStats spies data!)


    Step 9 : Enjoy, give feedback, and remember that:

    - Those predictions are.. predictions. They can't be 100% accurate, so use this tool for what it is, not a cheat but a helper
    - If there are issues with my script, let me know politely, it has been a serious hobby for me those past month, but it also takes time to support/fix, please understand I have a life outside of Torn



    Step 10 : Advanced knowledge for TornStats spy integration
    When a spy is older than the setting you have here (older than 30 days by default) .. a prediction is made. If the predicted tbs is lower than your old spy tbs, the old spy tbs is used instead. along with a specific symbol : a floppy disk ( btw, feel free to suggest another icon :p)

    Last edited by TDup on 19:31:57 - 09/03/25 (1 month ago)
    • TDup [2660552]
    • Role: Civilian
    • Level: 100
    • Posts: 2,588
    • Karma: 3,605
    • Last Action: Now
      • 1
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 15:06:47 - 12/08/22 (2 years ago)
    Post link copied to clipboard Copy post link

    Q&A

    - How do I pay?
    Send 1 or more xanax to TDup [2660552]
    Each xanax gives 15 days worth of subscription. The process is automated so you don't have to wait for me to be online. Payment is processed within 1 minute.

    - Is it legal?
    It uses only API data, and an external service I created & trained with legit spies.

    I hope I went wild enough <3

    - What do you mean "price might increase in the future"?
    It's free for one week starting whenever you want (trying to hook you up so you can see why it's useful), then it's 1 xan / 15 days.
    I received tons of feedback saying "it's way too cheap", but I want a broad adoption and young players to be able to use it.
    I plan to keep working on this script for a while, and it's very likely to improve significantly (in UX, optimizations and more importantly : accuracy), and thus why price might increase in the future.
    Note that if you subscribe for like 3 months right now, you obviously won't have to pay for a potential raise for this period.
    Note that during Elimination, the free week period won't be usable

    - Can you predict all kind of TBS?
    On March 2024, I pushed a new model that can better predict any kind of targets.
    From weak players to strong ones.
    For the megazord (>250SE), I'm not relying on a model, but from a simple math function, using SE as input. It's cheap but doesn't the job ok-ish.

    - But, Ched changed the way gym gains are computed!
    About that.. Yeah, It's a bit annoying. My current prediction model will indeed be offset with time, and predictions will be off especially for high TBS players (prediction lower than reality)
    It's going to take time though, and getting new spies frequently / updating my model will mitigate this issue. I'm not too worried about that.

    - But, TBS are irrelevant because balanced build and whore build are not similar
    True, especially below 50m stat cap. I actually based my prediction model on the Battle Stats Score information
    Problem is: normal players don't get the meaning of Battle Stats Score, so it makes little sense to display it to them.

    - What is the API keys rate limit?
    For now, I've set a hard lock at 50 calls/minutes per user. (max allowed by Torn is 100 calls/minute)
    That being said, I've implemented different caches to reduce the required number of API calls (predictions are saved server side, and shared among users of this script with a 1 day timeout for example)

    - I've heard about API keys being stolen and used to mug me!
    I'm taking this topic really seriously and don't want any issue ever. I actually designed my previous project to avoid any possibility of API key breach, and there has been 0 complain ever.

    I've made the TBS script so it can use different API Keys. The only API key sent to my backend is the global one, which requires no specific right (= I can't see your activity, your battle stats, your money).
    The API key you can use in the "Color" section, is here to automate the process of getting your stats locally, to compare with other players. This key, or the stats are not sent to my backend.
    Yata/TornStats integration : same thing: it's done on the client and not sent to my backend.
    You can change your API key whenever you want.
    You can also inspect the client (javascript) code (or ask a fellow developer player to do so), I didn't minify it for this very reason.

    - You mentioned Machine Learning, I'd love to know more!
    Here's the current state:

    The new model is based on 57k unique data points. Coming from spies, or from BScore calculated through faction attacks.
    I'm still relying on a 3 layers approach.

    • If a player has 250SE+, instead of the really bad model I previously had, I now run a simple math function to predict TBS based on SE alone (capped at 1q). It's not ideal but it's a nice improvement.
    • Otherwise player gets bscore predicted through the main model, with those features: Attacks, Useractivity, Awards, Xantaken , Daysbeendonator , Refills , Statenhancersused, Revives, Lsdtaken ,Boostersused, Energydrinkused,Agenoninactive

    If the player has <4000 bscore, then it goes through another model ("TheWeakModel") which has been trained with weak players only (22k data point) - I have a really better accuracy like thisBscore is then transformed into TBS, and increased a little bit, because most players aren't perfectly balanced.

    If you want more info, join the Discord!

    - Be honest, you have the Thief Title, you're just trying to mug me!
    Nice! You either read until here (and it was long, congratz), or you noticed the Thief Title.
    I spend a lot of time scripting.
    I've developed a tool to know about Leslie Wheels, but outside the 2 DPs Sugarvalves sent me to appear in the newspaper, I made $0 out of a lot of hours programming. "Do it for the Science" they said
    So I've a bazaar checker script sometimes running on the side, and I mug lazy players who don't self hosp when they sell expensive stuff :D
    (Fun fact, this prediction tool was first created as a feature for this bazaar checker, to filter out players I couldn't beat!)
    Needless to say this mugging script runs with my own key and has 0 link with this. You can always check your key usage.

    My plan is actually to make $$$ with this Predictor tool, because it scales (as opposed to some occasional mugs) and it's really useful for everyone!

    Last edited by TDup on 16:59:05 - 29/10/24 (5 months ago)
    • Sidgar [1828507]
    • Role: Civilian
    • Level: 100
    • Posts: 2,447
    • Karma: 1,762
    • Last Action: 7 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 15:56:38 - 12/08/22 (2 years ago)
    Post link copied to clipboard Copy post link
    Does it take into account revives given? I did a lot of revives and my predicted stats are quite a bit higher than they really are.
    • TDup [2660552]
    • Role: Civilian
    • Level: 100
    • Posts: 2,588
    • Karma: 3,605
    • Last Action: Now
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 16:03:37 - 12/08/22 (2 years ago)
    Post link copied to clipboard Copy post link

    Sidgar [1828507]

    Does it take into account revives given? I did a lot of revives and my predicted stats are quite a bit higher than they really are.
    Yes, It does take revives done into account, you can join the Discord to have more info!

    That being said, maybe I lacked revivers in my training data, and this feature is not enough impactful (I've tested and having revives decreases the predicted stats)

    Edit : as discussed on Discord, prediction was off by 15%, which is still decent. (and probably more related to your inactivity than the revives I believe, but I could be wrong here)
    Last edited by TDup on 17:02:57 - 02/10/22 (2 years ago)
    • Insi [2034939]
    • Role: Civilian
    • Level: 100
    • Posts: 784
    • Karma: 3,440
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 16:46:27 - 12/08/22 (2 years ago)
    Post link copied to clipboard Copy post link
    Seems pretty accurate when comparing to my spy base, although there are definitely a few surprises waiting for you if you rely on it 100%
    • KaosTse [2382685]
    • Role: Civilian
    • Level: 100
    • Posts: 556
    • Karma: 704
    • Last Action: 1 hour
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 18:01:40 - 12/08/22 (2 years ago)
    Post link copied to clipboard Copy post link
    Yes there are the 1% weird stat players, like "that guy" with negative dex cause of pcp OD, or that other one who used to stack and stay for 3 days with 1000e before actually training, but overall its quite reliable and spot on.
    Been using it for some time now and i fully recommend.
    • masheen [2625139]
    • Role: Civilian
    • Level: 100
    • Posts: 5,455
    • Karma: 7,136
    • Last Action: 1 minute
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 13:13:30 - 13/08/22 (2 years ago)
    Post link copied to clipboard Copy post link
    Testing this script.

    ◉_◉

    • Elaine [2047176]
    • Role: Civilian
    • Level: 100
    • Posts: 941
    • Karma: 415
    • Last Action: 7 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 12:02:08 - 15/08/22 (2 years ago)
    Post link copied to clipboard Copy post link
    Works pretty well for me. :)
    • masheen [2625139]
    • Role: Civilian
    • Level: 100
    • Posts: 5,455
    • Karma: 7,136
    • Last Action: 1 minute
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 16:00:56 - 15/08/22 (2 years ago)
    Post link copied to clipboard Copy post link
    So far it really has impressed me how accurate it can be. Thanks for the work here!

    ◉_◉

    • Icydraft [2031301]
    • Role: Civilian
    • Level: 100
    • Posts: 487
    • Karma: 600
    • Last Action: 22 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 13:52:27 - 18/08/22 (2 years ago)
    Post link copied to clipboard Copy post link
    Good script. Looks mostly accurate. (excluding the SE heavy users of course).
    • Caio [2488372]
    • Role: Civilian
    • Level: 100
    • Posts: 1,039
    • Karma: 758
    • Last Action: 2 hours
      • 1
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 14:51:06 - 20/08/22 (2 years ago)
    Post link copied to clipboard Copy post link
    in most scenarios looking very precise, very helpful script!

    P5VwgsT.gif Good day! banner_grafitti

    • Elaine [2047176]
    • Role: Civilian
    • Level: 100
    • Posts: 941
    • Karma: 415
    • Last Action: 7 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 17:45:42 - 20/08/22 (2 years ago)
    Post link copied to clipboard Copy post link
    Just noticed that during wars it can be especially helpful if TornStats is down for some reason. Better to have a decent prediction then no access to stats at all.
    • Kvassh [2596327]
    • Role: Civilian
    • Level: 99
    • Posts: 483
    • Karma: 489
    • Last Action: 2 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 14:04:31 - 22/08/22 (2 years ago)
    Post link copied to clipboard Copy post link
    Awesome tool! Just found it today and it might not be 100% accurate, but it's perfect for my usecase and much better (and faster) than what I would calculate manually :)
    Last edited by Kvassh on 14:04:44 - 22/08/22 (2 years ago)
    • Null [2042113]
    • Role: Civilian
    • Level: 15
    • Posts: 163
    • Karma: 102
    • Last Action: 2 years
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 17:19:32 - 22/08/22 (2 years ago)
    Post link copied to clipboard Copy post link
    Awesome work, really love the approach and the execution, the results are on point too!
    Last edited by Null on 17:58:45 - 22/08/22 (2 years ago)
    • KaosTse [2382685]
    • Role: Civilian
    • Level: 100
    • Posts: 556
    • Karma: 704
    • Last Action: 1 hour
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 01:12:15 - 23/08/22 (2 years ago)
    Post link copied to clipboard Copy post link
    bump
    • Lost [1728158]
    • Role: Civilian
    • Level: 100
    • Posts: 288
    • Karma: 670
    • Last Action: 1 month
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 01:47:11 - 26/08/22 (2 years ago)
    Post link copied to clipboard Copy post link
    I like it, just too bad I’m on “a shitty closed ecosystem”.


    Keep up the innovation
    Last edited by Lost on 01:47:50 - 26/08/22 (2 years ago)

    • TDup [2660552]
    • Role: Civilian
    • Level: 100
    • Posts: 2,588
    • Karma: 3,605
    • Last Action: Now
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 02:05:41 - 26/08/22 (2 years ago)
    Post link copied to clipboard Copy post link

    Lost [1728158]

    I like it, just too bad I’m on “a shitty closed ecosystem”.


    Keep up the innovation
    LMAO xD
    You misspelled "Apple" :p

    I think one of the friendly players handling Torn Intelligence Agency got it working on his IPhone.
    • TDup [2660552]
    • Role: Civilian
    • Level: 100
    • Posts: 2,588
    • Karma: 3,605
    • Last Action: Now
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 02:32:23 - 28/08/22 (2 years ago)
    Post link copied to clipboard Copy post link
    I've added an automated payment process (see Q&A for more info), and changed from 2xan/month to 1xan/15days.
    • TDup [2660552]
    • Role: Civilian
    • Level: 100
    • Posts: 2,588
    • Karma: 3,605
    • Last Action: Now
      • 1
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 02:01:16 - 06/09/22 (2 years ago)
    Post link copied to clipboard Copy post link
    Edit : Torn API has been fixed, everything should be working fine! Let me know on the Discord if you face any issue

    Torn API has been broken for 12h+ now, this script cannot work without it.
    Please be patient & come to the discord if you want more updates.

    Thanks! :)
    Last edited by TDup on 13:18:53 - 06/09/22 (2 years ago)
Reply
Thread Title: