Skip to content
TORNLIFE More

[Script] Batch Balance

Started by tobytorn [1617955] on in Tools & Userscripts.

15 replies · 636 views · thread synced · 3 days ago · View on torn.com
About this thread

Posts archived: 16 / 16 posts (100%) · the total is Torn's reply count + the opening post at the last fetch

Counted by TornLife from the archived posts.

Archived posts
16
Discussion span
→
People posting
8
Likes on archived posts
36
Authority score
38 / 100
Historical score
37 / 100
Story score
50 / 100
Engagement score
68 / 100

Most-liked replies

Mentioned in this thread

mavri [2402357] ×1

tobytorn [1617955]

TL;DR This script helps faction managers to change balance of multiple faction members.

 

Install: https://greasyfork.org/en/scripts/536376-batch-balance

 

Introduction

 

It's common practice to change balances for multiple faction members at once, such as for RW income distributions or custom OC reward management. Many factions have developed their own workflows and tools to streamline this process. In SMTH, we've long relied on a dedicated userscript to efficiently handle batch balance changes.

 

However, the recent rebuild of the Give to User system rendered our original script unusable, necessitating significant rewrites. Understanding that other factions might face similar challenges, I've decided to publicly share our updated userscript with the Torn community.

 

How the Userscript Works

 

This userscript doesn't function on its own. Instead, it integrates directly with your existing accounting or management tool. Whether you're using a spreadsheet, Discord bot, Python script, or another method to calculate the amounts of money to distribute, your tool will need a minor update to generate a specialized URL. This URL encodes the amounts and corresponding player IDs.

 

Once faction managers have installed the userscript, opening this special URL will display an intuitive interface, as shown in the screenshot below. Clicking through the provided buttons effortlessly completes the balance updates.

 

 

Example Scenario

 

Suppose you maintain a spreadsheet after completing an RW: Duke is rewarded $120 and Leslie gets $500 for their contribution, while bogie incurs a penalty of $1000 due to hostile revivals by opponents.

 

 

To generate the special URL, insert the following formula into a new cell:

=HYPERLINK("https://www.torn.com/factions.php?step=your#/tab=controls&batbal_uids="&TEXTJOIN(",",FALSE,B2:B4)&"&batbal_amounts="&TEXTJOIN(",",FALSE,C2:C4))

 

This generates a URL like: https://www.torn.com/factions.php?step=your#/tab=controls&batbal_uids=4,15,148747&batbal_amounts=120,500,-1000

 

Clicking the link directs you to the Give to User page, where the script automatically interprets the parameters and presents a simple interface. Clicking "Start" initiates balance adjustments, and each subsequent click on the button below updates the next player's balance. The script remembers unfinished tasks. If you close your browser prematurely, simply reopen the URL to continue seamlessly.

 

Important: Do not run this script in multiple browser tabs simultaneously, as it will disrupt saved progress.

 

Technical Documentation

 

The userscript utilizes the following URL parameters from the fragment identifier (after #) of the base URL "https://www.torn.com/factions.php?step=your#/tab=controls".

 

  • batbal_uids (required): Comma-separated player IDs to update.
  • batbal_amounts (required): Corresponding comma-separated integer values indicating balance changes.
  • batbal_action (optional): "add" (default) to adjust balances, or "give" for direct transfers.
  • batbal_asset (optional): "money" (default) or "points".

 

Q & A

 

Q: Does this script require my API key?
No.

 

Q: Is TornPDA or mobile devices supported?
Yes.

 

Q: It doesn't work on Firefox. Why?

This script is not compatible with Greasymonkey. Please try Tampermonkey or Violentmonkey.

 

Q: It doesn't work on Chrome. Why?

If you are using Tampermonkey, please follow it's documentation to enable Developer Mode in Chrome. Without doing this, Tampermonkey doesn't execute any script at all.

 

Credit: Special thanks to MAVRI, who provided valuable inspiration during the latest rewrite of this script.

 

Mentions: mavri [2402357] · Patch list #385 : 13/05/2025

Fogest [2254826]

Great script, appreciate the work on it. Have started to make use of it in the faction. 

 

I do have some members who would love TornPDA support. Out of curiosity is the reason it doesn't work related to limitations in PDA with reading the arguments out of the URL? 

 

I would consider trying to get TornPDA support added and submit a pull request if you're interested? 

tobytorn [1617955]

To be honest, I don't know whether it works in PDA or not. We always use it on PC, so I just don't include code for PDA compatibility.

 

Let me have a look. I think it should not be hard to make it work in PDA.

Viciously_Grim [2752611]

Works perfectly in Firefox mobile. Easy to bulk add and I'm bulk remove the exact same values when I accidentally use the wrong pay sheet (turtle pay sheet when I mean to use med out pay sheet... Need to throw a flag in the sheet).

 

Easy peasy.

FunkMasta [3393072]

Just wanted to say, this is going to make my life much easier doing our equal split OC pay. Thank you. 

 

edit: keep getting an error though,  Error: Param "batbal_uids" and "batbal_amounts" have different lengths, both are set to the same number of cells

FunkMasta [3393072]

ok so i think i figured out whats happening, in addition to needing no special characters in the amounts field, it also give an error if any fields are left blank. 

Fogest [2254826]

This post deserves a bump, I have been using this since release and incorporated into some of our faction families workflows and it has been very useful. Let's bump this and make sure other leaders can find it :)