Skip to content
TORNLIFE More

Request - Revive script

Started by Zimz [2122283] on in Tools & Userscripts.

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

Posts archived: 4 / 4 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
4
Discussion span
→
People posting
2
Likes on archived posts
1
Authority score
35 / 100
Historical score
20 / 100
Story score
26 / 100
Engagement score
47 / 100
Zimz [2122283]

Hello

 

I use this script to filter the hospital to online/idle ppl that have revives enabled. But theres two issues with it. 

 

1 is that it only work properly if u click from last person to top person

2 is that it doesnt filter out ppl that have early discharge

 

Can someonee kindly fix these two issues.. thanks

Also I am on torn pda in case its important.

 

// ==UserScript==
// @name         Remove Revives Below X%
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  try to take over the world!
// @author       You
// @match        https://www.torn.com/hospital*
// @grant        none
// ==/UserScript==

(function () {
  "use strict";
  setInterval(() => {
    let minChance = localStorage.getItem("RRBX_chance") || 80;

    if (!document.querySelector(".rrbx")) {
      document.querySelector("#top-page-links-list").appendChild(
        Object.assign(document.createElement("button"), {
          innerHTML: "% Setting",
          className: "rrbx t-clear h c-pointer  m-icon line-h24 right last",
          onclick: () => {
            minChance = parseFloat(prompt("Minimum revive chance to keep?", minChance))
            localStorage.setItem("RRBX_chance", minChance);
          },
        })
      );
    }

      let rows = document.querySelectorAll(".revive > li")
      rows.forEach((row) => {
          if(row.querySelector("a.reviveNotAvailable")) row.remove()
          else if (row.querySelector("#iconTray > li").title.includes("Offline")) row.remove()
      })
    let rev = document.querySelectorAll("div.ajax-action");
    if (!rev.length) return;

    rev.forEach((el) => {
      let succ = el.querySelector("b").textContent.replace("%", "");
      if (parseFloat(succ) > minChance) return;
      el.closest("li").remove();
    });
  }, 100);
})();