[Script] Torn Faction Organized Crime Metrics | Tools & Usersc…

[Script] Torn Faction Organized Crime Metrics

    • Canixe [3753120]
    • Role: Civilian
    • Level: 74
    • Posts: 279
    • Karma: 247
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Thread created on 17:40:57 - 17/09/25 (10 months ago)
    |
    Last replied 17:40:11 - 03/04/26 (3 months ago)

    Torn Faction OC Crime Metrics

    Adds a compact panel to the Faction page that pulls your faction’s completed organized crimes (via the Torn API) and shows clean metrics: success vs fail, respect, money to members/faction, a grand total, and an OC breakdown with income, items, and net.

    Script page: https://greasyfork.org/en/scripts/549344-torn-faction-organized-crime-metrics
    Requires a Torn API key with Limited Access.


    Features

    • On-demand – the panel stays collapsed and does nothing until you need it to.
    • Date range selection – pick From/To in the header to calculate metrics for the chosen date range.
    • OC Metrics
      • Crime metrics with Success / Fail and success rate.
      • Respect metrics with total earned, per day, and per OC.
      • Economic metrics with money paid to members, money earned by faction, and item value estimates (uses market value).

    a587f381-bcda-4f2e-8e95-aa8d42987a53-3753120.png

     

    beaef210-bf27-43e4-968a-957c0ab4c478-3753120.jpg

     


    Installation & Use

    1. Install a userscript manager (e.g., Tampermonkey).
    2. Open Torn → Faction
      https://www.torn.com/factions.php
    3. Click the panel’s API key pill and paste your key. The key requires Limited Access.
    4. Choose a date window.
    5. Press ▶ Run. The panel fetches and computes metrics, then displays KPI tiles and the OC breakdown.
      Use ■ Stop to cancel a long range.

    How It Works

    1. Crimes:
      https://api.torn.com/v2/faction/crimes?cat=completed&filter=executed_at&from=...&to=...&sort=DESC&key=...&comment=TF-OC-Crime-Metrics
    2. News (member payouts):
      https://api.torn.com/v2/faction/news?cat=depositFunds&sort=DESC&from=...&to=...&key=...
      • The news window’s upper bound extends to the latest rewards.payout.paid_at among fetched crimes, so late payments aren’t missed.
      • Parses each news row’s crimeId and “balance by $X” to attribute member payouts to the correct OC.
    3. Items (names & market value):
      https://api.torn.com/v2/torn/items?key=...
      Uses each item’s value.market_price to estimate item rewards; cached for 24 hours.

    Troubleshooting

    • “Torn API error …” → Check your key; it must have Limited Access. Rate limits may require a short wait.
    • No crimes shown → No completed OCs in the chosen window (times are UTC).

    Privacy & Scope

    • Runs only on the Faction page.
    • Stores your API key locally (userscript storage).
    • Contacts only the Torn API. No third-party services.

    Credits

    Script by Canixe [3753120]. If it helps and you want to show appreciation, send a Xan or drop a thanks at my bazaar.
    Not affiliated with Torn.

    Last edited by Canixe on 03:54:17 - 03/01/26 (6 months ago)
    • Canixe [3753120]
    • Role: Civilian
    • Level: 74
    • Posts: 279
    • Karma: 247
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 17:41:09 - 17/09/25 (10 months ago)
    Post link copied to clipboard Copy post link

    Script version was updated to version 1.1.0


    Changelog:
    v1.1.0 - Add copy to clipboard functionalities
    v1.0.7 - Fix some rounding issues
    v1.0.6 - Allow the item value estimate to use the current market value or the value at OC time based on OC payout
    v1.0.5 - Change faction log parsing to use crime logs instead of fund logs, for better dealing with NoReserve/BiddingWar
    v1.0.4 - Fix duplication issue on faction logs

    v1.0.3 - Improve TornPDA grid visibility

    v1.0.2 - Fix crashing issue with TornPDA

    v1.0.1 - Correct API Key level requirement (Minimal -> Limited)

    v1.0.0 - Release

     

     

     

    Donations:

    00:46:02 - 16/09/25 Agent86 sent 60x Xanax to you with the message: for your help with the OC report metrics
    20:43:54 - 17/09/25 Agent86 sent 60x Xanax to you with the message: thanks again for the work on the metrics report
    22:14:29 - 04/10/25 You were sent a Drug Pack from ThunderBlitz with the message: Cool script!
    12:32:51 - 14/11/25 Darrellia sent 3x Feathery Hotel Coupon to you with the message: thanks for the great tool!

    02:16:14 - 11/04/26 RussianRob sent 50x Xanax to you with the message: Loving the script bro!

     

     

     

    Contributors:

    You sent some Xanax to BorrFedick with the message: Thanks for your feedback on my script, the change has been implemented
    You sent some Xanax to ThunderBlitz with the message: Thanks for your feedback on my script, the change has been implemented
    You sent some Xanax to BlackadderThe3 with the message: Thanks for your feedback on my script, the change has been implemented
    You sent some Xanax to Simmeltron with the message: Thanks for your feedback on my script, the change has been implemented

     

    Last edited by Canixe on 02:53:57 - 11/04/26 (3 months ago)
    • Allenone [2033011]
    • Role: Civilian
    • Level: 99
    • Posts: 844
    • Karma: 2,740
    • Last Action: 1 hour
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 18:09:47 - 17/09/25 (10 months ago)
    Post link copied to clipboard Copy post link

    Very nice.

     

    Would be nice if it cached the info from the last time it was run so It doesn't need to be ran every time. Also it's not loading 'paid to members'

    65cb969e-8fd4-405e-8405-acaa47775970-2033011.png

    • Canixe [3753120]
    • Role: Civilian
    • Level: 74
    • Posts: 279
    • Karma: 247
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 18:37:19 - 17/09/25 (10 months ago)
    Post link copied to clipboard Copy post link

    Allenone [2033011]

    Very nice.

     

    Would be nice if it cached the info from the last time it was run so It doesn't need to be ran every time. Also it's not loading 'paid to members'

    65cb969e-8fd4-405e-8405-acaa47775970-2033011.png

    Sorry, my bad, it actually requires Limited Access key (I should have read the API docs better)
    And the Paid to Members should be fixed with that

    • BorrFedick [3470183]
    • Role: Civilian
    • Level: 71
    • Posts: 186
    • Karma: 57
    • Last Action: 18 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 23:26:20 - 17/09/25 (10 months ago)
    Post link copied to clipboard Copy post link

    Looks good, TornPDA compatible?

    Join the Fam:

    Aotearoa Family - Warmongers, dedicated warring faction (80% RW and 100% OC payout) 💪

    Aotearoa Family - Criminals, OC focused crime faction (80% OC payout) 🚓

     

    Work for the Fam:

    Sex Toys R Us - Adult Novelty 🔥

    • ThunderBlitz [2684774]
    • Role: Civilian
    • Level: 61
    • Posts: 1,498
    • Karma: 1,179
    • Last Action: 2 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 23:40:15 - 19/09/25 (10 months ago)
    Post link copied to clipboard Copy post link

    BorrFedick [3470183]

    Looks good, TornPDA compatible?

    Doesn't seem to be.  Installed it, went to every faction tab, including the OC one (viewing all 3 subtabs) but, no sign of this script anywhere.  I even tried looking at the code in case the API key could be hardcoded in but, couldn't see any obvious entry for it.

     

    If it becomes compatible, getting it to use the default TornPDA key automatically, would really simplify things here.

     

     

    That time my company hit #1

    Not all changes are for the better. #BeCarefulWhatYouWishFor

    • BlackadderThe3 [2647431]
    • Role: Civilian
    • Level: 99
    • Posts: 86
    • Karma: 54
    • Last Action: 2 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 19:31:51 - 21/09/25 (9 months ago)
    Post link copied to clipboard Copy post link

    I cannot get this script to appear either within TornPDA either.

    • Canixe [3753120]
    • Role: Civilian
    • Level: 74
    • Posts: 279
    • Karma: 247
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 18:26:37 - 04/10/25 (9 months ago)
    Post link copied to clipboard Copy post link

    New version of the script has been released:

     

    v1.0.3 - Improve TornPDA grid visibility

    v1.0.2 - Fix crashing issue with TornPDA

     

    First was the fix that was not allowing the script to execute properly in TornPDA

     

    e563aed4-00bf-4cf4-b057-60c6b33baf83-3753120.jpg

     

    Second was allow the grid to now collapse on TornPDA and show in a more friendly manner, allowing to expand/collapse each row to show additional details.

     

    • BorrFedick [3470183]
    • Role: Civilian
    • Level: 71
    • Posts: 186
    • Karma: 57
    • Last Action: 18 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 08:05:10 - 23/10/25 (8 months ago)
    Post link copied to clipboard Copy post link

    Works great on TornPDA now, 👍 👍 

    Join the Fam:

    Aotearoa Family - Warmongers, dedicated warring faction (80% RW and 100% OC payout) 💪

    Aotearoa Family - Criminals, OC focused crime faction (80% OC payout) 🚓

     

    Work for the Fam:

    Sex Toys R Us - Adult Novelty 🔥

    • Darrellia [2802767]
    • Role: Civilian
    • Level: 97
    • Posts: 286
    • Karma: 260
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 12:30:23 - 14/11/25 (8 months ago)
    Post link copied to clipboard Copy post link

    Amazing work! Any chance you can add statistics on members level? (success/fail on their checkpoint, success/fail on OCs, money they got paid)

     

    • Simmeltron [2945165]
    • Role: Civilian
    • Level: 84
    • Posts: 140
    • Karma: 47
    • Last Action: 32 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 23:07:10 - 12/12/25 (7 months ago)
    Post link copied to clipboard Copy post link

    Just installed this and it is awesome! To backload all our historical OC2.0 crimes from the beginning... is there an efficient way to do that? Or do I just pick the date that OC2.0 was launched?

    Murder-Hornets-Team-WStrokes-600x100.gif

    • Canixe [3753120]
    • Role: Civilian
    • Level: 74
    • Posts: 279
    • Karma: 247
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 00:00:18 - 13/12/25 (7 months ago)
    Post link copied to clipboard Copy post link

    Simmeltron [2945165]

    Just installed this and it is awesome! To backload all our historical OC2.0 crimes from the beginning... is there an efficient way to do that? Or do I just pick the date that OC2.0 was launched?

    Thank you for your feedback!

    The current script doesn't "store" the OCs and instead everytime you make a query, it will call the APIs to load the whole timeframe through various API calls needed for the set timeframe, therefore its kinda more usefull to compare one month vs the other, rather than check the whole OCs history, however being possible, will take a long time to fully load.

    I could look into having the history being kept, but that would affect storage, so I'm not sure it is an approach that would be of interest to all types of devices.

    • Canixe [3753120]
    • Role: Civilian
    • Level: 74
    • Posts: 279
    • Karma: 247
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 03:20:39 - 03/01/26 (6 months ago)
    Post link copied to clipboard Copy post link

    New version of the script has been released:

    v1.0.4 - Fix duplication issue on faction logs
    v1.0.5 - Change faction log parsing to use crime logs instead of fund logs, for better dealing with NoReserve/BiddingWar
    v1.0.6 - Allow the item value estimate to use the current market value or the value at OC time based on OC payout

    Sometimes the payments to members were duplicated and the value shown was incorrect, this is now fixed!

    Last edited by Canixe on 06:22:09 - 03/01/26 (6 months ago)
    • EOL-SUB [3975605]
    • Role: Civilian
    • Level: 30
    • Posts: 12
    • Karma: 2
    • Last Action: 5 months
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 06:55:30 - 04/01/26 (6 months ago)
    Post link copied to clipboard Copy post link

    bb40134e-1ef4-4bc9-b1e4-bc642aa543ee-3975605.png

     

    Nothing Happened? How?

    • Canixe [3753120]
    • Role: Civilian
    • Level: 74
    • Posts: 279
    • Karma: 247
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 07:28:42 - 04/01/26 (6 months ago)
    Post link copied to clipboard Copy post link

    EOL-SUB [3975605]

    bb40134e-1ef4-4bc9-b1e4-bc642aa543ee-3975605.png

     

    Nothing Happened? How?

    Make sure you have scripts running, that tampermonkey or whatever addon for scripts is running properly and that it has permissions to execute scripts, and that the script is installed and active,
    If all of the above are working as expected, It should be showing a bar like this:
    359c2ede-acf1-4812-a78f-a6b449faaa10-3753120.png

     

    which you then have to expand on the arrow on the far right to use

    • Simmeltron [2945165]
    • Role: Civilian
    • Level: 84
    • Posts: 140
    • Karma: 47
    • Last Action: 32 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 17:06:57 - 04/01/26 (6 months ago)
    Post link copied to clipboard Copy post link

    Is there any way to efficiently export the summary numbers at the top at least? I'd like to copy and paste them into a report for our leadership if possible. But it doesn't copy/paste very well the way it is currently formatted.

    Murder-Hornets-Team-WStrokes-600x100.gif

    • Canixe [3753120]
    • Role: Civilian
    • Level: 74
    • Posts: 279
    • Karma: 247
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 01:59:30 - 07/01/26 (6 months ago)
    Post link copied to clipboard Copy post link

    Simmeltron [2945165]

    Is there any way to efficiently export the summary numbers at the top at least? I'd like to copy and paste them into a report for our leadership if possible. But it doesn't copy/paste very well the way it is currently formatted.

    Thank you for using my script and thank you for your feedback,

    I've released a new version that allows to copy all the headers with a copy button at the top
    f7c69297-c26c-485a-9a0c-336152299d87-3753120.png

    Which copies the whole header information in a table-like structure, like this:
    8003f784-8107-4721-a3f6-bf24385f5e94-3753120.png

     

    And also allows to copy each of the KPIs individually by single clicking on the KPI cell:
    19bfbb0f-347a-439c-91ad-d5365963f841-3753120.png

    Which in this case will copy like this: "Money to faction    $35    ≈ $5 / day"


    • Simmeltron [2945165]
    • Role: Civilian
    • Level: 84
    • Posts: 140
    • Karma: 47
    • Last Action: 32 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 19:21:46 - 27/01/26 (5 months ago)
    Post link copied to clipboard Copy post link

    Simmeltron [2945165]

    Is there any way to efficiently export the summary numbers at the top at least? I'd like to copy and paste them into a report for our leadership if possible. But it doesn't copy/paste very well the way it is currently formatted.

    Canixe [3753120]

    Thank you for using my script and thank you for your feedback,

    I've released a new version that allows to copy all the headers with a copy button at the top
    f7c69297-c26c-485a-9a0c-336152299d87-3753120.png

    Which copies the whole header information in a table-like structure, like this:
    8003f784-8107-4721-a3f6-bf24385f5e94-3753120.png

     

    And also allows to copy each of the KPIs individually by single clicking on the KPI cell:
    19bfbb0f-347a-439c-91ad-d5365963f841-3753120.png

    Which in this case will copy like this: "Money to faction    $35    ≈ $5 / day"


    Oh awesome.. just realized you updated this. The copy feature works well to past into a spreadsheet for formatting. Thanks!!

    Murder-Hornets-Team-WStrokes-600x100.gif

    • Zible [3335608]
    • Role: Civilian
    • Level: 78
    • Posts: 26
    • Karma: 12
    • Last Action: 43 minutes
      • 1
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 00:12:01 - 29/03/26 (3 months ago)
    Post link copied to clipboard Copy post link

    Found this with a Google search that I expected to return nothing - really awesome script with a nice display. I do wonder if it would be possible to also incorporate the cost of items needed for the OC to run (e.g. Chloroform) since that impacts the net profit pretty heavily. Either way this made my day much easier - thank you!

    • Inmate614 [2705382]
    • Role: Civilian
    • Level: 98
    • Posts: 71
    • Karma: 32
    • Last Action: 14 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 17:40:11 - 03/04/26 (3 months ago)
    Post link copied to clipboard Copy post link

    Very cool stats.  I'm using a Limited API but still get no value in the Money to members.

Reply
Thread Title: