Auto gym switcher(1.2.4) PC/mobile | Tools & Userscripts | TORN

Auto gym switcher(1.2.4) PC/mobile

​

    • Stephen_Lynx [2869110]
    • Role: Civilian
    • Level: 96
    • Posts: 4,186
    • Karma: 5,155
    • Last Action: 25 days
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Thread created on 02:52:55 - 13/11/23 (2 years ago)
    |
    Last replied 13:48:23 - 20/06/26 (3 months ago)

    Download from greasyfork here

    Raw script, GreasyFork removes the updateURL.

     

    Also, RussianRob made a fork that adds support for TornPDA, allows you to switch directly to gyms using stats that are not available.

    I am not maintaining this fork, contact him for issues related to his fork specifically.



    This script will check if the gym you are using is optimal for the stat you are training. If it's not, it will change gyms when you click to train, you can then click again to train. It will keep track of manual gym changes and will let you know when it automatically changes gyms, a message will appear where the train message would be. This script can be automatically updated. It SHOULD check and consider newly unlocked gyms, but I haven't tested it yet. Also, make sure to disable tornpda's own gym ratio feature.
    PS: the script was made compliant since beta, it is perfectly legal. One click, one request, one action.

    PSS: if it broke for you on newer versions of TM, setting 'Modify existing content security policy (CSP) headers' to 'Yes' fixes it.


    1.1.0: now energy cost, logo, name and selection buttons are changed visually to match the gym being used.
    1.1.1: just made the script a bit more resilient in case element's classes and ids change.
    1.1.2: made compatible with TornPDA. It seems to glitch out when used in conjunction with the ratio script. Also, set it to inject at start.
    1.2.0: added a gym ratio feature and a checkbox to disable auto swap. It works for me on TornPDA, but I have all other scripts disabled. One person said it's still broken there and another says it's broken for them even with all scripts disabled.
    1.2.2: added colors to ratio feature. Fixed interaction with relocked specialist gyms. Fixed detection of newly unlocked gyms. Yes, I accidentally skipped 1.2.1 but I'm not feeling like resetting and force pushing the repository. Also it should fix duplicate elements on tornPDA.

    1.2.3: fixed the break caused by august, 22, 2024 update.

    1.2.4: fixed visual elements not updating because of the anniversary event.

    Last edited by Stephen_Lynx on 05:10:19 - 26/05/26 (4 months ago)
    • tiksan [2383326]
    • Role: Civilian
    • Level: 100
    • Posts: 1,195
    • Karma: 1,634
    • Last Action: 1 hour
      • 1
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 03:43:27 - 13/11/23 (2 years ago)
    Post link copied to clipboard Copy post link
    First of all... link lol

    By the way, from what I can tell, you're making a non-API network request to Torn without user interaction (as well as more than one request per interaction) which they don't allow.

    https://cdn.discordapp.com/attachments/719011659561173012/1237732490513481809/Sith_Larping_Asshats.gif?ex=678f8935&is=678e37b5&hm=6d9a2ed93994782d9020538e0ec71a3d072964d584aceb09e9e6f547752d41e0&

    • Stephen_Lynx [2869110]
    • Role: Civilian
    • Level: 96
    • Posts: 4,186
    • Karma: 5,155
    • Last Action: 25 days
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 03:46:34 - 13/11/23 (2 years ago)
    Post link copied to clipboard Copy post link

    tiksan [2383326]

    First of all... [url=https://gitgud.io/stephenlynx/autogymswitch/-/blob/master/index.js?ref_type=heads]link[/url] lol By the way, from what I can tell, you're making a non-API network request to Torn without user interaction (as well as more than one request per interaction) which they don't allow.
    Hm, I didn't know the rules were that strict.
    • tiksan [2383326]
    • Role: Civilian
    • Level: 100
    • Posts: 1,195
    • Karma: 1,634
    • Last Action: 1 hour
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 05:16:21 - 13/11/23 (2 years ago)
    Post link copied to clipboard Copy post link

    tiksan [2383326]

    First of all... [url=https://gitgud.io/stephenlynx/autogymswitch/-/blob/master/index.js?ref_type=heads]link[/url] lol By the way, from what I can tell, you're making a non-API network request to Torn without user interaction (as well as more than one request per interaction) which they don't allow.

    Stephen_Lynx [2869110]

    Hm, I didn't know the rules were that strict.
    Yeah, for non-API requests, you're supposed to have one user interaction (eg a button press) per request... and you're only supposed to make the call on pages where they're normally made (so you can't make a call to use an item from an attack loader for example).

    https://cdn.discordapp.com/attachments/719011659561173012/1237732490513481809/Sith_Larping_Asshats.gif?ex=678f8935&is=678e37b5&hm=6d9a2ed93994782d9020538e0ec71a3d072964d584aceb09e9e6f547752d41e0&

    • BritishBenji [2257611]
    • Role: Civilian
    • Level: 98
    • Posts: 1,062
    • Karma: 1,592
    • Last Action: 5 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 06:09:29 - 13/11/23 (2 years ago)
    Post link copied to clipboard Copy post link
    If you've identified that it breaks a rule, I'd 100% make the repo private till you've amended it!
    • Stephen_Lynx [2869110]
    • Role: Civilian
    • Level: 96
    • Posts: 4,186
    • Karma: 5,155
    • Last Action: 25 days
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 02:52:41 - 14/11/23 (2 years ago)
    Post link copied to clipboard Copy post link
    Small changes, but I made a breakthrough that will allow me to achieve what I wanted as a final experience: now instead of making a separate request for initial gym info, I piggy back the request made by the base script. This will allow me to use the same UI of the gym instead of a separate set of buttons and fields, but I'll leave that for tomorrow. Also, I added a updateUrl entry so users can update directly from TM.
    • Stephen_Lynx [2869110]
    • Role: Civilian
    • Level: 96
    • Posts: 4,186
    • Karma: 5,155
    • Last Action: 25 days
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 19:17:59 - 14/11/23 (2 years ago)
    Post link copied to clipboard Copy post link
    Released 1.0.
    let's goooo
    >:3
    • Fuckery [2653035]
    • Role: Civilian
    • Level: 100
    • Posts: 1,810
    • Karma: 6,651
    • Last Action: 25 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 11:44:25 - 15/11/23 (2 years ago)
    Post link copied to clipboard Copy post link
    I added this to TamperMonkey and nothing appears on the Gym page unless I'm missing something?

    3bcd74f3-dc95-45bc-99b3-4e95dbc3ac14-2653035.png

    • Stephen_Lynx [2869110]
    • Role: Civilian
    • Level: 96
    • Posts: 4,186
    • Karma: 5,155
    • Last Action: 25 days
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 12:15:40 - 15/11/23 (2 years ago)
    Post link copied to clipboard Copy post link

    Fuckery [2653035]

    I added this to TamperMonkey and nothing appears on the Gym page unless I'm missing something?
    Correct, just click the stats you want to train.
    • Catarchy [2632824]
    • Role: Civilian
    • Level: 96
    • Posts: 5,243
    • Karma: 9,287
    • Last Action: 2 years
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 12:17:53 - 15/11/23 (2 years ago)
    Post link copied to clipboard Copy post link

    Fuckery [2653035]

    I added this to TamperMonkey and nothing appears on the Gym page unless I'm missing something?

    Stephen_Lynx [2869110]

    Correct, just click the stats you want to train.
    is it legal now?
    • Stephen_Lynx [2869110]
    • Role: Civilian
    • Level: 96
    • Posts: 4,186
    • Karma: 5,155
    • Last Action: 25 days
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 12:43:02 - 15/11/23 (2 years ago)
    Post link copied to clipboard Copy post link

    Catarchy [2632824]

    is it legal now?
    Yes. The first click will change gyms and not train. Only subsequent clicks will train you.
    • ThunderBlitz [2684774]
    • Role: Civilian
    • Level: 61
    • Posts: 1,558
    • Karma: 1,281
    • Last Action: 17 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 16:27:36 - 16/11/23 (2 years ago)
    Post link copied to clipboard Copy post link

    Stephen_Lynx [2869110]

    Download from greasyfork here

    Raw script, GreasyFork removes the updateURL.

     

    Also, RussianRob made a fork that adds support for TornPDA, allows you to switch directly to gyms using stats that are not available.

    I am not maintaining this fork, contact him for issues related to his fork specifically.



    This script will check if the gym you are using is optimal for the stat you are training. If it's not, it will change gyms when you click to train, you can then click again to train. It will keep track of manual gym changes and will let you know when it automatically changes gyms, a message will appear where the train message would be. This script can be automatically updated. It SHOULD check and consider newly unlocked gyms, but I haven't tested it yet. Also, make sure to disable tornpda's own gym ratio feature.
    PS: the script was made compliant since beta, it is perfectly legal. One click, one request, one action.

    PSS: if it broke for you on newer versions of TM, setting 'Modify existing content security policy (CSP) headers' to 'Yes' fixes it.


    1.1.0: now energy cost, logo, name and selection buttons are changed visually to match the gym being used.
    1.1.1: just made the script a bit more resilient in case element's classes and ids change.
    1.1.2: made compatible with TornPDA. It seems to glitch out when used in conjunction with the ratio script. Also, set it to inject at start.
    1.2.0: added a gym ratio feature and a checkbox to disable auto swap. It works for me on TornPDA, but I have all other scripts disabled. One person said it's still broken there and another says it's broken for them even with all scripts disabled.
    1.2.2: added colors to ratio feature. Fixed interaction with relocked specialist gyms. Fixed detection of newly unlocked gyms. Yes, I accidentally skipped 1.2.1 but I'm not feeling like resetting and force pushing the repository. Also it should fix duplicate elements on tornPDA.

    1.2.3: fixed the break caused by august, 22, 2024 update.

    1.2.4: fixed visual elements not updating because of the anniversary event.

    Will this work on TornPDA?

    That time my company hit #1

    Not all changes are for the better. #BeCarefulWhatYouWishFor

    • Stephen_Lynx [2869110]
    • Role: Civilian
    • Level: 96
    • Posts: 4,186
    • Karma: 5,155
    • Last Action: 25 days
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 16:31:11 - 16/11/23 (2 years ago)
    Post link copied to clipboard Copy post link

    ThunderBlitz [2684774]

    Will this work on TornPDA?
    Didn't test it. I haven't used tornPDA for a long time now, but from what I remember the UI is not too different. So I guess it might but I can't give you any guarantees.

    edit: installed tornpda with my script, will post results when I land.
    Last edited by Stephen_Lynx on 16:45:52 - 16/11/23 (2 years ago)
    • Stephen_Lynx [2869110]
    • Role: Civilian
    • Level: 96
    • Posts: 4,186
    • Karma: 5,155
    • Last Action: 25 days
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 16:53:56 - 16/11/23 (2 years ago)
    Post link copied to clipboard Copy post link

    ThunderBlitz [2684774]

    Will this work on TornPDA?
    Didn't work.
    • MightyGoober [812478]
    • Role: Civilian
    • Level: 100
    • Posts: 6,717
    • Karma: 21,040
    • Last Action: 27 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 17:12:06 - 16/11/23 (2 years ago)
    Post link copied to clipboard Copy post link
    Just my 2 cents, it's a bad user experience to have the gym switch override the train button.

    I think a better way, is upon the user clicking train, do a check & math on the current gym and what the best gym is. Then, cancel the usual torn request and show a message back to the user.
    "You're currently in YouSuck gym, the better gym to pick is: YouRock gym. The training request was cancelled. Switch gyms to continue."

    Something like that.

    Make the script prevent you from being dumb, and make the user correct the gym themselves with a little output information. IMO.
    (Switching the gym for you might still be against the rules, not 100% sure)
    Last edited by MightyGoober on 17:13:16 - 16/11/23 (2 years ago)

    • Seba_Nile [1782274]
    • Role: Civilian
    • Level: 100
    • Posts: 4,538
    • Karma: 2,071
    • Last Action: 1 year
      • 1
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 17:23:12 - 16/11/23 (2 years ago)
    Post link copied to clipboard Copy post link
    And where exactly do you add the script for it to work? It just loads a page full of code?

    8auSZpU.png

    • Stephen_Lynx [2869110]
    • Role: Civilian
    • Level: 96
    • Posts: 4,186
    • Karma: 5,155
    • Last Action: 25 days
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 17:29:07 - 16/11/23 (2 years ago)
    Post link copied to clipboard Copy post link

    Seba_Nile [1782274]

    And where exactly do you add the script for it to work? It just loads a page full of code?
    I have changed the link to one from greasyfork with an install button.
    • Stephen_Lynx [2869110]
    • Role: Civilian
    • Level: 96
    • Posts: 4,186
    • Karma: 5,155
    • Last Action: 25 days
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 17:31:34 - 16/11/23 (2 years ago)
    Post link copied to clipboard Copy post link

    MightyGoober [812478]

    Just my 2 cents, it's a bad user experience to have the gym switch override the train button. I think a better way, is upon the user clicking train, do a check & math on the current gym and what the best gym is. Then, cancel the usual torn request and show a message back to the user. "You're currently in YouSuck gym, the better gym to pick is: YouRock gym. The training request was cancelled. Switch gyms to continue." Something like that. [b]Make the script prevent you from being dumb, and make the user correct the gym themselves with a little output information. IMO. [/b](Switching the gym for you might still be against the rules, not 100% sure)
    I 100% will NOT make it just block training and display a message. If that would suffice, I wouldn't have made this script. The issue I had was that changing gyms manually was super clunky and slow. The one I wrote not only prevents you from being dumb but also streamlines the experience. Is it against the rules? I don't think so. The rules don't say anything about making a button perform a different action. The general consensus was that as long as one interaction performs one action within one http request, you are safe.
    • ThunderBlitz [2684774]
    • Role: Civilian
    • Level: 61
    • Posts: 1,558
    • Karma: 1,281
    • Last Action: 17 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 17:43:35 - 16/11/23 (2 years ago)
    Post link copied to clipboard Copy post link

    MightyGoober [812478]

    Just my 2 cents, it's a bad user experience to have the gym switch override the train button. I think a better way, is upon the user clicking train, do a check & math on the current gym and what the best gym is. Then, cancel the usual torn request and show a message back to the user. "You're currently in YouSuck gym, the better gym to pick is: YouRock gym. The training request was cancelled. Switch gyms to continue." Something like that. [b]Make the script prevent you from being dumb, and make the user correct the gym themselves with a little output information. IMO. [/b](Switching the gym for you might still be against the rules, not 100% sure)

    Stephen_Lynx [2869110]

    I 100% will NOT make it just block training and display a message. If that would suffice, I wouldn't have made this script. The issue I had was that changing gyms manually was super clunky and slow. The one I wrote not only prevents you from being dumb but also streamlines the experience. Is it against the rules? I don't think so. The rules don't say anything about making a button perform a different action. The general consensus was that as long as one interaction performs one action within one http request, you are safe.
    As-is it sounds really cool. I'm selfishly hoping you'll get it working on TornPDA :-D since that's all I use for this game (a growing number of people are the same) but, even if not, what it seems to do just now is excellent.

    That time my company hit #1

    Not all changes are for the better. #BeCarefulWhatYouWishFor

    • Stephen_Lynx [2869110]
    • Role: Civilian
    • Level: 96
    • Posts: 4,186
    • Karma: 5,155
    • Last Action: 25 days
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 17:45:06 - 16/11/23 (2 years ago)
    Post link copied to clipboard Copy post link

    ThunderBlitz [2684774]

    As-is it sounds really cool. I'm selfishly hoping you'll get it working on TornPDA :-D since that's all I use for this game (a growing number of people are the same) but, even if not, what it seems to do just now is excellent.
    I'll have a look at it. The issue with tornpda is that it doesn't seem to offer an environment that is friendly to developing scripts. If I can get help on their discord, I'll post a second link for the tornpda version.
Reply
Thread Title: